diff --git a/.ci/testruns/default/templates/testrun.yaml b/.ci/testruns/default/templates/testrun.yaml index 868515d33..7754b7232 100644 --- a/.ci/testruns/default/templates/testrun.yaml +++ b/.ci/testruns/default/templates/testrun.yaml @@ -49,10 +49,17 @@ spec: - name: REGION type: env value: westeurope + - name: infrastructure-test-flow + definition: + name: infrastructure-test-flow + config: + - name: REGION + type: env + value: westeurope - name: bastion-test definition: name: bastion-test config: - name: REGION type: env - value: westeurope \ No newline at end of file + value: westeurope diff --git a/.test-defs/infrastructure-test-flow.yaml b/.test-defs/infrastructure-test-flow.yaml new file mode 100644 index 000000000..36807e2fd --- /dev/null +++ b/.test-defs/infrastructure-test-flow.yaml @@ -0,0 +1,22 @@ +kind: TestDefinition +metadata: + name: infrastructure-test-flow +spec: + owner: gardener-oq@listserv.sap.com + description: Integration test for infrastructure creation and deletion + activeDeadlineSeconds: 4200 + + command: [bash, -c] + args: + - >- + go test -timeout=0 -mod=vendor ./test/integration/infrastructure + --v -ginkgo.v -ginkgo.progress -ginkgo.no-color + --kubeconfig=$TM_KUBECONFIG_PATH/testmachinery.config + --subscription-id=${SUBSCRIPTION_ID} + --tenant-id=${TENANT_ID} + --client-id=${CLIENT_ID} + --client-secret=${CLIENT_SECRET} + --region=${REGION} + --use-flow + + image: eu.gcr.io/gardener-project/3rd/golang:1.19.2 diff --git a/example/controller-registration.yaml b/example/controller-registration.yaml index 162ffe802..28b1fbe0c 100644 --- a/example/controller-registration.yaml +++ b/example/controller-registration.yaml @@ -5,7 +5,7 @@ metadata: name: provider-azure type: helm providerConfig: - chart: H4sIAAAAAAAAA+w9a3PbtrL9rF+BUdtpkhtSD796dCb3Xsd2U08TR2O56XROz/VAJCyxoUiWDztqc/773cWL4EuUHEdJW2F6TixgASwWi8XuAgvOaOyygMUWe5eyIPHCwIri8NZzIYv+nsWs98UHpz6ko4MD/i+k8r/878He/mB4MDw8xPzB4d5e/wty8OFdt6csSWlMyBdxGKar4NrK/6Rp1jr/J3Map/aSLvz79oETfLi/3zj/w4PS/A8ha/gF6T/kQJvS33z+aeS9YTHO+4jcDjo0ioyf9t6B3bdcdttxWeLEXpTygmPyPfMXxEHGIDdhTNI5Iy8kI5Fj5BoylkxENF91ArpgI9LKcJ3bOgQ+NZ3+qql9/buhY8/CD+mjZf0Ph8NBSf4f7UPWbv1vIfV65CSMlrE3m6fkkfOYDPuDf5DJ8ZhMzggsbRrwH/TmxvM9mjLihIuIBkubHPs+4dUSErOExbfMtcnV3EsIgDIC//qeAyzFXJIFKAlQShxH1IF/JuFNekdBTLwUIE/JrU2GICscFqWEJiQIU6gXQpX4zkugtYBXf3l+cnYBiGEPnV4P/lMt1HSi25YSjQztPnmEAF1Z1H38T2xiGWZkQZfYKcmgs1QPQiIEveOwgQCBw8idl84FNqIVG9v4WbYRTlMK4BQqRPDrxgQkNJVI8zRP02jU693d3dmUY2yH8awniZb05FgtwFrW+jHwWYLU/i3zYhjxdElAXkMFOgVcfXrHJ2wWMyhLQ8T6LvZSL5g9JYkkODbjekkae9MsLRBN4QhDNwGAbMAC3eMJOZ90yfPjyfnkKTby0/nV969/vCI/HV9eHl9cnZ9NyOtLcvL64vT86vz1Bfz6jhxf/Ex+OL84fUqYhzMJ5IxiHAGg6SE5gWOwrQljBRTUlpJEzPFuPAeGFswyOmNkFsLmEMCISMTihZfgtCaAoIvN+N7CS2nKsyrjsjsAMgtHMxR2yMfJnFgO6dp2D/67ZYEbxr0ZoJlNbZjrnpKL+R9z6rztqeqWEwZpHPo+iMmYzZBgvGcbmi3KT2KTrx45NCWipzdnlxOgz2P5k72jQAjWa2oO1S7yHHrOoueZ85alI9GoyDqDSkudk/DdWfw6Ee2NgXJMZp1eTC6ZE8au+G25QKbz4CaGenHmpJAlAX8K47csFj+6SDYyht6Q/GLHZwHyW0IK1MyiKJTagMzEWcIJgC5j5qQkHyIpDLETma3vNvrtpvb9P2XAoTDHyb0twY3tv2F/b3i4s/+2kTaZ/+s580HuJnYabWQLtuh/gyFMdnH+h4cHO/1vK+mPPyzishsvAK0IDbQusf7zn067kYb1YNPk0B2zEZ9OmZ+ARhPZb9lSNMd/ZFPYuhnwke2FPeyq0EZDE7fUzyROf/wBGo3jZ67G1Cay4gpEqnXLCGIrI9IAIfvnPVVH4QXAPKAS8ur2JfMZBU3jApCrxUyj5i1gvxOYEYIl3g2Z02QcQ/k70k3mdHhwOIJu32D30BXC2ymdEV0jir0gvSHdr5P//TopQ8YsChMvDePlqiZgjKyuwdG9G4TBGuMuT4jLIj9cLliQSgtfM0fSux0UyPWpV8XfJ20i/2F5JCmLwTKC/08sP5zNQMlrdw22yP/9Qb9k/w8Pjvr7O/m/jWT6/25gYQfp1Ett8ReKuNsB9SOQR523XuCOyIlgge84C3QWLKUuTekIBIAQmvgXMRrS1lO6jEBMdhOwTbsAI3yBjh9mrmlKLWgAUkVyntVU3EHDEHuSnIh/ggCjcQJmS0cY1yDaL3gfwKUySwIQlOEWjJv7LGJLZEsY6ck4xUERsIsY5C9o6sxFNSn6nzRh9mQ14k86lmV1PinJF9SZgzRuJPqnp20zhoK6nwERncSz3NjDERpYyrlPvE9Pw1oEn2gEPxMSJgGNknmYfm6UU3h9VgRbhK53syyr4bX0EqCKXsAArse9YioHYYCKXJF7hSRgRhEm0OpG5P9ysvwCenD8iw0E/8VGfqKwPmPIfdQowO3/+p9r/N9qefi+fiGVKifeYzWHmc8Ko6CuW8T8+lpR8XqR+akHOg0N0mvPvb4ekTBCv1QY/zMTbLFFSq0Qu2q0j1bAFGf9vSBMM/xHopdcLoX1slPV/9xpI/0/DG682YJGFjf+bpkDzGGhSx7PGVijIdB2/r9/uFfS/48O+kc7/X8bSXofClb9Gz6xr9W8Ct9H4ZqA3OA4P7yiUWFzE9tVvbemnnFkpSSida4Uni2cDGrfrDprsPn3kAm8nJJ9hFbo8B6T6yKXjsh7bGTlqIvNGU6NTz1lD5rut/7XNv15aln/eweD8vrfP+zv7db/NtJDLWzJEZbgkeKKFjxW0ns1vyVa8bW5nijZLBPHg1zNx5b1ghaqrmUoIVgBVzQ2+6/vzl9enV3+W2s53BtbSgXDgBCu2ZVAHsTaV439wJbXZTxy64WQMcenioA2ZcZFhC+FLXONxozKu0KT5qORoN0o/+uMtdV4/msNtc7a/YxHKEy2tUeoAU+UcWcA4vD4Cc/1Qhh3aM99joYvIceuW6bEKuOtZLv9ycj7aazlDyXyp97K75Xupf9teBu87f7n4Kh8/r83ONzpf1tJD6X/ad74qMac6EWbcLg+0TGL/5oD4YxrKz62DVVTNlDSOKXjdsAb0iSQYuLEVEc7JXtZtuf4HuAKkAEYkSgE+QgB31K+cr5RB++VYh9QfLWMWMJJpW92dlvat6sN4MVNVb/bhl9dfYkyJ7LK3RAro+Zm6JgVNR6/RZtSBWps1i9W0P1NszhJN+yR19msT1Gl6FLA7lnqaOdsApsKbE25r9bxaZJcqAVY6gJr2rKKrSHzgUF1vGDspcv22hJQ4VdldQ4+5ddPBRBJw5/xluoKOL2YD//KrpQ/Zdpo/49dK8qmvud4EXVdvMq9liawev8f9GG3L9//GOwd7vb/baTyuSb8bWyXb79NxMGmUgyAWuECrLgwix12ihe7uNJf0BNoEITyHr4QYIbKPWMBv0M3zTwft2ZsXKsfffvQHmpFo8RpIFnEth6zBXOXpS1cH4TO4jCLlAZQDyoVlJGx2495X+fjY9EXL/G9JP2hrvQlFHCIyAetwK/BlJeCTR2nF3lPFsJ5kSjzglnm07hSF0oTJ8SNV2tLiLCkkTzfFfQpKC0JmFcLqvYLaCA4Hp+/2ZsUsvECohHGVxoWbGEYnQFiGiMqZBifQI+cj4la8LotEBNg/qRe8UjU4KXCQWOh528QORmUI24HJjxUQA4TNl4xHhE/4xmoCSWsaKEBEOAbTn+FDdYmE+53SJD8me8i78HPFFpwwlng/a7bTjBEBjvlsi0ttemBPhIH1Cfcfn2KISY8vCdm2AvJAqO9W7HvkVdhjIFKN+GIh/Ykox4GlKg15ISLRQarZSliPTC8JoyTnstumd9LvJlFYzBQU8YjMXpARoujHvB1ZC/cL2O56pJviifQXE3DgJ1gZhRwvl4xA8jZqLdQWVWMIie0it64PJtcEdU1n4wy9TndDebJpwAJBvTggTgYURWHC94mbP5RCBQW4SFcPyo1mmTThZcKrQomB+fKJidcsJApI1kEsgbDzc4DyF0w/wTti489AUjpxELCrjcFpkwsAwuqGQVKfjXMV2mtTgDaXK8qWkquBXPtlihbt5Ix1a9mTF4kOy0XlFBUyCFXIT4UCAkLKO9QRcNVZEqlXZJznCdHY1eAGqhOtCpexNfKB7LWfICoyZINZoTDV+ZE5H6EWWHvYBdqm5IzDqTi6GBq7uaMB+LVToMmes18iO4wcA+WYNNcTMMQLP2yeL6hns/c19xVVrxbU4vzdyVwIaRwM+Zk9H3ZoHS+cZDKlsBxwg3FizkTSuffOmwFEmBRg+NqLGXhlCGuEj8x3RrLmhYRR5rizX8QaiwgNEVdG6MuKXFg2jGQNMgWU5gwXDoeKARVfFcxiUiy2YbS0sCOJbBaxaX+eZ4eE7mjdYu30C1uuCHQJK5DndOA8w5uuDPjpMBMLI7D+BVwaMEkXjGIM6OC4B++7WAuSGWRrXcjsJfL20+e8qHirNYyjDmKGmmkAZB8KV1Ea43gSkGredDVlRRFtFu4C1ML2jdhvKDpiOB+amEf9x4eAqw1MukcKjISVm/CkQEPNjVtkRcsrdPe60BPUDqtCwztvhHS45UQHo2QlwyjsJdrQbfQsX7rUh2phVxbaC6SWgDNQfWlgFidEK3fHc1CGsd0WSrzakZQVBZOFQ94bqNe8EFagDQjV6PB/WRK0uHf66BSQ6bNkeNOFjR2oAh1hzZMx2V4hbbZENc3SoOowfaBKNykZwldoV3JqmSKRyT07ezcDWrkZFNtB+XOUq6qkT92/sTN06b+P6lRSYVqvYPAFv/fYHBYjv/aPzranf9tJX2+/r8ip31M71/Nzp07/4qFFd9fCcsGz9/touT2K1bbptevOJ5ap1/Jatq5/HYuvyL1dy6/Lbj8igt1LY+fXLglylaWMaZmp8E8TNI1VOfvJZjSQ1U1pX3+oG95kSB01aNOFV7C1ChvWqiNCdgD7C93+Tr+ERYoNIBvE7Vp/XV1cByme6yEfw3aakQVLxNkyQevkHlj7Ao9Z1ne2WYeNKWQnZ+uYyRwwIJ1gE9hQVb9xGwwsAewDRSXlLJrZ7EEk1PhQfy3peW1rvv2QZbYhztvmxybO9ftznW7c93ytHPdrju8net257rV6V6u23sI64/juH1YRLbgpK3XJzA9xBB2LtpdWp028f/mD7htFgDS4v8dHh3sl+M/9nfxv9tJRd+veIlPeEVP9WyvHQXSWS/2g7+FaD46MAvCmCmvsryRX/Eia6FSjt4Q1UekiyKoW7xWv0mQCXYy92Zzi96C5kWnnu+lSxnYYjf2LmUv939pP3TMhLj/3kP5uHyJL1OPyICX8Ae7k8JNfJl5EmZBKjBJgG74HIEYOg+fe7neUA5lA/i8MpvJt23Q+w57w4/ciaaE8oK++zGQY/WLgQXFojySAPInWTyrAPNMAabEhcS85BCrzCqmNd+gUODOnDlvk2xhvEcgQvxqH5co8Ooj/sol+cq+kljaz4E7xzSdk+5az5t0H3Naixc6AQcTr1I8RwOqK+On7oHsWmgZ1IUZiT0nscUr3hMnBgkQzMwKIP8X6GnI9EutsLZqHjjtNtRIsM18PSqgL9HvTzM/JRKF3CnM39fPH0CHVWCaM8XW8ZlxiU9xRGN8f9zEqjIfawqDb1UN00ELcxECFyxP8kAcvXUmywS43vpHv6/UHZAGnsOOHQdX9MVqicn5RAe/qv6sNkErEufUIpR8XLYKNs58fxyCoCmGAYmHXCNdWODfcLGg5qmCRXrtbwPnwJYFHIMFXJwhqJKjlh86b58ZaAjAMwmn5e1LADMxwjZFVNGUv4dvgfTBxeNkcQyTZ+EhTeB4PkueFUOdJHcltlnbzmtOloGT1PfE8Jn9+3bEK7f3wx/vv08fiQqgW9W+kBYWftPiWY+lTq+eraRU6RlhluVmsOcIvyqwOa5m7VaEE9gyZ8LDcI+ejNptPblBEvPPImzeja7a1secUT+d881g816Mymv0E6dTRlNLq2HPmrQw0lATGmd3Fj8MvaW+lSB+7irkRD2b1zuX1SaiVqUbr/C9ic1pUazfRg6hGFraVWXl2kdjB7yKdg4f6wrltu/4RzI2H4Go14b5HZvOw/CtWrfts7mqttyNLNw5TbQkmIhvtiWU3EXb2sNXFlqbY3Fda66XoOZhPMRQIJYszuOvE9iZfwU1gXSfdpvakn3XNfSTLGpopV47qsNbFllTUBMseX/u2ahRD1mlFuYyobk1UV6HiN6A5d0Jc9DaOJFlNUNlv1Wh8alRHS9PuuLTL+V+EUhv9bWdFpupq45ffmnAmFcW5S3kY8GtqZEIRenl2fHp2eX12cuzE/wA0fXF8auzyfj45MzwcvELD9+BOln0h914zHcv2U3Zu8fzUd8eaTvG1kvxvtaLwvf81fGLszeA7OvL69dvzi5/ujy/quA6Ij3+VRzj/bpe7YN2q8jle7dA4CQZx+G04MHEGxMvWFocdsTH2xPs93uxiKverTyKiV+4AfS/v7oaGwX8uhj1T5lPl3KPALO4ryHwrNzbGFd+wr4dVIc5rthFUuVDJSylRyBvUOv44zJu60hObgaloRP6I3J1Mi4H58dF54mipnbDVsP08xrvSSAtn0G/5l0CTLehny3YK7RmaobsqDffVFogoFg47drmhy6kpicl65CpLCYDDrnodeAvDVe2wqpADfwUHt4pGhmc4B6DyXpcKcgd8KcZ+ubxYp6boSfmnOsZMvvsHXMy83kQMTxumk4KjiBjVOgSOhPfU6s7mufvFjd+1kR/+KRylKCeNAIBVT2ZFNfeqocg1jqfTzErpGEU+uFs+QPi2C1+VEVdEVGGvOC9imFcYh5HPVljYrf2izUqSQ/Fq9CFevt6sW/Emevx5eb4tvH5CtxXvLaxif8f+ByUqjjjp13TzJ2x9Q4C2t7/Pax8//dgb7D7/tNWkmTthC1u8amjRYRf5ez+9zMysIcDqw+8d0Ij4Qv3gPXx8pg8L7BfeOmbXMs0DxIi7kjSH/WR3xmqhZiCYjUwtxz5IEPonmpWe85Z7aFPITY7HFC+wBqneZJNySN0Y9a58x+TwYN49D/W/G+y/uMpde7zIfCW9Q+yqvL9t8Fwd/63lVSO/+BzTLN0Hsbe78KBVgkCEd+1uAx9tsma3GS1yQ8XWBhb8AJjOmQMROOjwZ2Ctougpps3qeb0xJUEowAdtR6rySmCcn9r8YcJIL+RJX8YHs+aHLOe9iWWf5pARfdXbZ4JLnxNhb/zYhD3U0kqFK5c4RTBLQCM0qkjPr2i/hIX8KtT0nQwWp0R8dymq3OLSHSfdKuNOyGQwAtMPqy2y2V7qTUHtHmuHYlRkXxY5EN7Ufk6wMcqffG3fOYhaFyVs9p3Wj8bTQTvdvk/eFgvuVBNUePaFRVc+cHkwtd3TYCa0C9eAKo5sg8++N5EHb3hJqWfPbCJqO/9rviQYXiF+DNhMEupXhdCGZdQ8mRQLgZ9E0FV5K7Kwg8qztoKixAWGqtkoMMNRiLyc4hK0a/hVPwBWm/+R0+8fgzMnKX8E8fSdnfMRyJlnzxWTtHJ1bFyiUlTrgd5a60Fdcc8oRFfYLXzgDXbmwIeCROH+qtmFEOoQInxYdQKXMxha+Mrg+/uha/QFqu1awySZjmwiZQTXOczXH8ftEE+Fyz10fZJ6EI6LhXJVmDY0Y+bGjt4Cz6g3OLlP74Zi8qTwuH2w+jin1oL+vumTfR/IbDVeRLeTsGH6/xWk6DV/q/Efx+CUbDT/7eR0PKOaTBj2npVB4FqerlLuSwFtaybcJ6okW/61FG1gzefxI0mW7yhfn5K5Ou4+V+iucJVpvfojw0cMhjWyZOv2ox7tLab34MuXeaLsjgKE7zNzDG0qoMQa0A/SK1GImSbHhfHQI1NlOmRGmVitGa5HD/AiHuFryP6W8Y+4pO5m61/To2NXQBt6/9ocFT9/vvu+19bSQ2Lmk/03+Ter3LtiRUndaPzccFnt96lW30kaFUPIFtvWxTP9/gpCY1Bad3ouHDj+b/H+pem1vpioG397/UPyu+/DIcHu/W/jbRq/SsV/5M63tH45Ee4RaSuwrcMP8ML+gnbmQ/3TxutfxHrxb8wsIkS0Lr/H1bif44GO///VtJ9LoWZMkN9OKLsA5mIfH5dvl6AbPARi/V1AuG0sYCLveCW+p5rCY+OEY2wkfDx/fDuDb+AcPYuooEYM78fokM68cPjLcMxYLFVcaNBuobEeX1LA5Ua2ExEY6CQ+uy3BJWbs9BlxjFbeNni+uXlpMmE2GT930b0Psd/bet/MDgs7//D/i7+bzupdLUFp1hEBrmlhd6tOo1htXflcn8jvcXj0D3W3uL1vx4F3a6pPChlvQZvJRTMMJZiXv4cnbyIJ5zv6pU2XSAidr55ot58WnjBMUoCM5B6wRZhvGz4XFAVHTtvwxZV678atFZNPrSCvSNMBX2HtS6qE/MrkZ1tt44AQAhQk4AipyK4EHUT2M7hdp/9+VxTu/yXb93dR/DL1Hb/oz8YluR//2DQ38n/bSQRQMglZRQmXsplGsvsmcMf59TsAUyB50A6o5c7UXuV8L+Uzkb5I4uREXd4fnMRpmPxxlanY16UwvDo8uUqniMDjg/6X2MFdf6HT0mAwEHM5X6l7+3WyfyqBFfy+3D/ldcq5bq4qXU7HSPEY0S+7X/b7+T3ynnGoNMx4lqwIfPWid5/zNgfGJoG48GCK6GS/J5wLYR5wWQVmBEhtwJMX0NZAWPEp62GEpcdRkRq8NVwsRHZ62Np8UrLikbFpZYVAI3hXMpz0KmGG43Iv/7dKQUP8bySu1I38SWpuxCM36f8ksjQW+CEL42rwRHNEhEAxdUNXgYaPG/30liHMy+dZ1OwCBa9/I60+efUD6e9BUWH5f+3dy65DcJAGN77FBZsi8GGdsG6So7QZZWmKaIvIsiivX39mMGmkANE+r9djD3Cwh5i7H+m9CF1S2+6fBzscBud3JNsp7Obp/YwdJ+n5yg9Dm2Lw9frQ0PN/ETOalVlVDAH69VKa/Vz273Sq16Fg6/ahAtKKSEWX1v9Qit+um1l09RUxLoOXZn7SoilnLlN3JJTNLd8nEjkuW19cSdJJh93kTzMnTypTsmJ5fkvv5LlV6SFZ1/kTFsjwQnO0npuOLtHFvqTlxTHuT/bOUq3MpS6WFnWXbtK5ftEkcuS1J1Xavg8nprE8ZRkU9fuZ0x5+S/h5XGtsg8L/OIthnyLSS3ret9T4WJZvhQWhMNZdmZ/UN2NdfjTob/shnHX27u0nZ/s9VEIvodWpGMl80+e3yj8EqTo0+TkOq4qcrnaWHVOoUi2EGnTUfvBF3cPp/P3oox3DWk7Xm9bMRtWzHUrBn/KAQAAAAAAAAAAAAAAAAAAAADgpvkDkfr2UgDIAAA= + chart: H4sIAAAAAAAAA+09a3PbtrL9rF+BUdpp2htSDz/SozO99zq2k3qaOBrLTadzeq4HImGJDUWyfNhR2/Pf7y5eBF+i5DhO2hLTc2IBC2CxWCx2F1hwQWOXBSy22LuUBYkXBlYUhzeeC1n0tyxmg8/eOw0hPT044P9CKv/L/x7t7Y/GB+PDQ8wfHe7tDT8jB+/fdXvKkpTGhHwWh2G6Ca6t/E+aFq3zf7ykcWqv6cq/ax84wYf7+43zPz4ozf8YssafkeF9DrQp/c3nn0beGxbjvE/IzahHo8j4ae8d2EPLZTc9lyVO7EUpLzgi3zF/RRxkDHIdxiRdMvJCMhI5Qq4hU8lERPNVL6ArNiGtDNe7qUPgY9Ppr5ra178bOvYifJ8+Wtb/eDweleT/033I6tb/A6TBgByH0Tr2FsuUPHa+IuPh6B9kdjQls1MCS5sG/Ae9vvZ8j6aMOOEqosHaJke+T3i1hMQsYfENc21yufQSAqCMwL++5wBLMZdkAUoClBJHEXXgn1l4nd5SEBMvBcgTcmOTMcgKh0UpoQkJwhTqhVAlvvUSaC3g1V+eHZ+eA2LYQ28wgP9UCzWd6LalRCNje0geI0BfFvW/+ic2sQ4zsqJr7JRk0FmqByERgt5x2ECAwGHk1kuXAhvRio1t/CTbCOcpBXAKFSL4dW0CEppKpHlapmk0GQxub29tyjG2w3gxkERLBnKsFmAta/0Q+CxBav+aeTGMeL4mIK+hAp0Drj695RO2iBmUpSFifRt7qRcsnpBEEhybcb0kjb15lhaIpnCEoZsAQDZggf7RjJzN+uTZ0exs9gQb+fHs8rvXP1ySH48uLo7OL89OZ+T1BTl+fX5ydnn2+hx+PSdH5z+R78/OT54Q5uFMAjmjGEcAaHpITuAYbGvGWAEFtaUkEXO8a8+BoQWLjC4YWYSwOQQwIhKxeOUlOK0JIOhiM7638lKa8qzKuOwegCzCyQKFHfJxsiSWQ/q2PYD/bljghvFgAWhmcxvmeqDkYv7HkjpvB6q65YRBGoe+D2IyZgskGO/ZhmaL8pPY5PPHDk2J6OnN6cUM6POV/MneUSAEGzQ1h2oXeQY9Z9GzzHnL0oloVGSdQqW1zkn47ix+HYv2pkA5JrNOzmcXzAljV/y2XCDTWXAdQ704c1LIkoA/hvFbFosffSQbmUJvSH6x47MA+S0hBWpmURRKbUBm4izhBECXMXNSkg+RFIbYi8zWu43+YVP7/p8y4FCY4+TOluDO9t94uDc+7Oy/h0i7zP/VkvkgdxM7jXayBVv0v9EYJrs4/+PDg07/e5D0++8Wcdm1F4BWhAZan1j/+U+v3UjDerBpcuie2YhP58xPQKOJ7LdsLZrjP7I5bN0M+Mj2wgF2VWijoYkb6mcSp99/B43G8TNXY2oTWXEDItW6ZQSxlQlpgJD9856qo/ACYB5QCXl1+4L5jIKmcQ7I1WKmUfNWsN8JzAjBEu+aLGkyjaH8HeknSzo+OJxAt2+we+gK4e2ULoiuEcVekF6T/hfJ/36RlCFjFoWJl4bxelMTMEZW1+Dkzg3CYI1xlyfEZZEfrlcsSKWFr5kjGdyMCuT62Kvi75N2kf+wPJKUxWAZwf8nlh8uFqDktbsGW+T//mhYsv/HB0+H+538f4hk+v+uYWEH6dxLbfEXiribEfUjkEe9t17gTsixYIHnnAV6K5ZSl6Z0AgJACE38ixgNaespXUcgJvsJ2KZ9gBG+QMcPM9c0pVY0AKkiOc9qKu6hYYg9SU7EP0GA0TgBs6UnjGsQ7ee8D+BSmSUBCMpwC8bNfRaxJbIljPRknOCgCNhFDPJXNHWWopoU/V83Yfb1ZsS/7lmW1fuoJF9RZwnSuJHoH5+2zRgK6n4CRHQSz3JjD0doYCnnPvE+Pg1rEfxaI/iJkDAJaJQsw/RTo5zC65Mi2Cp0vet1WQ2vpZcAVfQCBnA97hVTOQgDVOSK3CskATOKMIFWNyH/l5PlZ9CD459tIPjPNvIThfUZQ+7jRgFu/9f/XOH/NsvDP+oXUqly4n2l5jDzWWEU1HWLmF9dKSperTI/9UCnoUF65blXVxMSRuiXCuN/ZoItHpBSG8SuGu3jDTDFWf9DEKYZ/gPRSy6XwnrpVPU/d9pJ/w+Da2+xopHFjb8b5gBzWOiSx3MG1mgItJ3/7x/ulfT/pwfDp53+/xBJeh8KVv0bPrGv1bwK30fhmoDc4Dg/vKJRYXMT21W9t6aecWSlJKJ1rhSeLZwMat+sOmuw+T8gE3g5JfsIrdDhPSZXRS6dkD+wkY2jLjZnODU+9pTda7rb+t/a9OepZf3vHYzK63//cLjXrf+HSPe1sCVHWIJHiita8FhJ79X8lmjF1+Z6omSzTBwPcjUfW9YLWqi6lqGEYAVc0djsv56fvbw8vfi31nK4N7aUCoYBIVyzK4Hci7WvGvuera/KeOTWCyFTjk8VAW3KTIsIXwhb5gqNGZV3iSbNByNBu1H+1xlrq/H81xpqnbX7CY9QmGxbj1ADHivjzgDE4fETnquVMO7QnvsUDV9Cjly3TIlNxlvJdvuTkffjWMvvS+SPvZXfKd1J/9vxNnjb/c/R0/L5/97osNP/HiTdl/6neeODGnOiF23C4fpExyz+aw6EM66t+Ng2VE3ZQEnjlI7bEW9Ik0CKiWNTHe2V7GXZnuN7gCtABmBEohDkIwR8S/nK+UYdvFeKfUDx5TpiCSeVvtnZb2nfrjaAFzdV/X4bfnX1JcqcyCp3R6yMmruhY1bUePwa7UoVqLFbv1hB9zfP4iTdsUdeZ7c+RZWiSwG7Z6mjnbMJbCqwNeW+WsenSXKuFmCpC6xpyyq2hswHBtXxgrGXrttrS0CFX5XVOficXz8VQCQNf8Jbqhvg9GI+/Cu7Uv6Uaaf9P3atKJv7nuNF1HXxKvdWmsDm/X80hN2+fP9jtHfY7f8PkcrnmvC3sV2+/SYRB5tKMQBqhSuw4sIsdtgJXuziSn9BT6BBEMp7+EKAGSr3ggX8Dt0883zcmrFxrX4M7UN7rBWNEqeBZBHbesxWzF2XtnB9ELqIwyxSGkA9qFRQJsZuP+V9nU2PRF+8xPeS9Pu60pdQwCEiH7QCvwZTXgo2dZye5z1ZCOdFoswLFplP40pdKE2cEDderS0hwpJG8nxX0KegtCRgXq2o2i+ggeBoevZmb1bIxguIRhhfaViwhWF0BohpjKiQYXwCPXI2JWrB67ZATID5k3rFI1GDlwoHjYWev0TkZFCOuB2Y8FABOUzYeMV4RPyMZ6AmlLCihQZAgG84/wU2WJvMuN8hQfJnvou8Bz9TaMEJF4H3m247wRAZ7JTLtrTUpgf6SBxQn3D79QmGmPDwnphhLyQLjPZuxL5HXoUxBipdhxMe2pNMBhhQotaQE65WGayWtYj1wPCaME4GLrth/iDxFhaNwUBNGY/EGAAZLY56wNeRvXIfxXLVJV8WT6C5moYBO8HCKOB8vWEGkLNRb6GyqhhFTmgVvXFxOrskqms+GWXqc7obzJNPARIM6MEDcTCiKg5XvE3Y/KMQKCzCQ7h+VGo0yeYrLxVaFUwOzpVNjrlgIXNGsghkDYabnQWQu2L+MdoXH3oCkNKJhYTdbgpMmVgGFlQzCpT8apiv0lqdAbS5XlW0lFwL5totUbZuJWOqX82YvEh2Wi4ooaiQQ65CfCgQEhZQ3qGKhqvIlEq7JOc4T47GrgA1UJ1oVbyIr5UPZKv5AFGTJTvMCIevzInI/QCzwt7BLtQ2JaccSMXRwdTcLhkPxKudBk30mvkQ3WHgHizBprmYhyFY+mXxfE09n7mvuauseLemFufnJXAhpHAz5mT0fdmgdL5xkMqWwHHCDcWLORNK5982bAUSYFWD42YsZeGcIa4SPzHdGsuaFhFHmuLNfxBqLCA0RV0boy4pcWDaMZA0yFZzmDBcOh4oBFV8NzGJSLLZhtLSwI4ksFrFpf55nh4TuaV1i7fQLW64IdAkrkOd04DzDm64C+OkwEwsjsP4FXBowSTeMIhTo4LgH77tYC5IZZGtdyOwl8vbT57yoeKs1jKMOYoaaaQBkHwpXUVbjeBSQat50NWVFEW0W7gLUwva12G8oumE4H5qYR93Hh4CbDUy6RwqMhJWb8KRAQ82NW2RFyyt097rQI9ROm0LDO2+EdLjlRAejZAXDKOw11tBt9CxfutSHamFXFtoLpJaAM1B9aWAWJ0Qrd8dzUIax3RdKvNqRlBUFk4UD3huo17wXlqANCM3o8H9ZErS4d/boFJDpt2R404WNHagCHWHNkynZXiFttkQ1zdKg6jB9p4o3KRnCV2hXcmqZIpHJPTt7NwNauRkc20H5c5SrqqR3zt/4u5pV/+f1KikQrXdQWCL/280OizHf+0/fdqd/z1I+nT9f0VO+5Dev5qdO3f+FQsrvr8Slg2ev5tVye1XrPaQXr/ieGqdfiWrqXP5dS6/IvU7l98DuPyKC3Urj59cuCXKVpYxpmanwTJM0i1U5+8kmNJDVTWlfX6vb3mRIHTVo04VXsLUKG9aqI0J2APsL3f9Ov4BFig0gG8TtWn9dXVwHKZ7rIR/DdpqRBUvE2TJB6+QeWPsCj1nWd7Zbh40pZCdnWxjJHDAgnWAT2FBVv3E7DCwe7ANFJeUsmtnsQSTU+Fe/Lel5bWt+/Zeltj7O2+bHJud67Zz3XauW5461+22w+tct53rVqc7uW7vIKw/jOP2fhF5ACdtvT6B6T6G0Llou7Q57eL/zR9w2y0ApMX/O356sF+O/9jv4n8fJhV9v+IlPuEVPdGzvXUUSG+72A/+FqL56MAiCGOmvMryRn7Fi6yFSjl6Q1SfkD6KoH7xWv0uQSbYydJbLC16A5oXnXu+l65lYIvd2LuUvdz/pf3QMRPi/jsP5eP6Jb5MPSEjXsIf7E4KN/Fl5nGYBanAJAG64XMEYug8fO7ldkM5lA3g88psId+2Qe877A0/cCeaEsor+u6HQI7VLwYWFIvySALIn2XxogLMMwWYEhcS85JDrDKrmLZ8g0KBO0vmvE2ylfEegQjxq31cosCrj/krl+Rz+1JiaT8D7pzSdEn6Wz1v0v+K01q80Ak4mHiV4jkaUN0YP3UHZLdCy6AuzEjsOYktXvGeOTFIgGBhVgD5v0JPQ6ZfaoW1VfPAab+hRoJt5utRAT1Cvz/N/JRIFHKnMH9fP38AHVaBac4UW8dnxiU+xRFN8f1xE6vKfGwpDL5RNUwHLcxFCFywPs4DcfTWmawT4HrrH8OhUndAGngOO3IcXNHnmyUm5xMd/Kr6s9oErUicU4tQ8nHZKtg08/1pCIKmGAYkHnKNdGGBf8PVipqnChYZtL8NnANbFnAMFnBxhqBKjlp+6Lz91kBDAJ5KOC1vXwKYiRG2KaKK5vw9fAukDy4eJ4tjmDwLD2kCx/NZ8m0x1ElyV2Kbte285mwdOEl9Twyf2b9rR7xyez/88f679JGoALpN7QtpYeE3Lb4dsNQZ1LOVlCoDI8yy3Az2HOFXBXbH1azdinACW+ZCeBju0JNRu60nN0hi/lmE3bvRVdv6WDLqp0u+Gezei1F5i37idM5oamk17NsmLYw01ITG2a3FD0NvqG8liJ+7CTlRz+b1zmS1mahV6cYrfG9id1oU67eRQyiGlnZVWbn20dgBr6Kdw0e6QrntW/6RjN1HIOq1YX7L5sswfKvWbftsbqotdyMLd04TLQkm4pttCSV30bb28JWF1uZYXNea6yWoeRgPMRSIJYvz+OsEduZfQE0g/Sf9prZk33UN/SiLGlqp147q8JZF1hzUBEven/t20qiHbFILc5nQ3Joor0NEb8Dy7oQ5aG2cyLKaobJfq9D41KiOlyd98emXcr8IpLf62k6LzdRVxy+/NGDMK4vyFvKx4MbUSISi9PL06OT04ur05ekxfoDo6vzo1elsenR8ani5+IWH56BOFv1h1x7z3Qt2Xfbu8XzUtyfajrH1Uryr9aLwPXt19OL0DSD7+uLq9ZvTix8vzi4ruE7IgH8Vx3i/blD7oN0mcvneDRA4SaZxOC94MPHGxAuWFocd8fEOBPv9Viziqncrj2LiF24A/e8uL6dGAb8uRv0T5tO13CPALB5qCDwr93bGlZ+wPwyq4xxX7CKp8qESltIjkDeodfxpGbdtJCc3g9LQCf0JuTyeloPz46LzRFFTu2GrYfp5jT9IIC2f0bDmXQJMN6GfrdgrtGZqhuyoN99UWiGgWDjt2ub7LqSmJyXrkKksJgMOueh14K8NV7bCqkAN/BQe3imaGJzgHoHJelQpyB3wJxn65vFinpuhJ+aM6xky+/QdczLzeRAxPG6azgqOIGNU6BI6Fd9Tqzua5+8WN37WRH/4pHKUoJ40AgFVPZkU196qhyDWNp9PMSukYRT64WL9PeLYL35URV0RUYa84L2KYVxiHkc9WWNit/WLNSpJD8Wr0IV6+3qx78SZ2/Hl7vi28fkG3De8trGL/x/4HJSqOOOnXfPMXbDtDgLa3v89rHz/92Bv1H3/6UGSZO2ErW7wqaNVhF/l7P/3t2Rkj0fWEHjvmEbCF+4B6+PlMXleYL/w0je5lmkeJETckaQ/6iO/M1QLMQfFamRuOfJBhtA90az2jLPafZ9C7HY4oHyBNU7zJJuTx+jGrHPnf0VG9+LR/1Dzv8v6j+fUucuHwFvWP8iqyvffRuPu/O9BUjn+g88xzdJlGHu/CQdaJQhEfNfiIvTZLmtyl9UmP1xgYWzBC4zpkDEQjY8G9wraLoKabt6kmjMQVxKMAnTUeqwmpwjK/a3FHyaA/EaW/GF4PGtyzHral1j+aQIV3V+1eSa48DUV/s6LQdzPJalQuHKFUwS3ADBKp5749Ir6S1zAr05J08FodUbEc5uuzi0i0f+6X23cCYEEXmDyYbVdLttLrTmgzXPtSIyK5MMi79uLytcBPlbpi7/lMw9B46qc1b7T+tloIni/z//Bw3rJhWqKGteuqODKDyYXvr5rAtSEfvECUM2RffDB9ybq6A03Kf0cgE1Efe83xYcMwyvEnwmDWUr1uhDKuISSJ4NyMeibCKoid1UWflBx1lZYhLDQWCUDHW4wEpGfQ1SKfgnn4g/QevM/BuL1Y2DmLOWfOJa2u2M+Ein75LFyik6ujpVLTJpyPcjbai2oO+YJjfgCq50HrNneFPBImDjU3zSjGEIFSowPo1bgYg5bG98YfHcnfIW2WK1dY5A0y4FdpJzgOp/h+nuvDfKZYKkPtk9CF9JxqUi2AcOeftzU2MFb8AHlFi//8c1YVJ4VDrfvRxf/2FrQ3zftov8Lga3Ok/B2Cj5c57eaBK32fyX++xCMgk7/f4iElndMgwXT1qs6CFTTy13KZSmoZd2M80SNfNOnjqodvPkkbjTZ4g31sxMiX8fN/xLNFa4y/YH+2MAho3GdPPm8zbhHa7v5PejSZb4oi6MwwdvMHEOrOgixBvSD1GokQrbpcXEM1NhEmR6pUSZGa5bL8QOMuFf4OqK/ZuwDPpm72/rn1NjZBdC2/p+Onla//959/+tBUsOi5hP9N7n3q1x7YsVJ3ehsWvDZbXfpVh8JWtUDyNbbFsXzPX5KQmNQWnc6Ltx5/u+w/qWptb0YaFv/e8OD8vsv4/FBt/4fIm1a/0rF/6iOdzQ++RFuEanL8C3Dz/CCfsI68+Huaaf1L2K9+BcGdlECWvf/w0r8z9NR5/9/kHSXS2GmzFAfjij7QGYin1+XrxcgO3zEYnudQDhtLOBiL7ihvudawqNjRCPsJHx8P7x9wy8gnL6LaCDGzO+H6JBO/PB4y3AMWGxV3GiQriFxXt/SQKUGNhPRGCikPvstQeXmLHSZacxWXra6enkxazIhdln/NxG9y/Ff2/ofjQ7L+/942MX/PUwqXW3BKRaRQW5poferTmNY7X253N9Ib/E0dI+0t3j7r0dBt1sqD0pZr8FbCQUzjKWYlz9HJy/iCee7eqVNF4iInS+/Vm8+rbzgCCWBGUi9YqswXjd8LqiKjp23YYuq9V8N2qomH1rB3hGmgr7DWhfVifmVyM62W0cAIASoSUCRUxFciLoJbOdw3Wd/PtXULv/lW3d3Efwytd3/GI7GJfk/PBgNO/n/EEkEEHJJGYWJl3KZxjJ74fDHOTV7AFPgOZDOGORO1EEl/C+li0n+yGJkxB2eXZ+H6VS8sdXrmRelMDy6fLmK58iA44PhF1hBnf/hUxIgcBBzuV/pe7t1Mr8qwZX8Ptx/5bVKuT5uav1ezwjxmJBvht8Me/m9cp4x6vWMuBZsyLx1ovcfM/YHhqbBeLDgRqgkvydcC2FeMNkEZkTIbQDT11A2wBjxaZuhxGWHCZEafDVcbEL2hlhavNKyoVFxqWUDQGM4l/Ic9KrhRhPyr3/3SsFDPK/krtRNPCJ1F4Lx+5SPiAy9BU54ZFwNjmiWiAAorm7wMtDgebsXxjpceOkym4NFsBrkd6TNP+d+OB+sKDosB/xJ3QFvenASArvFGO4p2zZXt1raYbjw2VUeeizqWnTlHu7Lanwh9/fsYV9m6Md6R/ZoZL/7c49qVBmVuPg6GosC27Z7vYK3lRtauet2Qvb392SWiusYDccHw16vGM48McQSRjRP1HWi3qNHUDvFmyQJf3dRSpgnhNkLmyQqPH++Jir8SsbCK1mETUMjQgjq0HpVUYtHFegvpWTP0eOp/0Zp3RdK8a0sENcINPglkS+XGZ/ubIDg3/EcyeB4+ZHN0R7+zD95WfrgpVONshcGvnWdP/mWf9Ryb++FJzMLZnkxsEBczoKV/VbC1tjhP1IvfR7Gzz3AEgafQHnc6ykcJj2TV/p85tWOojZB+fq0FHILBdp7RCoHqygULOMIUR46jjjz5aeHSRQU8tSpoTyOH9W3Mq5pZdzcyrhTyrvUpS51qUtd6lKXutSlLnWpS13qUpe61KUudalLXepSl7rUpS516U+d/h+R+vZSAMgAAA== values: image: tag: v1.35.0-dev @@ -17,19 +17,19 @@ metadata: spec: deployment: deploymentRefs: - - name: provider-azure + - name: provider-azure resources: - - kind: BackupBucket - type: azure - - kind: BackupEntry - type: azure - - kind: Bastion - type: azure - - kind: ControlPlane - type: azure - - kind: DNSRecord - type: azure-dns - - kind: Infrastructure - type: azure - - kind: Worker - type: azure + - kind: BackupBucket + type: azure + - kind: BackupEntry + type: azure + - kind: Bastion + type: azure + - kind: ControlPlane + type: azure + - kind: DNSRecord + type: azure-dns + - kind: Infrastructure + type: azure + - kind: Worker + type: azure diff --git a/go.mod b/go.mod index b4a50f850..7a69d5036 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,15 @@ go 1.19 require ( github.com/Azure/azure-sdk-for-go v61.1.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.4 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.0.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 github.com/Azure/azure-storage-blob-go v0.8.0 github.com/Azure/go-autorest/autorest v0.11.27 github.com/Azure/go-autorest/autorest/adal v0.9.20 - github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 + github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 github.com/Azure/go-autorest/autorest/to v0.3.0 github.com/Masterminds/semver v1.5.0 github.com/Masterminds/sprig v2.22.0+incompatible @@ -20,13 +25,16 @@ require ( github.com/gardener/machine-controller-manager v0.45.0 github.com/gardener/remedy-controller v0.6.0 github.com/go-logr/logr v1.2.3 + github.com/gofrs/uuid v4.2.0+incompatible github.com/golang/mock v1.6.0 + github.com/google/go-cmp v0.5.9 github.com/onsi/ginkgo/v2 v2.6.1 github.com/onsi/gomega v1.24.2 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.1.0 golang.org/x/tools v0.4.0 + gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.26.1 k8s.io/apiextensions-apiserver v0.26.1 k8s.io/apimachinery v0.26.1 @@ -42,12 +50,14 @@ require ( require ( github.com/Azure/azure-pipeline-go v0.2.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect - github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 // indirect + github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/autorest/validation v0.2.0 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/BurntSushi/toml v0.3.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -56,7 +66,7 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cyphar/filepath-securejoin v0.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dimchansky/utfbom v1.1.0 // indirect + github.com/dimchansky/utfbom v1.1.1 // indirect github.com/dsnet/compress v0.0.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect @@ -72,14 +82,12 @@ require ( github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/gobuffalo/flect v0.3.0 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.2.0 // indirect + github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect - github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/google/uuid v1.1.2 // indirect @@ -92,6 +100,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kubernetes-csi/external-snapshotter/v2 v2.1.4 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-colorable v0.1.12 // indirect @@ -112,6 +121,7 @@ require ( github.com/pelletier/go-toml v1.9.4 // indirect github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect @@ -143,7 +153,6 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.66.4 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect istio.io/api v0.0.0-20221013011440-bc935762d2b9 // indirect istio.io/client-go v1.15.3 // indirect diff --git a/go.sum b/go.sum index 60096185c..016fb89cd 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,21 @@ github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuI github.com/Azure/azure-sdk-for-go v39.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v61.1.0+incompatible h1:Qbz3jdfkXIPjZECEuk2E7i3iLhC9Ul74pG5mQRQC+z4= github.com/Azure/azure-sdk-for-go v61.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.4 h1:pqrAR74b6EoR4kcxF7L7Wg2B8Jgil9UUZtMvxhEFqWo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.4/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 h1:XUNQ4mw+zJmaA2KXzP9JlQiecy1SI+Eog7xVkPiqIbg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1 h1:H3g2mkmu105ON0c/Gqx3Bm+bzoIijLom8LmV9Gjn7X0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 h1:KepfQdVTTQl/UmAbRALdkUUUfcWfu8xRaqrQ03ZGwvM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0/go.mod h1:Q3u+T/qw3Kb1Wf3DFKiFwEZlyaAyPb4yBgWm9wq7yh8= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.0.0 h1:nBy98uKOIfun5z6wx6jwWLrULcM0+cjBalBFZlEZ7CA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.0.1 h1:/fMvCZ5fvoXXw3JzKPCOQPQJRYIE/ljhgkddcjBBleU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.0.1/go.mod h1:mU96hbp8qJDA9OzTV1Ji7wCyPyaqC5kI6ZPsZfJ8sE4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s= github.com/Azure/azure-storage-blob-go v0.8.0 h1:53qhf0Oxa0nOjgbDeeYPUeyiNmafAFEY95rZLK0Tj6o= github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= @@ -49,6 +64,7 @@ github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= +github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc= github.com/Azure/go-autorest/autorest v0.11.27 h1:F3R3q42aWytozkV8ihzcgMO4OA4cuqr3bNlsEuF6//A= github.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= @@ -57,10 +73,12 @@ github.com/Azure/go-autorest/autorest/adal v0.8.1/go.mod h1:ZjhuQClTqx435SRJ2iMl github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= github.com/Azure/go-autorest/autorest/adal v0.9.20 h1:gJ3E98kMpFB1MFqQCvA1yFab8vthOeD4VlFRQULxahg= github.com/Azure/go-autorest/autorest/adal v0.9.20/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= -github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 h1:iM6UAvjR97ZIeR93qTcwpKNMpV+/FTWjwEbuPD495Tk= github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM= -github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 h1:LXl088ZQlP0SBppGFsRZonW6hSvwgL5gRByMbvUbx8U= +github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 h1:wkAZRgT/pn8HhFyzfe9UnqOjJYqlembgCTi72Bm/xKk= +github.com/Azure/go-autorest/autorest/azure/auth v0.5.12/go.mod h1:84w/uV8E37feW2NCJ08uT9VBfjfUHpgLVnG2InYD6cg= github.com/Azure/go-autorest/autorest/azure/cli v0.3.1/go.mod h1:ZG5p860J94/0kI9mNJVoIoLgXcirM2gF5i2kWloofxw= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 h1:0W/yGmFdTIT77fvdlGZ0LMISoLHFJ7Tx4U0yeB+uFs4= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.5/go.mod h1:ADQAXrkgm7acgWVUNamOgh8YNrv4p27l3Wc55oVfpzg= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= @@ -81,6 +99,8 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= +github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -187,8 +207,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= +github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -364,8 +386,9 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -555,6 +578,8 @@ github.com/kubernetes-csi/csi-lib-utils v0.7.1/go.mod h1:bze+2G9+cmoHxN6+WyG1qT4 github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0= github.com/kubernetes-csi/external-snapshotter/v2 v2.1.4 h1:5k854kIoa81t4A0BhVAXV/VcNKklXwdPyGrvkCDoZC4= github.com/kubernetes-csi/external-snapshotter/v2 v2.1.4/go.mod h1:2ar8FelpdkUJaoqp8cQpucBd8pir8c1K5BQIVZwUbJI= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= @@ -679,6 +704,8 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1090,6 +1117,7 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/pkg/azure/client/availabilityset.go b/pkg/azure/client/availabilityset.go new file mode 100644 index 000000000..0da35acba --- /dev/null +++ b/pkg/azure/client/availabilityset.go @@ -0,0 +1,58 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewAvailabilitySetClient creates a new AvailabilitySetClient. +func NewAvailabilitySetClient(auth internal.ClientAuth) (*AvailabilitySetClient, error) { + cred, err := auth.GetAzClientCredentials() + if err != nil { + return nil, err + } + client, err := armcompute.NewAvailabilitySetsClient(auth.SubscriptionID, cred, nil) + return &AvailabilitySetClient{client}, err +} + +// CreateOrUpdate creates or updates a new availability set. +func (c AvailabilitySetClient) CreateOrUpdate(ctx context.Context, resourceGroupName, availabilitySetName string, parameters armcompute.AvailabilitySet) (*armcompute.AvailabilitySet, error) { + res, err := c.client.CreateOrUpdate(ctx, resourceGroupName, availabilitySetName, parameters, nil) + if err != nil { + return nil, fmt.Errorf("cannot create availability set: %v", err) + } + return &res.AvailabilitySet, nil +} + +// Get returns the availability set for the given resource group and availability set name. +func (c AvailabilitySetClient) Get(ctx context.Context, resourceGroupName, availabilitySetName string) (*armcompute.AvailabilitySet, error) { + res, err := c.client.Get(ctx, resourceGroupName, availabilitySetName, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res.AvailabilitySet, err +} + +// Delete deletes the availability set for the given resource group and availability set name. +func (c AvailabilitySetClient) Delete(ctx context.Context, resourceGroupName, availabilitySetName string) error { + _, err := c.client.Delete(ctx, resourceGroupName, availabilitySetName, nil) + return FilterNotFoundError(err) +} diff --git a/pkg/azure/client/client_suite_test.go b/pkg/azure/client/client_suite_test.go index 999674582..b5c25d24e 100644 --- a/pkg/azure/client/client_suite_test.go +++ b/pkg/azure/client/client_suite_test.go @@ -15,13 +15,80 @@ package client_test import ( + "context" + "encoding/base64" + "flag" + "os" "testing" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "gopkg.in/yaml.v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) func TestWorker(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "Client Suite") } + +// HOW TO RUN: ginkgo -- --secret-path="" +var ( + secretYamlPath = flag.String("secret-path", "", "Yaml file with secret including Azure credentials") +) + +var _ = Describe("client", func() { + It("does not error when resource group not found", func() { + auth := setConfigVariablesFromFlags() + rclient, err := client.NewResourceGroupsClient(auth) + Expect(err).NotTo(HaveOccurred()) + Expect(rclient.Delete(context.TODO(), "random-2342341")).To(Succeed()) + }) + It("does not error when resource group not found", func() { + auth := setConfigVariablesFromFlags() + natClient, err := client.NewNatGatewaysClient(auth) + Expect(err).NotTo(HaveOccurred()) + Expect(natClient.Delete(context.TODO(), "random-2342341", "nat2134")).To(Succeed()) + }) +}) + +func setConfigVariablesFromFlags() internal.ClientAuth { + flag.Parse() + if *secretYamlPath != "" { + return readAuthFromFile(*secretYamlPath) + } else { + Skip("No secret yaml path specified to test the Azure client") + return internal.ClientAuth{} + } +} + +type ProviderSecret struct { + Data internal.ClientAuth `yaml:"data"` +} + +func readAuthFromFile(fileName string) internal.ClientAuth { + secret := ProviderSecret{} + data, err := os.ReadFile(fileName) + if err != nil { + panic(err) + } + err = yaml.Unmarshal(data, &secret) + if err != nil { + panic(err) + } + secret.Data.ClientID = decodeString(secret.Data.ClientID) + secret.Data.ClientSecret = decodeString(secret.Data.ClientSecret) + secret.Data.SubscriptionID = decodeString(secret.Data.SubscriptionID) + secret.Data.TenantID = decodeString(secret.Data.TenantID) + return secret.Data +} + +func decodeString(s string) string { + res, err := base64.StdEncoding.DecodeString(s) + if err != nil { + panic(err) + } + return string(res) +} diff --git a/pkg/azure/client/disk.go b/pkg/azure/client/disk.go index c041984ee..f06ab94d6 100644 --- a/pkg/azure/client/disk.go +++ b/pkg/azure/client/disk.go @@ -16,52 +16,55 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// Get will fetch a disk by given name in a given resource group. -func (c DisksClient) Get(ctx context.Context, resourceGroupName string, name string) (*compute.Disk, error) { - disk, err := c.client.Get(ctx, resourceGroupName, name) +// NewDisksClient creates a new disk client +func NewDisksClient(auth internal.ClientAuth) (Disk, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } - return &disk, nil + client, err := armcompute.NewDisksClient(auth.SubscriptionID, cred, nil) + return &DisksClient{client}, err } -// CreateOrUpdate will create or update a disk. -func (c DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk compute.Disk) (*compute.Disk, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, diskName, disk) +// Get will fetch a disk by given name in a given resource group. +func (c DisksClient) Get(ctx context.Context, resourceGroupName string, name string) (*armcompute.Disk, error) { + disk, err := c.client.Get(ctx, resourceGroupName, name, nil) if err != nil { - return nil, err + return nil, FilterNotFoundError(err) } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { + return &disk.Disk, nil +} + +// CreateOrUpdate will create or update a disk. +func (c DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk armcompute.Disk) (*armcompute.Disk, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, diskName, disk, nil) + if err != nil { return nil, err } - disk, err = future.Result(c.client) + res, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &disk, nil + return &res.Disk, nil } // Delete will delete a disk. func (c DisksClient) Delete(ctx context.Context, resourceGroupName, name string) error { - future, err := c.client.Delete(ctx, resourceGroupName, name) + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, nil) if err != nil { return err } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - result, err := future.Result(c.client) + _, err = future.PollUntilDone(ctx, nil) if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent || result.StatusCode == http.StatusNotFound { - return nil + if IsAzureAPINotFoundError(err) { + return nil + } } - return fmt.Errorf("deletion of disk %s failed. statuscode=%d", name, result.StatusCode) + return err } diff --git a/pkg/azure/client/dnszone.go b/pkg/azure/client/dnszone.go index 4174f2645..b4c6df558 100644 --- a/pkg/azure/client/dnszone.go +++ b/pkg/azure/client/dnszone.go @@ -23,8 +23,8 @@ import ( "github.com/Azure/go-autorest/autorest/to" ) -// GetAll returns a map of all zone names mapped to their IDs. -func (c DNSZoneClient) GetAll(ctx context.Context) (map[string]string, error) { +// List returns a map of all zone names mapped to their IDs. +func (c DNSZoneClient) List(ctx context.Context) (map[string]string, error) { zones := make(map[string]string) results, err := c.client.ListComplete(ctx, nil) diff --git a/pkg/azure/client/factory.go b/pkg/azure/client/factory.go index e0efafd3b..550e8b460 100644 --- a/pkg/azure/client/factory.go +++ b/pkg/azure/client/factory.go @@ -17,10 +17,8 @@ package client import ( "context" - azurecompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" azuredns "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - azurenetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" - azureresources "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" azurestorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -28,29 +26,37 @@ import ( "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// NewAzureClientFactory returns a new factory to produce clients for various Azure services. -func NewAzureClientFactory(client client.Client) Factory { - return AzureFactory{ - client: client, +// NewAzureClientFactory creates a new Azure client factory with the passed secret reference. +func NewAzureClientFactory(ctx context.Context, client client.Client, secretRef corev1.SecretReference) (Factory, error) { + auth, err := internal.GetClientAuthData(ctx, client, secretRef, false) + if err != nil { + return nil, err } + return azureFactory{ + auth: auth, + }, nil } -// Group reads the secret from the passed reference and return an Azure resource group client. -func (f AzureFactory) Group(ctx context.Context, secretRef corev1.SecretReference) (Group, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) +// NewAzureClientFactoryWithAuth creates a new Azure client factory with the passed credentials. +func NewAzureClientFactoryWithAuth(auth *internal.ClientAuth, client client.Client) (Factory, error) { + return azureFactory{ + client: client, + auth: auth, + }, nil +} + +// Group gets an Azure resource group client. +func (f azureFactory) Group() (ResourceGroup, error) { + cred, err := f.auth.GetAzClientCredentials() if err != nil { return nil, err } - groupClient := azureresources.NewGroupsClient(subscriptionID) - groupClient.Authorizer = authorizer - - return GroupClient{ - client: groupClient, - }, nil + client, err := armresources.NewResourceGroupsClient(f.auth.SubscriptionID, cred, nil) + return ResourceGroupClient{client}, err } // Storage reads the secret from the passed reference and return an Azure (blob) storage client. -func (f AzureFactory) Storage(ctx context.Context, secretRef corev1.SecretReference) (Storage, error) { +func (f azureFactory) Storage(ctx context.Context, secretRef corev1.SecretReference) (Storage, error) { serviceURL, err := newStorageClient(ctx, f.client, &secretRef) if err != nil { return nil, err @@ -62,8 +68,8 @@ func (f AzureFactory) Storage(ctx context.Context, secretRef corev1.SecretRefere } // StorageAccount reads the secret from the passed reference and return an Azure storage account client. -func (f AzureFactory) StorageAccount(ctx context.Context, secretRef corev1.SecretReference) (StorageAccount, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) +func (f azureFactory) StorageAccount() (StorageAccount, error) { + authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(f.auth) if err != nil { return nil, err } @@ -76,36 +82,18 @@ func (f AzureFactory) StorageAccount(ctx context.Context, secretRef corev1.Secre } // Vmss reads the secret from the passed reference and return an Azure virtual machine scale set client. -func (f AzureFactory) Vmss(ctx context.Context, secretRef corev1.SecretReference) (Vmss, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - vmssClient := azurecompute.NewVirtualMachineScaleSetsClient(subscriptionID) - vmssClient.Authorizer = authorizer - - return VmssClient{ - client: vmssClient, - }, nil +func (f azureFactory) Vmss() (Vmss, error) { + return NewVmssClient(*f.auth) } // VirtualMachine reads the secret from the passed reference and return an Azure virtual machine client. -func (f AzureFactory) VirtualMachine(ctx context.Context, secretRef corev1.SecretReference) (VirtualMachine, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - virtualMachinesClient := azurecompute.NewVirtualMachinesClient(subscriptionID) - virtualMachinesClient.Authorizer = authorizer - - return VirtualMachinesClient{ - client: virtualMachinesClient, - }, nil +func (f azureFactory) VirtualMachine() (VirtualMachine, error) { + return NewVMClient(*f.auth) } // DNSZone reads the secret from the passed reference and return an Azure DNS zone client. -func (f AzureFactory) DNSZone(ctx context.Context, secretRef corev1.SecretReference) (DNSZone, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, true) +func (f azureFactory) DNSZone() (DNSZone, error) { + authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(f.auth) if err != nil { return nil, err } @@ -118,8 +106,8 @@ func (f AzureFactory) DNSZone(ctx context.Context, secretRef corev1.SecretRefere } // DNSRecordSet reads the secret from the passed reference and return an Azure DNS record set client. -func (f AzureFactory) DNSRecordSet(ctx context.Context, secretRef corev1.SecretReference) (DNSRecordSet, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, true) +func (f azureFactory) DNSRecordSet() (DNSRecordSet, error) { + authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(f.auth) if err != nil { return nil, err } @@ -132,71 +120,52 @@ func (f AzureFactory) DNSRecordSet(ctx context.Context, secretRef corev1.SecretR } // NetworkSecurityGroup reads the secret from the passed reference and return an Azure network security group client. -func (f AzureFactory) NetworkSecurityGroup(ctx context.Context, secretRef corev1.SecretReference) (NetworkSecurityGroup, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - networkSecurityGroupClient := azurenetwork.NewSecurityGroupsClient(subscriptionID) - networkSecurityGroupClient.Authorizer = authorizer - - return NetworkSecurityGroupClient{ - client: networkSecurityGroupClient, - }, nil +func (f azureFactory) NetworkSecurityGroup() (NetworkSecurityGroup, error) { + return NewSecurityGroupClient(*f.auth) } // PublicIP reads the secret from the passed reference and return an Azure network PublicIPClient. -func (f AzureFactory) PublicIP(ctx context.Context, secretRef corev1.SecretReference) (PublicIP, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - publicIPClient := azurenetwork.NewPublicIPAddressesClient(subscriptionID) - publicIPClient.Authorizer = authorizer +func (f azureFactory) PublicIP() (PublicIP, error) { + return NewPublicIPClient(*f.auth) - return PublicIPClient{ - client: publicIPClient, - }, nil } // NetworkInterface reads the secret from the passed reference and return an Azure network interface client. -func (f AzureFactory) NetworkInterface(ctx context.Context, secretRef corev1.SecretReference) (NetworkInterface, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - networkInterfaceClient := azurenetwork.NewInterfacesClient(subscriptionID) - networkInterfaceClient.Authorizer = authorizer - - return NetworkInterfaceClient{ - client: networkInterfaceClient, - }, nil +func (f azureFactory) NetworkInterface() (NetworkInterface, error) { + return NewNetworkInterfaceClient(*f.auth) } // Disk reads the secret from the passed reference and return an Azure disk client. -func (f AzureFactory) Disk(ctx context.Context, secretRef corev1.SecretReference) (Disk, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - disksClient := azurecompute.NewDisksClient(subscriptionID) - disksClient.Authorizer = authorizer +func (f azureFactory) Disk() (Disk, error) { + return NewDisksClient(*f.auth) +} - return DisksClient{ - client: disksClient, - }, nil +// Vnet reads the secret from the passed reference and return an Azure Vnet client. +func (f azureFactory) Vnet() (Vnet, error) { + return NewVnetClient(*f.auth) } // Subnet reads the secret from the passed reference and return an Azure Subnet client. -func (f AzureFactory) Subnet(ctx context.Context, secretRef corev1.SecretReference) (Subnet, error) { - authorizer, subscriptionID, err := internal.GetAuthorizerAndSubscriptionID(ctx, f.client, secretRef, false) - if err != nil { - return nil, err - } - subnetsClient := azurenetwork.NewSubnetsClient(subscriptionID) - subnetsClient.Authorizer = authorizer +func (f azureFactory) Subnet() (Subnet, error) { + return NewSubnetsClient(*f.auth) +} - return SubnetsClient{ - client: subnetsClient, - }, nil +// RouteTables reads the secret from the passed reference and return an Azure RouteTables client. +func (f azureFactory) RouteTables() (RouteTables, error) { + return NewRouteTablesClient(*f.auth) +} + +// NatGateway returns a NatGateway client. +func (f azureFactory) NatGateway() (NatGateway, error) { + return NewNatGatewaysClient(*f.auth) +} + +// AvailabilitySet returns an AvailabilitySet client. +func (f azureFactory) AvailabilitySet() (AvailabilitySet, error) { + return NewAvailabilitySetClient(*f.auth) +} + +// ManagedUserIdentity returns a ManagedUserIdentity client. +func (f azureFactory) ManagedUserIdentity() (ManagedUserIdentity, error) { + return NewManagedUserIdentityClient(*f.auth) } diff --git a/pkg/azure/client/group.go b/pkg/azure/client/group.go deleted file mode 100644 index 8185198e0..000000000 --- a/pkg/azure/client/group.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "context" - - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" -) - -// Get gets a resource group. If the requested resource group not exists nil will be returned. -func (c GroupClient) Get(ctx context.Context, resourceGroupName string) (*resources.Group, error) { - resourceGroup, err := c.client.Get(ctx, resourceGroupName) - if err != nil { - if IsAzureAPINotFoundError(err) { - return nil, nil - } - return nil, err - } - - return &resourceGroup, nil -} - -// CreateOrUpdate creates a resource group or update an existing resource group. -func (c GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName, region string) error { - if _, err := c.client.CreateOrUpdate(ctx, resourceGroupName, resources.Group{ - Location: ®ion, - }); err != nil { - return err - } - return nil -} - -// DeleteIfExits deletes a resource group if it exits. -func (c GroupClient) DeleteIfExits(ctx context.Context, resourceGroupName string) error { - _, err := c.client.Delete(ctx, resourceGroupName) - if err != nil && IsAzureAPINotFoundError(err) { - return nil - } - return err -} diff --git a/pkg/azure/client/helper.go b/pkg/azure/client/helper.go index b367f3928..07b3470f7 100644 --- a/pkg/azure/client/helper.go +++ b/pkg/azure/client/helper.go @@ -17,15 +17,30 @@ package client import ( "net/http" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/go-autorest/autorest" ) +func FilterNotFoundError(err error) error { + if err == nil { + return nil + } + if IsAzureAPINotFoundError(err) { + return nil + } + return err +} + func isAzureAPStatusError(err error, status int) bool { switch e := err.(type) { - case autorest.DetailedError: + case autorest.DetailedError: // error from old azure client if e.Response != nil && e.Response.StatusCode == status { return true } + case *azcore.ResponseError: // error from new azure SDK client + if e.StatusCode == status { + return true + } } return false } diff --git a/pkg/azure/client/mock/doc.go b/pkg/azure/client/mock/doc.go index ff5c22ed4..874ce6659 100644 --- a/pkg/azure/client/mock/doc.go +++ b/pkg/azure/client/mock/doc.go @@ -12,6 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockgen -package client -destination=mocks.go github.com/gardener/gardener-extension-provider-azure/pkg/azure/client DNSZone,DNSRecordSet,Group,Subnet,Factory +//go:generate mockgen -package client -destination=mocks.go github.com/gardener/gardener-extension-provider-azure/pkg/azure/client DNSZone,DNSRecordSet,Subnet,Factory,ResourceGroup,Vnet,RouteTables,NatGateway,PublicIP,AvailabilitySet,NetworkSecurityGroup,ManagedUserIdentity package client diff --git a/pkg/azure/client/mock/mocks.go b/pkg/azure/client/mock/mocks.go index 156b74f02..2759bdabd 100644 --- a/pkg/azure/client/mock/mocks.go +++ b/pkg/azure/client/mock/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/gardener/gardener-extension-provider-azure/pkg/azure/client (interfaces: DNSZone,DNSRecordSet,Group,Subnet,Factory) +// Source: github.com/gardener/gardener-extension-provider-azure/pkg/azure/client (interfaces: DNSZone,DNSRecordSet,Subnet,Factory,ResourceGroup,Vnet,RouteTables,NatGateway,PublicIP,AvailabilitySet,NetworkSecurityGroup,ManagedUserIdentity) // Package client is a generated GoMock package. package client @@ -8,8 +8,10 @@ import ( context "context" reflect "reflect" - network "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" - resources "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + msi "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" client "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" gomock "github.com/golang/mock/gomock" v1 "k8s.io/api/core/v1" @@ -38,19 +40,19 @@ func (m *MockDNSZone) EXPECT() *MockDNSZoneMockRecorder { return m.recorder } -// GetAll mocks base method. -func (m *MockDNSZone) GetAll(arg0 context.Context) (map[string]string, error) { +// List mocks base method. +func (m *MockDNSZone) List(arg0 context.Context) (map[string]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAll", arg0) + ret := m.ctrl.Call(m, "List", arg0) ret0, _ := ret[0].(map[string]string) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetAll indicates an expected call of GetAll. -func (mr *MockDNSZoneMockRecorder) GetAll(arg0 interface{}) *gomock.Call { +// List indicates an expected call of List. +func (mr *MockDNSZoneMockRecorder) List(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockDNSZone)(nil).GetAll), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockDNSZone)(nil).List), arg0) } // MockDNSRecordSet is a mock of DNSRecordSet interface. @@ -104,72 +106,6 @@ func (mr *MockDNSRecordSetMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockDNSRecordSet)(nil).Delete), arg0, arg1, arg2, arg3) } -// MockGroup is a mock of Group interface. -type MockGroup struct { - ctrl *gomock.Controller - recorder *MockGroupMockRecorder -} - -// MockGroupMockRecorder is the mock recorder for MockGroup. -type MockGroupMockRecorder struct { - mock *MockGroup -} - -// NewMockGroup creates a new mock instance. -func NewMockGroup(ctrl *gomock.Controller) *MockGroup { - mock := &MockGroup{ctrl: ctrl} - mock.recorder = &MockGroupMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGroup) EXPECT() *MockGroupMockRecorder { - return m.recorder -} - -// CreateOrUpdate mocks base method. -func (m *MockGroup) CreateOrUpdate(arg0 context.Context, arg1, arg2 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockGroupMockRecorder) CreateOrUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockGroup)(nil).CreateOrUpdate), arg0, arg1, arg2) -} - -// DeleteIfExits mocks base method. -func (m *MockGroup) DeleteIfExits(arg0 context.Context, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteIfExits", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteIfExits indicates an expected call of DeleteIfExits. -func (mr *MockGroupMockRecorder) DeleteIfExits(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteIfExits", reflect.TypeOf((*MockGroup)(nil).DeleteIfExits), arg0, arg1) -} - -// Get mocks base method. -func (m *MockGroup) Get(arg0 context.Context, arg1 string) (*resources.Group, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1) - ret0, _ := ret[0].(*resources.Group) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Get indicates an expected call of Get. -func (mr *MockGroupMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockGroup)(nil).Get), arg0, arg1) -} - // MockSubnet is a mock of Subnet interface. type MockSubnet struct { ctrl *gomock.Controller @@ -193,6 +129,21 @@ func (m *MockSubnet) EXPECT() *MockSubnetMockRecorder { return m.recorder } +// CreateOrUpdate mocks base method. +func (m *MockSubnet) CreateOrUpdate(arg0 context.Context, arg1, arg2, arg3 string, arg4 armnetwork.Subnet) (*armnetwork.Subnet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(*armnetwork.Subnet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockSubnetMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockSubnet)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3, arg4) +} + // Delete mocks base method. func (m *MockSubnet) Delete(arg0 context.Context, arg1, arg2, arg3 string) error { m.ctrl.T.Helper() @@ -208,25 +159,25 @@ func (mr *MockSubnetMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *go } // Get mocks base method. -func (m *MockSubnet) Get(arg0 context.Context, arg1, arg2, arg3, arg4 string) (*network.Subnet, error) { +func (m *MockSubnet) Get(arg0 context.Context, arg1, arg2, arg3 string) (*armnetwork.Subnet, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(*network.Subnet) + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.Subnet) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockSubnetMockRecorder) Get(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockSubnetMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockSubnet)(nil).Get), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockSubnet)(nil).Get), arg0, arg1, arg2, arg3) } // List mocks base method. -func (m *MockSubnet) List(arg0 context.Context, arg1, arg2 string) ([]network.Subnet, error) { +func (m *MockSubnet) List(arg0 context.Context, arg1, arg2 string) ([]*armnetwork.Subnet, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "List", arg0, arg1, arg2) - ret0, _ := ret[0].([]network.Subnet) + ret0, _ := ret[0].([]*armnetwork.Subnet) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -260,109 +211,169 @@ func (m *MockFactory) EXPECT() *MockFactoryMockRecorder { return m.recorder } +// AvailabilitySet mocks base method. +func (m *MockFactory) AvailabilitySet() (client.AvailabilitySet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AvailabilitySet") + ret0, _ := ret[0].(client.AvailabilitySet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AvailabilitySet indicates an expected call of AvailabilitySet. +func (mr *MockFactoryMockRecorder) AvailabilitySet() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AvailabilitySet", reflect.TypeOf((*MockFactory)(nil).AvailabilitySet)) +} + // DNSRecordSet mocks base method. -func (m *MockFactory) DNSRecordSet(arg0 context.Context, arg1 v1.SecretReference) (client.DNSRecordSet, error) { +func (m *MockFactory) DNSRecordSet() (client.DNSRecordSet, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DNSRecordSet", arg0, arg1) + ret := m.ctrl.Call(m, "DNSRecordSet") ret0, _ := ret[0].(client.DNSRecordSet) ret1, _ := ret[1].(error) return ret0, ret1 } // DNSRecordSet indicates an expected call of DNSRecordSet. -func (mr *MockFactoryMockRecorder) DNSRecordSet(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) DNSRecordSet() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DNSRecordSet", reflect.TypeOf((*MockFactory)(nil).DNSRecordSet), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DNSRecordSet", reflect.TypeOf((*MockFactory)(nil).DNSRecordSet)) } // DNSZone mocks base method. -func (m *MockFactory) DNSZone(arg0 context.Context, arg1 v1.SecretReference) (client.DNSZone, error) { +func (m *MockFactory) DNSZone() (client.DNSZone, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DNSZone", arg0, arg1) + ret := m.ctrl.Call(m, "DNSZone") ret0, _ := ret[0].(client.DNSZone) ret1, _ := ret[1].(error) return ret0, ret1 } // DNSZone indicates an expected call of DNSZone. -func (mr *MockFactoryMockRecorder) DNSZone(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) DNSZone() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DNSZone", reflect.TypeOf((*MockFactory)(nil).DNSZone), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DNSZone", reflect.TypeOf((*MockFactory)(nil).DNSZone)) } // Disk mocks base method. -func (m *MockFactory) Disk(arg0 context.Context, arg1 v1.SecretReference) (client.Disk, error) { +func (m *MockFactory) Disk() (client.Disk, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Disk", arg0, arg1) + ret := m.ctrl.Call(m, "Disk") ret0, _ := ret[0].(client.Disk) ret1, _ := ret[1].(error) return ret0, ret1 } // Disk indicates an expected call of Disk. -func (mr *MockFactoryMockRecorder) Disk(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) Disk() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disk", reflect.TypeOf((*MockFactory)(nil).Disk), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disk", reflect.TypeOf((*MockFactory)(nil).Disk)) } // Group mocks base method. -func (m *MockFactory) Group(arg0 context.Context, arg1 v1.SecretReference) (client.Group, error) { +func (m *MockFactory) Group() (client.ResourceGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Group", arg0, arg1) - ret0, _ := ret[0].(client.Group) + ret := m.ctrl.Call(m, "Group") + ret0, _ := ret[0].(client.ResourceGroup) ret1, _ := ret[1].(error) return ret0, ret1 } // Group indicates an expected call of Group. -func (mr *MockFactoryMockRecorder) Group(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) Group() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Group", reflect.TypeOf((*MockFactory)(nil).Group)) +} + +// ManagedUserIdentity mocks base method. +func (m *MockFactory) ManagedUserIdentity() (client.ManagedUserIdentity, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ManagedUserIdentity") + ret0, _ := ret[0].(client.ManagedUserIdentity) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ManagedUserIdentity indicates an expected call of ManagedUserIdentity. +func (mr *MockFactoryMockRecorder) ManagedUserIdentity() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ManagedUserIdentity", reflect.TypeOf((*MockFactory)(nil).ManagedUserIdentity)) +} + +// NatGateway mocks base method. +func (m *MockFactory) NatGateway() (client.NatGateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NatGateway") + ret0, _ := ret[0].(client.NatGateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NatGateway indicates an expected call of NatGateway. +func (mr *MockFactoryMockRecorder) NatGateway() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Group", reflect.TypeOf((*MockFactory)(nil).Group), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NatGateway", reflect.TypeOf((*MockFactory)(nil).NatGateway)) } // NetworkInterface mocks base method. -func (m *MockFactory) NetworkInterface(arg0 context.Context, arg1 v1.SecretReference) (client.NetworkInterface, error) { +func (m *MockFactory) NetworkInterface() (client.NetworkInterface, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NetworkInterface", arg0, arg1) + ret := m.ctrl.Call(m, "NetworkInterface") ret0, _ := ret[0].(client.NetworkInterface) ret1, _ := ret[1].(error) return ret0, ret1 } // NetworkInterface indicates an expected call of NetworkInterface. -func (mr *MockFactoryMockRecorder) NetworkInterface(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) NetworkInterface() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInterface", reflect.TypeOf((*MockFactory)(nil).NetworkInterface), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInterface", reflect.TypeOf((*MockFactory)(nil).NetworkInterface)) } // NetworkSecurityGroup mocks base method. -func (m *MockFactory) NetworkSecurityGroup(arg0 context.Context, arg1 v1.SecretReference) (client.NetworkSecurityGroup, error) { +func (m *MockFactory) NetworkSecurityGroup() (client.NetworkSecurityGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NetworkSecurityGroup", arg0, arg1) + ret := m.ctrl.Call(m, "NetworkSecurityGroup") ret0, _ := ret[0].(client.NetworkSecurityGroup) ret1, _ := ret[1].(error) return ret0, ret1 } // NetworkSecurityGroup indicates an expected call of NetworkSecurityGroup. -func (mr *MockFactoryMockRecorder) NetworkSecurityGroup(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) NetworkSecurityGroup() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkSecurityGroup", reflect.TypeOf((*MockFactory)(nil).NetworkSecurityGroup), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkSecurityGroup", reflect.TypeOf((*MockFactory)(nil).NetworkSecurityGroup)) } // PublicIP mocks base method. -func (m *MockFactory) PublicIP(arg0 context.Context, arg1 v1.SecretReference) (client.PublicIP, error) { +func (m *MockFactory) PublicIP() (client.PublicIP, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PublicIP", arg0, arg1) + ret := m.ctrl.Call(m, "PublicIP") ret0, _ := ret[0].(client.PublicIP) ret1, _ := ret[1].(error) return ret0, ret1 } // PublicIP indicates an expected call of PublicIP. -func (mr *MockFactoryMockRecorder) PublicIP(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) PublicIP() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublicIP", reflect.TypeOf((*MockFactory)(nil).PublicIP), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublicIP", reflect.TypeOf((*MockFactory)(nil).PublicIP)) +} + +// RouteTables mocks base method. +func (m *MockFactory) RouteTables() (client.RouteTables, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RouteTables") + ret0, _ := ret[0].(client.RouteTables) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RouteTables indicates an expected call of RouteTables. +func (mr *MockFactoryMockRecorder) RouteTables() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RouteTables", reflect.TypeOf((*MockFactory)(nil).RouteTables)) } // Storage mocks base method. @@ -381,61 +392,628 @@ func (mr *MockFactoryMockRecorder) Storage(arg0, arg1 interface{}) *gomock.Call } // StorageAccount mocks base method. -func (m *MockFactory) StorageAccount(arg0 context.Context, arg1 v1.SecretReference) (client.StorageAccount, error) { +func (m *MockFactory) StorageAccount() (client.StorageAccount, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StorageAccount", arg0, arg1) + ret := m.ctrl.Call(m, "StorageAccount") ret0, _ := ret[0].(client.StorageAccount) ret1, _ := ret[1].(error) return ret0, ret1 } // StorageAccount indicates an expected call of StorageAccount. -func (mr *MockFactoryMockRecorder) StorageAccount(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) StorageAccount() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageAccount", reflect.TypeOf((*MockFactory)(nil).StorageAccount), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageAccount", reflect.TypeOf((*MockFactory)(nil).StorageAccount)) } // Subnet mocks base method. -func (m *MockFactory) Subnet(arg0 context.Context, arg1 v1.SecretReference) (client.Subnet, error) { +func (m *MockFactory) Subnet() (client.Subnet, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Subnet", arg0, arg1) + ret := m.ctrl.Call(m, "Subnet") ret0, _ := ret[0].(client.Subnet) ret1, _ := ret[1].(error) return ret0, ret1 } // Subnet indicates an expected call of Subnet. -func (mr *MockFactoryMockRecorder) Subnet(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) Subnet() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subnet", reflect.TypeOf((*MockFactory)(nil).Subnet), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subnet", reflect.TypeOf((*MockFactory)(nil).Subnet)) } // VirtualMachine mocks base method. -func (m *MockFactory) VirtualMachine(arg0 context.Context, arg1 v1.SecretReference) (client.VirtualMachine, error) { +func (m *MockFactory) VirtualMachine() (client.VirtualMachine, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VirtualMachine", arg0, arg1) + ret := m.ctrl.Call(m, "VirtualMachine") ret0, _ := ret[0].(client.VirtualMachine) ret1, _ := ret[1].(error) return ret0, ret1 } // VirtualMachine indicates an expected call of VirtualMachine. -func (mr *MockFactoryMockRecorder) VirtualMachine(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) VirtualMachine() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VirtualMachine", reflect.TypeOf((*MockFactory)(nil).VirtualMachine), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VirtualMachine", reflect.TypeOf((*MockFactory)(nil).VirtualMachine)) } // Vmss mocks base method. -func (m *MockFactory) Vmss(arg0 context.Context, arg1 v1.SecretReference) (client.Vmss, error) { +func (m *MockFactory) Vmss() (client.Vmss, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Vmss", arg0, arg1) + ret := m.ctrl.Call(m, "Vmss") ret0, _ := ret[0].(client.Vmss) ret1, _ := ret[1].(error) return ret0, ret1 } // Vmss indicates an expected call of Vmss. -func (mr *MockFactoryMockRecorder) Vmss(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockFactoryMockRecorder) Vmss() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vmss", reflect.TypeOf((*MockFactory)(nil).Vmss)) +} + +// Vnet mocks base method. +func (m *MockFactory) Vnet() (client.Vnet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Vnet") + ret0, _ := ret[0].(client.Vnet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Vnet indicates an expected call of Vnet. +func (mr *MockFactoryMockRecorder) Vnet() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vnet", reflect.TypeOf((*MockFactory)(nil).Vnet)) +} + +// MockResourceGroup is a mock of ResourceGroup interface. +type MockResourceGroup struct { + ctrl *gomock.Controller + recorder *MockResourceGroupMockRecorder +} + +// MockResourceGroupMockRecorder is the mock recorder for MockResourceGroup. +type MockResourceGroupMockRecorder struct { + mock *MockResourceGroup +} + +// NewMockResourceGroup creates a new mock instance. +func NewMockResourceGroup(ctrl *gomock.Controller) *MockResourceGroup { + mock := &MockResourceGroup{ctrl: ctrl} + mock.recorder = &MockResourceGroupMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockResourceGroup) EXPECT() *MockResourceGroupMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockResourceGroup) CreateOrUpdate(arg0 context.Context, arg1, arg2 string) (*armresources.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2) + ret0, _ := ret[0].(*armresources.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockResourceGroupMockRecorder) CreateOrUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockResourceGroup)(nil).CreateOrUpdate), arg0, arg1, arg2) +} + +// Delete mocks base method. +func (m *MockResourceGroup) Delete(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockResourceGroupMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockResourceGroup)(nil).Delete), arg0, arg1) +} + +// Get mocks base method. +func (m *MockResourceGroup) Get(arg0 context.Context, arg1 string) (*armresources.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1) + ret0, _ := ret[0].(*armresources.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockResourceGroupMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockResourceGroup)(nil).Get), arg0, arg1) +} + +// IsExisting mocks base method. +func (m *MockResourceGroup) IsExisting(arg0 context.Context, arg1 string) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsExisting", arg0, arg1) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// IsExisting indicates an expected call of IsExisting. +func (mr *MockResourceGroupMockRecorder) IsExisting(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsExisting", reflect.TypeOf((*MockResourceGroup)(nil).IsExisting), arg0, arg1) +} + +// MockVnet is a mock of Vnet interface. +type MockVnet struct { + ctrl *gomock.Controller + recorder *MockVnetMockRecorder +} + +// MockVnetMockRecorder is the mock recorder for MockVnet. +type MockVnetMockRecorder struct { + mock *MockVnet +} + +// NewMockVnet creates a new mock instance. +func NewMockVnet(ctrl *gomock.Controller) *MockVnet { + mock := &MockVnet{ctrl: ctrl} + mock.recorder = &MockVnetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockVnet) EXPECT() *MockVnetMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockVnet) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.VirtualNetwork) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockVnetMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockVnet)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockVnet) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockVnetMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockVnet)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockVnet) Get(arg0 context.Context, arg1, arg2 string) (*armnetwork.VirtualNetwork, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armnetwork.VirtualNetwork) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockVnetMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockVnet)(nil).Get), arg0, arg1, arg2) +} + +// MockRouteTables is a mock of RouteTables interface. +type MockRouteTables struct { + ctrl *gomock.Controller + recorder *MockRouteTablesMockRecorder +} + +// MockRouteTablesMockRecorder is the mock recorder for MockRouteTables. +type MockRouteTablesMockRecorder struct { + mock *MockRouteTables +} + +// NewMockRouteTables creates a new mock instance. +func NewMockRouteTables(ctrl *gomock.Controller) *MockRouteTables { + mock := &MockRouteTables{ctrl: ctrl} + mock.recorder = &MockRouteTablesMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRouteTables) EXPECT() *MockRouteTablesMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockRouteTables) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockRouteTablesMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockRouteTables)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockRouteTables) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockRouteTablesMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRouteTables)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockRouteTables) Get(arg0 context.Context, arg1, arg2 string) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockRouteTablesMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRouteTables)(nil).Get), arg0, arg1, arg2) +} + +// MockNatGateway is a mock of NatGateway interface. +type MockNatGateway struct { + ctrl *gomock.Controller + recorder *MockNatGatewayMockRecorder +} + +// MockNatGatewayMockRecorder is the mock recorder for MockNatGateway. +type MockNatGatewayMockRecorder struct { + mock *MockNatGateway +} + +// NewMockNatGateway creates a new mock instance. +func NewMockNatGateway(ctrl *gomock.Controller) *MockNatGateway { + mock := &MockNatGateway{ctrl: ctrl} + mock.recorder = &MockNatGatewayMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockNatGateway) EXPECT() *MockNatGatewayMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockNatGateway) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armnetwork.NatGateway) (*armnetwork.NatGateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.NatGateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockNatGatewayMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockNatGateway)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockNatGateway) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockNatGatewayMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockNatGateway)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockNatGateway) Get(arg0 context.Context, arg1, arg2 string) (*armnetwork.NatGateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armnetwork.NatGateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockNatGatewayMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockNatGateway)(nil).Get), arg0, arg1, arg2) +} + +// List mocks base method. +func (m *MockNatGateway) List(arg0 context.Context, arg1 string) ([]*armnetwork.NatGateway, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", arg0, arg1) + ret0, _ := ret[0].([]*armnetwork.NatGateway) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockNatGatewayMockRecorder) List(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockNatGateway)(nil).List), arg0, arg1) +} + +// MockPublicIP is a mock of PublicIP interface. +type MockPublicIP struct { + ctrl *gomock.Controller + recorder *MockPublicIPMockRecorder +} + +// MockPublicIPMockRecorder is the mock recorder for MockPublicIP. +type MockPublicIPMockRecorder struct { + mock *MockPublicIP +} + +// NewMockPublicIP creates a new mock instance. +func NewMockPublicIP(ctrl *gomock.Controller) *MockPublicIP { + mock := &MockPublicIP{ctrl: ctrl} + mock.recorder = &MockPublicIPMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPublicIP) EXPECT() *MockPublicIPMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockPublicIP) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockPublicIPMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockPublicIP)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockPublicIP) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockPublicIPMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockPublicIP)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockPublicIP) Get(arg0 context.Context, arg1, arg2 string) (*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockPublicIPMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockPublicIP)(nil).Get), arg0, arg1, arg2) +} + +// List mocks base method. +func (m *MockPublicIP) List(arg0 context.Context, arg1 string) ([]*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", arg0, arg1) + ret0, _ := ret[0].([]*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockPublicIPMockRecorder) List(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockPublicIP)(nil).List), arg0, arg1) +} + +// MockAvailabilitySet is a mock of AvailabilitySet interface. +type MockAvailabilitySet struct { + ctrl *gomock.Controller + recorder *MockAvailabilitySetMockRecorder +} + +// MockAvailabilitySetMockRecorder is the mock recorder for MockAvailabilitySet. +type MockAvailabilitySetMockRecorder struct { + mock *MockAvailabilitySet +} + +// NewMockAvailabilitySet creates a new mock instance. +func NewMockAvailabilitySet(ctrl *gomock.Controller) *MockAvailabilitySet { + mock := &MockAvailabilitySet{ctrl: ctrl} + mock.recorder = &MockAvailabilitySetMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAvailabilitySet) EXPECT() *MockAvailabilitySetMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockAvailabilitySet) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armcompute.AvailabilitySet) (*armcompute.AvailabilitySet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armcompute.AvailabilitySet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockAvailabilitySetMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockAvailabilitySet)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockAvailabilitySet) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockAvailabilitySetMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockAvailabilitySet)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockAvailabilitySet) Get(arg0 context.Context, arg1, arg2 string) (*armcompute.AvailabilitySet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armcompute.AvailabilitySet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockAvailabilitySetMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockAvailabilitySet)(nil).Get), arg0, arg1, arg2) +} + +// MockNetworkSecurityGroup is a mock of NetworkSecurityGroup interface. +type MockNetworkSecurityGroup struct { + ctrl *gomock.Controller + recorder *MockNetworkSecurityGroupMockRecorder +} + +// MockNetworkSecurityGroupMockRecorder is the mock recorder for MockNetworkSecurityGroup. +type MockNetworkSecurityGroupMockRecorder struct { + mock *MockNetworkSecurityGroup +} + +// NewMockNetworkSecurityGroup creates a new mock instance. +func NewMockNetworkSecurityGroup(ctrl *gomock.Controller) *MockNetworkSecurityGroup { + mock := &MockNetworkSecurityGroup{ctrl: ctrl} + mock.recorder = &MockNetworkSecurityGroupMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockNetworkSecurityGroup) EXPECT() *MockNetworkSecurityGroupMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockNetworkSecurityGroup) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armnetwork.SecurityGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockNetworkSecurityGroupMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockNetworkSecurityGroup)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) +} + +// Delete mocks base method. +func (m *MockNetworkSecurityGroup) Delete(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockNetworkSecurityGroupMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockNetworkSecurityGroup)(nil).Delete), arg0, arg1, arg2) +} + +// Get mocks base method. +func (m *MockNetworkSecurityGroup) Get(arg0 context.Context, arg1, arg2 string) (*armnetwork.SecurityGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*armnetwork.SecurityGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockNetworkSecurityGroupMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockNetworkSecurityGroup)(nil).Get), arg0, arg1, arg2) +} + +// MockManagedUserIdentity is a mock of ManagedUserIdentity interface. +type MockManagedUserIdentity struct { + ctrl *gomock.Controller + recorder *MockManagedUserIdentityMockRecorder +} + +// MockManagedUserIdentityMockRecorder is the mock recorder for MockManagedUserIdentity. +type MockManagedUserIdentityMockRecorder struct { + mock *MockManagedUserIdentity +} + +// NewMockManagedUserIdentity creates a new mock instance. +func NewMockManagedUserIdentity(ctrl *gomock.Controller) *MockManagedUserIdentity { + mock := &MockManagedUserIdentity{ctrl: ctrl} + mock.recorder = &MockManagedUserIdentityMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManagedUserIdentity) EXPECT() *MockManagedUserIdentityMockRecorder { + return m.recorder +} + +// Get mocks base method. +func (m *MockManagedUserIdentity) Get(arg0 context.Context, arg1, arg2 string) (*msi.Identity, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2) + ret0, _ := ret[0].(*msi.Identity) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockManagedUserIdentityMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vmss", reflect.TypeOf((*MockFactory)(nil).Vmss), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockManagedUserIdentity)(nil).Get), arg0, arg1, arg2) } diff --git a/pkg/azure/client/natgateway.go b/pkg/azure/client/natgateway.go new file mode 100644 index 000000000..98ed156af --- /dev/null +++ b/pkg/azure/client/natgateway.go @@ -0,0 +1,77 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewNatGatewaysClient creates a new NatGateway client. +func NewNatGatewaysClient(auth internal.ClientAuth) (*NatGatewayClient, error) { + cred, err := auth.GetAzClientCredentials() + if err != nil { + return nil, err + } + client, err := armnetwork.NewNatGatewaysClient(auth.SubscriptionID, cred, nil) + return &NatGatewayClient{client}, err +} + +// CreateOrUpdate creates or updates a NatGateway. +func (c NatGatewayClient) CreateOrUpdate(ctx context.Context, resourceGroupName, natGatewayName string, parameters armnetwork.NatGateway) (*armnetwork.NatGateway, error) { + + poller, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, natGatewayName, parameters, nil) + if err != nil { + return nil, err + } + resp, err := poller.PollUntilDone(ctx, nil) + return &resp.NatGateway, err +} + +// Get returns a NatGateway by name or nil if it doesn't exis. +func (c NatGatewayClient) Get(ctx context.Context, resourceGroupName, natGatewayName string) (*armnetwork.NatGateway, error) { + res, err := c.client.Get(ctx, resourceGroupName, natGatewayName, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res.NatGateway, nil +} + +// List returns all NATGateways in the given resource group. +func (c NatGatewayClient) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.NatGateway, error) { + pager := c.client.NewListPager(resourceGroupName, nil) + var nats []*armnetwork.NatGateway + for pager.More() { + res, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + nats = append(nats, res.NatGatewayListResult.Value...) + } + return nats, nil +} + +// Delete deletes the NatGateway with the given name. +func (c NatGatewayClient) Delete(ctx context.Context, resourceGroupName, natGatewayName string) error { + poller, err := c.client.BeginDelete(ctx, resourceGroupName, natGatewayName, nil) + if err != nil { + return FilterNotFoundError(err) + } + _, err = poller.PollUntilDone(ctx, nil) + return err +} diff --git a/pkg/azure/client/networkinterface.go b/pkg/azure/client/networkinterface.go index fa2d54db7..2fe2351ae 100644 --- a/pkg/azure/client/networkinterface.go +++ b/pkg/azure/client/networkinterface.go @@ -16,52 +16,50 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// CreateOrUpdate indicates an expected call of Network interface CreateOrUpdate. -func (c NetworkInterfaceClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.Interface) (*network.Interface, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, name, parameters) +// NewNetworkInterfaceClient creates a new NetworkInterfaceClient +func NewNetworkInterfaceClient(auth internal.ClientAuth) (*NetworkInterfaceClient, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { + client, err := armnetwork.NewInterfacesClient(auth.SubscriptionID, cred, nil) + return &NetworkInterfaceClient{client}, err +} + +// CreateOrUpdate indicates an expected call of Network interface CreateOrUpdate. +func (c NetworkInterfaceClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.Interface) (*armnetwork.Interface, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, parameters, nil) + if err != nil { return nil, err } - nic, err := future.Result(c.client) + res, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &nic, nil + return &res.Interface, nil } // Get will get a Network interface. -func (c NetworkInterfaceClient) Get(ctx context.Context, resourceGroupName string, name string, expander string) (*network.Interface, error) { - nic, err := c.client.Get(ctx, resourceGroupName, name, expander) +func (c NetworkInterfaceClient) Get(ctx context.Context, resourceGroupName string, name string) (*armnetwork.Interface, error) { + nic, err := c.client.Get(ctx, resourceGroupName, name, nil) if err != nil { - return nil, err + return nil, FilterNotFoundError(err) } - return &nic, nil + return &nic.Interface, nil } // Delete will delete a Network interface. func (c NetworkInterfaceClient) Delete(ctx context.Context, resourceGroupName, name string) error { - future, err := c.client.Delete(ctx, resourceGroupName, name) + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, nil) if err != nil { - return err - } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - result, err := future.Result(c.client) - if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent || result.StatusCode == http.StatusNotFound { - return nil + return FilterNotFoundError(err) } - return fmt.Errorf("deletion of network interfaces %s failed. statuscode=%d", name, result.StatusCode) + _, err = future.PollUntilDone(ctx, nil) + return err } diff --git a/pkg/azure/client/networksecuritygroup.go b/pkg/azure/client/networksecuritygroup.go index de8870162..6f87b67c4 100644 --- a/pkg/azure/client/networksecuritygroup.go +++ b/pkg/azure/client/networksecuritygroup.go @@ -17,39 +17,51 @@ package client import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// CreateOrUpdate indicates an expected call of Network Security Group CreateOrUpdate. -func (c NetworkSecurityGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.SecurityGroup) (*network.SecurityGroup, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, name, parameters) +// NewSecurityGroupClient creates a new SecurityGroupClient +func NewSecurityGroupClient(auth internal.ClientAuth) (*NetworkSecurityGroupClient, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { + client, err := armnetwork.NewSecurityGroupsClient(auth.SubscriptionID, cred, nil) + return &NetworkSecurityGroupClient{client}, err +} + +// CreateOrUpdate indicates an expected call of Network Security Group CreateOrUpdate. +func (c NetworkSecurityGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, parameters, nil) + if err != nil { return nil, err } - nsg, err := future.Result(c.client) + nsg, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &nsg, nil + return &nsg.SecurityGroup, nil } -// Get will fetch a network security group -func (c NetworkSecurityGroupClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName, name string) (*network.SecurityGroup, error) { - nsg, err := c.client.Get(ctx, resourceGroupName, networkSecurityGroupName, name) +// Get will fetch a network security group. +func (c NetworkSecurityGroupClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*armnetwork.SecurityGroup, error) { + nsg, err := c.client.Get(ctx, resourceGroupName, networkSecurityGroupName, nil) if err != nil { - return nil, err + return nil, FilterNotFoundError(err) } - return &nsg, nil + return &nsg.SecurityGroup, nil } -// Get will get a Security rules. -func (c SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, name string) (*network.SecurityRule, error) { - rules, err := c.client.Get(ctx, resourceGroupName, networkSecurityGroupName, name) +// Delete deletes a network security group. +func (c NetworkSecurityGroupClient) Delete(ctx context.Context, resourceGroupName, name string) error { + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, nil) if err != nil { - return nil, err + return FilterNotFoundError(err) + } + if _, err := future.PollUntilDone(ctx, nil); err != nil { + return err } - return &rules, nil + return err } diff --git a/pkg/azure/client/publicip.go b/pkg/azure/client/publicip.go index bea67733e..d67133934 100644 --- a/pkg/azure/client/publicip.go +++ b/pkg/azure/client/publicip.go @@ -16,52 +16,64 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// CreateOrUpdate indicates an expected call of Network Public IP CreateOrUpdate. -func (c PublicIPClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.PublicIPAddress) (*network.PublicIPAddress, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, name, parameters) +// NewPublicIPClient creates a new PublicIPClient +func NewPublicIPClient(auth internal.ClientAuth) (*PublicIPClient, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { + client, err := armnetwork.NewPublicIPAddressesClient(auth.SubscriptionID, cred, nil) + return &PublicIPClient{client}, err +} + +// CreateOrUpdate indicates an expected call of Network Public IP CreateOrUpdate. +func (c PublicIPClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, parameters, nil) + if err != nil { return nil, err } - npi, err := future.Result(c.client) + res, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &npi, nil + return &res.PublicIPAddress, nil } // Get will get a network public IP Address -func (c PublicIPClient) Get(ctx context.Context, resourceGroupName string, name string, expander string) (*network.PublicIPAddress, error) { - npi, err := c.client.Get(ctx, resourceGroupName, name, expander) +func (c PublicIPClient) Get(ctx context.Context, resourceGroupName string, name string) (*armnetwork.PublicIPAddress, error) { + npi, err := c.client.Get(ctx, resourceGroupName, name, nil) if err != nil { - return nil, err + return nil, FilterNotFoundError(err) } - return &npi, nil + return &npi.PublicIPAddress, nil +} + +// List will get all network public IP Addresses +func (c PublicIPClient) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.PublicIPAddress, error) { + pager := c.client.NewListPager(resourceGroupName, nil) + var ips []*armnetwork.PublicIPAddress + for pager.More() { + res, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + ips = append(ips, res.PublicIPAddressListResult.Value...) + } + return ips, nil } // Delete will delete a network Public IP Address. func (c PublicIPClient) Delete(ctx context.Context, resourceGroupName, name string) error { - future, err := c.client.Delete(ctx, resourceGroupName, name) + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, nil) if err != nil { - return err - } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - result, err := future.Result(c.client) - if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent || result.StatusCode == http.StatusNotFound { - return nil + return FilterNotFoundError(err) } - return fmt.Errorf("deletion of network Public IP Address %s failed. statuscode=%d", name, result.StatusCode) + _, err = future.PollUntilDone(ctx, nil) + return err } diff --git a/pkg/azure/client/resourcegroup.go b/pkg/azure/client/resourcegroup.go new file mode 100644 index 000000000..6a9980e2e --- /dev/null +++ b/pkg/azure/client/resourcegroup.go @@ -0,0 +1,77 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewResourceGroupsClient creates a new ResourceGroupClient +func NewResourceGroupsClient(auth internal.ClientAuth) (*ResourceGroupClient, error) { + cred, err := auth.GetAzClientCredentials() + if err != nil { + return nil, err + } + client, err := armresources.NewResourceGroupsClient(auth.SubscriptionID, cred, nil) + return &ResourceGroupClient{client}, err +} + +// Get gets a resource group +func (c ResourceGroupClient) Get(ctx context.Context, resourceGroupName string) (*armresources.ResourceGroup, error) { + res, err := c.client.Get(ctx, resourceGroupName, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res.ResourceGroup, err +} + +// CreateOrUpdate creates or updates a resource group +func (c ResourceGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName, location string) (*armresources.ResourceGroup, error) { + res, err := c.client.CreateOrUpdate( + ctx, + resourceGroupName, + armresources.ResourceGroup{ + Location: to.Ptr(location), + }, + nil) + return &res.ResourceGroup, err +} + +// Delete deletes a resource group if it exists. +func (c ResourceGroupClient) Delete(ctx context.Context, resourceGroupName string) error { + resourceGroupResp, err := c.client.BeginDelete( + ctx, + resourceGroupName, + nil) + if err != nil { + return FilterNotFoundError(err) + } + _, err = resourceGroupResp.PollUntilDone(ctx, nil) + return err +} + +// IsExisting checks if a resource group exists +func (c ResourceGroupClient) IsExisting(ctx context.Context, resourceGroupName string) (bool, error) { + res, err := c.client.CheckExistence(ctx, resourceGroupName, nil) + if err != nil { + return false, err + } + return res.Success, err +} diff --git a/pkg/azure/client/routetables.go b/pkg/azure/client/routetables.go new file mode 100644 index 000000000..1b04d643c --- /dev/null +++ b/pkg/azure/client/routetables.go @@ -0,0 +1,63 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewRouteTablesClient creates a new RouteTables client. +func NewRouteTablesClient(auth internal.ClientAuth) (*RouteTablesClient, error) { + cred, err := auth.GetAzClientCredentials() + if err != nil { + return nil, err + } + client, err := armnetwork.NewRouteTablesClient(auth.SubscriptionID, cred, nil) + return &RouteTablesClient{client}, err +} + +// CreateOrUpdate creates or updates a RouteTable. +func (c RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName, routeTableName string, parameters armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + poller, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, routeTableName, parameters, nil) + if err != nil { + return nil, fmt.Errorf("cannot create route table: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + return &res.RouteTable, err +} + +// Delete deletes the RouteTable with the given name. +func (c RouteTablesClient) Delete(ctx context.Context, resourceGroupName, name string) (err error) { + poller, err := c.client.BeginDelete(ctx, resourceGroupName, name, nil) + if err != nil { + return FilterNotFoundError(err) + } + _, err = poller.PollUntilDone(ctx, nil) + return err +} + +// Get returns a RouteTable by name. +func (c RouteTablesClient) Get(ctx context.Context, resourceGroupName, name string) (*armnetwork.RouteTable, error) { + res, err := c.client.Get(ctx, resourceGroupName, name, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res.RouteTable, err +} diff --git a/pkg/azure/client/subnet.go b/pkg/azure/client/subnet.go index b21ca1e3e..7ea6dcfb6 100644 --- a/pkg/azure/client/subnet.go +++ b/pkg/azure/client/subnet.go @@ -16,60 +16,62 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// Get will get a subnet in a given virtual network. If the requested subnet not exists nil will be returned. -func (c SubnetsClient) Get(ctx context.Context, resourceGroupName string, vnetName string, name string, expander string) (*network.Subnet, error) { - subnet, err := c.client.Get(ctx, resourceGroupName, vnetName, name, expander) +// NewSubnetsClient creates a new subnets client. +func NewSubnetsClient(auth internal.ClientAuth) (*SubnetsClient, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { - if IsAzureAPINotFoundError(err) { - return nil, nil - } return nil, err } - return &subnet, nil + client, err := armnetwork.NewSubnetsClient(auth.SubscriptionID, cred, nil) + return &SubnetsClient{client}, err } -// List lists all subnets of a given virtual network. -func (c SubnetsClient) List(ctx context.Context, resourceGroupName, vnetName string) ([]network.Subnet, error) { - subnetPages, err := c.client.List(ctx, resourceGroupName, vnetName) +// CreateOrUpdate creates or updates a subnet in a given virtual network. +func (c SubnetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName, vnetName, subnetName string, parameters armnetwork.Subnet) (*armnetwork.Subnet, error) { + poller, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, vnetName, subnetName, parameters, nil) if err != nil { return nil, err } + res, err := poller.PollUntilDone(ctx, nil) + return &res.Subnet, err +} + +// Get will get a subnet in a given virtual network. If the requested subnet not exists nil will be returned. +func (c SubnetsClient) Get(ctx context.Context, resourceGroupName string, vnetName string, name string) (*armnetwork.Subnet, error) { + subnet, err := c.client.Get(ctx, resourceGroupName, vnetName, name, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &subnet.Subnet, nil +} - subnetList := []network.Subnet{} - for subnetPages.NotDone() { - subnetList = append(subnetList, subnetPages.Values()...) - if err := subnetPages.NextWithContext(ctx); err != nil { +// List lists all subnets of a given virtual network. +func (c SubnetsClient) List(ctx context.Context, resourceGroupName, vnetName string) ([]*armnetwork.Subnet, error) { + pager := c.client.NewListPager(resourceGroupName, vnetName, nil) + subnetList := []*armnetwork.Subnet{} + for pager.More() { + page, err := pager.NextPage(ctx) + subnetList = append(subnetList, page.Value...) + if err != nil { return nil, err } } - return subnetList, nil } // Delete deletes a subnet in a given virtual network. func (c SubnetsClient) Delete(ctx context.Context, resourceGroupName, vnetName, subnetName string) error { - future, err := c.client.Delete(ctx, resourceGroupName, vnetName, subnetName) + poller, err := c.client.BeginDelete(ctx, resourceGroupName, vnetName, subnetName, nil) if err != nil { - return err - } - - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - - result, err := future.Result(c.client) - if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent || result.StatusCode == http.StatusNotFound { - return nil + return FilterNotFoundError(err) } - return fmt.Errorf("deletion of subnet %s in virtual network %s/%s failed. statuscode=%d", subnetName, resourceGroupName, vnetName, result.StatusCode) + _, err = poller.PollUntilDone(ctx, nil) + return err } diff --git a/pkg/azure/client/types.go b/pkg/azure/client/types.go index fa1f7a74e..a368ca61c 100644 --- a/pkg/azure/client/types.go +++ b/pkg/azure/client/types.go @@ -17,37 +17,65 @@ package client import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" + "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage" "github.com/Azure/azure-storage-blob-go/azblob" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) // Factory represents a factory to produce clients for various Azure services. type Factory interface { - Group(context.Context, corev1.SecretReference) (Group, error) Storage(context.Context, corev1.SecretReference) (Storage, error) - StorageAccount(context.Context, corev1.SecretReference) (StorageAccount, error) - Vmss(context.Context, corev1.SecretReference) (Vmss, error) - DNSZone(context.Context, corev1.SecretReference) (DNSZone, error) - DNSRecordSet(context.Context, corev1.SecretReference) (DNSRecordSet, error) - VirtualMachine(ctx context.Context, secretRef corev1.SecretReference) (VirtualMachine, error) - NetworkSecurityGroup(ctx context.Context, secretRef corev1.SecretReference) (NetworkSecurityGroup, error) - PublicIP(ctx context.Context, secretRef corev1.SecretReference) (PublicIP, error) - NetworkInterface(ctx context.Context, secretRef corev1.SecretReference) (NetworkInterface, error) - Disk(ctx context.Context, secretRef corev1.SecretReference) (Disk, error) - Subnet(ctx context.Context, secretRef corev1.SecretReference) (Subnet, error) + StorageAccount() (StorageAccount, error) + Vmss() (Vmss, error) + DNSZone() (DNSZone, error) + DNSRecordSet() (DNSRecordSet, error) + VirtualMachine() (VirtualMachine, error) + NetworkInterface() (NetworkInterface, error) + Disk() (Disk, error) + Group() (ResourceGroup, error) + NetworkSecurityGroup() (NetworkSecurityGroup, error) + Subnet() (Subnet, error) + PublicIP() (PublicIP, error) + Vnet() (Vnet, error) + RouteTables() (RouteTables, error) + NatGateway() (NatGateway, error) + AvailabilitySet() (AvailabilitySet, error) + ManagedUserIdentity() (ManagedUserIdentity, error) +} + +// AvailabilitySet is an interface for the Azure AvailabilitySet service. +type AvailabilitySet interface { + Get(ctx context.Context, resourceGroupName, availabilitySetName string) (result *armcompute.AvailabilitySet, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters armcompute.AvailabilitySet) (result *armcompute.AvailabilitySet, err error) + Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (err error) +} + +// NatGateway is an interface for the Azure NatGateway service. +type NatGateway interface { + CreateOrUpdate(ctx context.Context, resourceGroupName, natGatewayName string, parameters armnetwork.NatGateway) (*armnetwork.NatGateway, error) + Get(ctx context.Context, resourceGroupName, natGatewayName string) (*armnetwork.NatGateway, error) + Delete(ctx context.Context, resourceGroupName, natGatewayName string) error + List(ctx context.Context, resourceGroupName string) ([]*armnetwork.NatGateway, error) +} + +// RouteTables is a client for the Azure RouteTable service. +type RouteTables interface { + CreateOrUpdate(ctx context.Context, resourceGroupName, routeTableName string, parameters armnetwork.RouteTable) (*armnetwork.RouteTable, error) + Delete(ctx context.Context, resourceGroupName, name string) (err error) + Get(ctx context.Context, resourceGroupName, name string) (*armnetwork.RouteTable, error) } -// Group represents an Azure group client. -type Group interface { - Get(context.Context, string) (*resources.Group, error) - CreateOrUpdate(context.Context, string, string) error - DeleteIfExits(context.Context, string) error +// ManagedUserIdentity is a client for the Azure Managed User Identity service. +type ManagedUserIdentity interface { + Get(context.Context, string, string) (*msi.Identity, error) } // Storage represents an Azure (blob) storage client. @@ -65,22 +93,22 @@ type StorageAccount interface { // Vmss represents an Azure virtual machine scale set client. type Vmss interface { - List(context.Context, string) ([]compute.VirtualMachineScaleSet, error) - Get(context.Context, string, string, compute.ExpandTypesForGetVMScaleSets) (*compute.VirtualMachineScaleSet, error) - Create(context.Context, string, string, *compute.VirtualMachineScaleSet) (*compute.VirtualMachineScaleSet, error) + List(context.Context, string) ([]*armcompute.VirtualMachineScaleSet, error) + Get(context.Context, string, string, *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error) + CreateOrUpdate(context.Context, string, string, armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error) Delete(context.Context, string, string, *bool) error } // VirtualMachine represents an Azure virtual machine client. type VirtualMachine interface { - Get(ctx context.Context, resourceGroupName string, name string, instanceViewTypes compute.InstanceViewTypes) (*compute.VirtualMachine, error) - Create(ctx context.Context, resourceGroupName string, name string, parameters *compute.VirtualMachine) (*compute.VirtualMachine, error) + Get(ctx context.Context, resourceGroupName string, name string, expander *armcompute.InstanceViewTypes) (*armcompute.VirtualMachine, error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters armcompute.VirtualMachine) (*armcompute.VirtualMachine, error) Delete(ctx context.Context, resourceGroupName string, name string, forceDeletion *bool) error } // DNSZone represents an Azure DNS zone client. type DNSZone interface { - GetAll(context.Context) (map[string]string, error) + List(context.Context) (map[string]string, error) } // DNSRecordSet represents an Azure DNS recordset client. @@ -91,41 +119,60 @@ type DNSRecordSet interface { // NetworkSecurityGroup represents an Azure Network security group client. type NetworkSecurityGroup interface { - Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName, name string) (*network.SecurityGroup, error) - CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.SecurityGroup) (*network.SecurityGroup, error) + Get(ctx context.Context, resourceGroupName, networkSecurityGroupName string) (*armnetwork.SecurityGroup, error) + CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error) + Delete(ctx context.Context, resourceGroupName, name string) error } -// PublicIP represents an Azure Network PUblic IP client. +// PublicIP represents an Azure Network Public IP client. type PublicIP interface { - Get(ctx context.Context, resourceGroupName string, name string, expander string) (*network.PublicIPAddress, error) - CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.PublicIPAddress) (*network.PublicIPAddress, error) + Get(ctx context.Context, resourceGroupName string, name string) (*armnetwork.PublicIPAddress, error) + CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) Delete(ctx context.Context, resourceGroupName, name string) error + List(ctx context.Context, resourceGroupName string) ([]*armnetwork.PublicIPAddress, error) } // NetworkInterface represents an Azure Network Interface client. type NetworkInterface interface { - Get(ctx context.Context, resourceGroupName string, name string, expander string) (*network.Interface, error) - CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters network.Interface) (*network.Interface, error) + Get(ctx context.Context, resourceGroupName string, name string) (*armnetwork.Interface, error) + CreateOrUpdate(ctx context.Context, resourceGroupName, name string, parameters armnetwork.Interface) (*armnetwork.Interface, error) Delete(ctx context.Context, resourceGroupName, name string) error } // Disk represents an Azure Disk client. type Disk interface { - Get(ctx context.Context, resourceGroupName string, name string) (*compute.Disk, error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk compute.Disk) (*compute.Disk, error) + Get(ctx context.Context, resourceGroupName string, name string) (*armcompute.Disk, error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk armcompute.Disk) (*armcompute.Disk, error) Delete(ctx context.Context, resourceGroupName, name string) error } // Subnet represents an Azure Subnet client. type Subnet interface { - Get(ctx context.Context, resourceGroupName string, vnetName string, name string, expander string) (*network.Subnet, error) - List(context.Context, string, string) ([]network.Subnet, error) + CreateOrUpdate(ctx context.Context, resourceGroupName, vnetName, subnetName string, parameters armnetwork.Subnet) (*armnetwork.Subnet, error) + Get(ctx context.Context, resourceGroupName string, vnetName string, name string) (*armnetwork.Subnet, error) + List(context.Context, string, string) ([]*armnetwork.Subnet, error) Delete(context.Context, string, string, string) error } -// AzureFactory is an implementation of Factory to produce clients for various Azure services. -type AzureFactory struct { - client client.Client +// ResourceGroup represents an Azure ResourceGroup client. +type ResourceGroup interface { + CreateOrUpdate(ctx context.Context, resourceGroupName, location string) (*armresources.ResourceGroup, error) + Delete(ctx context.Context, resourceGroupName string) error + IsExisting(ctx context.Context, resourceGroupName string) (bool, error) + Get(ctx context.Context, resourceGroupName string) (*armresources.ResourceGroup, error) +} + +// Vnet represents an Azure Virtual Network client. +type Vnet interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error) + Delete(ctx context.Context, resourceGroupName, name string) error + Get(ctx context.Context, resourceGroupName, name string) (*armnetwork.VirtualNetwork, error) +} + +// azureFactory is an implementation of Factory to produce clients for various Azure services. +type azureFactory struct { + auth *internal.ClientAuth + client client.Client // TODO remove? only used for storage client secrets } // StorageClient is an implementation of Storage for a (blob) storage client. @@ -138,19 +185,24 @@ type StorageAccountClient struct { client storage.AccountsClient } -// GroupClient is an implementation of Group for a resource group client. -type GroupClient struct { - client resources.GroupsClient -} - // VmssClient is an implementation of Vmss for a virtual machine scale set client. type VmssClient struct { - client compute.VirtualMachineScaleSetsClient + client *armcompute.VirtualMachineScaleSetsClient +} + +// ResourceGroupClient is a newer client implementation of ResourceGroup. +type ResourceGroupClient struct { + client *armresources.ResourceGroupsClient +} + +// VnetClient is an implmenetation of Vnet for a virtual network client. +type VnetClient struct { + client *armnetwork.VirtualNetworksClient } // VirtualMachinesClient is an implementation of Vm for a virtual machine client. type VirtualMachinesClient struct { - client compute.VirtualMachinesClient + client *armcompute.VirtualMachinesClient } // DNSZoneClient is an implementation of DNSZone for a DNS zone client. @@ -165,30 +217,45 @@ type DNSRecordSetClient struct { // NetworkSecurityGroupClient is an implementation of Network Security Group for a network security group client. type NetworkSecurityGroupClient struct { - client network.SecurityGroupsClient + client *armnetwork.SecurityGroupsClient } // PublicIPClient is an implementation of Network Public IP Address. type PublicIPClient struct { - client network.PublicIPAddressesClient + client *armnetwork.PublicIPAddressesClient } // NetworkInterfaceClient is an implementation of Network Interface. type NetworkInterfaceClient struct { - client network.InterfacesClient -} - -// SecurityRulesClient is an implementation of Network Security Groups rules. -type SecurityRulesClient struct { - client network.SecurityRulesClient + client *armnetwork.InterfacesClient } // DisksClient is an implementation of Disk for a disk client. type DisksClient struct { - client compute.DisksClient + client *armcompute.DisksClient } // SubnetsClient is an implementation of Subnet for a Subnet client. type SubnetsClient struct { - client network.SubnetsClient + client *armnetwork.SubnetsClient +} + +// RouteTablesClient is an implementation of RouteTables for a RouteTables client. +type RouteTablesClient struct { + client *armnetwork.RouteTablesClient +} + +// NatGatewayClient is an implementation of NatGateway for a Nat Gateway client. +type NatGatewayClient struct { + client *armnetwork.NatGatewaysClient +} + +// AvailabilitySetClient is an implementation of AvailabilitySet for an availability set client. +type AvailabilitySetClient struct { + client *armcompute.AvailabilitySetsClient +} + +// ManagedUserIdentityClient is an implementation of ManagedUserIdentity for a managed user identity client. +type ManagedUserIdentityClient struct { + client msi.UserAssignedIdentitiesClient } diff --git a/pkg/azure/client/useridentity.go b/pkg/azure/client/useridentity.go new file mode 100644 index 000000000..3a9f94ed6 --- /dev/null +++ b/pkg/azure/client/useridentity.go @@ -0,0 +1,55 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" + azureRest "github.com/Azure/go-autorest/autorest/azure" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewManagedUserIdentityClient creates a new ManagedUserIdentityClient +func NewManagedUserIdentityClient(auth internal.ClientAuth) (*ManagedUserIdentityClient, error) { + msiClient := msi.NewUserAssignedIdentitiesClient(auth.SubscriptionID) + authorizer, err := getAuthorizer(auth.TenantID, auth.ClientID, auth.ClientSecret) + msiClient.Authorizer = authorizer + return &ManagedUserIdentityClient{msiClient}, err +} + +// Get returns a Managed User Identity by name. +func (m ManagedUserIdentityClient) Get(ctx context.Context, resourceGroup, id string) (*msi.Identity, error) { + res, err := m.client.Get(ctx, resourceGroup, id) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res, nil +} + +func getAuthorizer(tenantId, clientId, clientSecret string) (autorest.Authorizer, error) { + oauthConfig, err := adal.NewOAuthConfig(azureRest.PublicCloud.ActiveDirectoryEndpoint, tenantId) + if err != nil { + return nil, err + } + spToken, err := adal.NewServicePrincipalToken(*oauthConfig, clientId, clientSecret, azureRest.PublicCloud.ResourceManagerEndpoint) + if err != nil { + return nil, err + } + return autorest.NewBearerAuthorizer(spToken), nil +} diff --git a/pkg/azure/client/vm.go b/pkg/azure/client/vm.go index 4f2ccb8c2..00a90d642 100644 --- a/pkg/azure/client/vm.go +++ b/pkg/azure/client/vm.go @@ -16,53 +16,54 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// Get will get virtual machines in a resource group. -func (c VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, name string, instanceViewTypes compute.InstanceViewTypes) (*compute.VirtualMachine, error) { - vm, err := c.client.Get(ctx, resourceGroupName, name, instanceViewTypes) +// NewVMClient creates a new VM client +func NewVMClient(auth internal.ClientAuth) (VirtualMachine, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } - return &vm, nil + client, err := armcompute.NewVirtualMachinesClient(auth.SubscriptionID, cred, nil) + return &VirtualMachinesClient{client}, err } -// Create will Create a virtual machine. -func (c VirtualMachinesClient) Create(ctx context.Context, resourceGroupName string, name string, parameters *compute.VirtualMachine) (*compute.VirtualMachine, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, name, *parameters) +// Get will get virtual machines in a resource group. +func (c VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, name string, expander *armcompute.InstanceViewTypes) (*armcompute.VirtualMachine, error) { + vm, err := c.client.Get(ctx, resourceGroupName, name, &armcompute.VirtualMachinesClientGetOptions{ + Expand: expander, + }) if err != nil { - return nil, err + return nil, FilterNotFoundError(err) } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { + return &vm.VirtualMachine, nil +} + +// Create will Create a virtual machine. +func (c VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters armcompute.VirtualMachine) (*armcompute.VirtualMachine, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, parameters, nil) + if err != nil { return nil, err } - - vm, err := future.Result(c.client) + res, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &vm, nil + return &res.VirtualMachine, nil } // Delete will delete a virtual machine. func (c VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName, name string, forceDeletion *bool) error { - future, err := c.client.Delete(ctx, resourceGroupName, name, forceDeletion) + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, &armcompute.VirtualMachinesClientBeginDeleteOptions{ + ForceDeletion: forceDeletion, + }) if err != nil { - return err - } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - result, err := future.Result(c.client) - if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent || result.StatusCode == http.StatusNotFound { - return nil + return FilterNotFoundError(err) } - return fmt.Errorf("deletion of virtual machine %s failed. statuscode=%d", name, result.StatusCode) + _, err = future.PollUntilDone(ctx, nil) + return err } diff --git a/pkg/azure/client/vmss.go b/pkg/azure/client/vmss.go index c98afd4bb..62f1f3a2e 100644 --- a/pkg/azure/client/vmss.go +++ b/pkg/azure/client/vmss.go @@ -16,76 +16,68 @@ package client import ( "context" - "fmt" - "net/http" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" ) -// List will list vmss in a resource group. -func (c VmssClient) List(ctx context.Context, resourceGroupName string) ([]compute.VirtualMachineScaleSet, error) { - pages, err := c.client.List(ctx, resourceGroupName) +// NewVmssClient creates a new VmssClient +func NewVmssClient(auth internal.ClientAuth) (Vmss, error) { + cred, err := auth.GetAzClientCredentials() if err != nil { return nil, err } + client, err := armcompute.NewVirtualMachineScaleSetsClient(auth.SubscriptionID, cred, nil) + return &VmssClient{client}, err +} - var vmoList []compute.VirtualMachineScaleSet - for pages.NotDone() { - vmoList = append(vmoList, pages.Values()...) - if err := pages.NextWithContext(ctx); err != nil { +// List will list vmss in a resource group. +func (c VmssClient) List(ctx context.Context, resourceGroupName string) ([]*armcompute.VirtualMachineScaleSet, error) { + pager := c.client.NewListPager(resourceGroupName, nil) + var ls []*armcompute.VirtualMachineScaleSet + for pager.More() { + res, err := pager.NextPage(ctx) + if err != nil { return nil, err } + ls = append(ls, res.VirtualMachineScaleSetListResult.Value...) } - - return vmoList, nil + return ls, nil } // Get will fetch a vmss. -func (c VmssClient) Get(ctx context.Context, resourceGroupName, name string, expand compute.ExpandTypesForGetVMScaleSets) (*compute.VirtualMachineScaleSet, error) { - vmo, err := c.client.Get(ctx, resourceGroupName, name, expand) +func (c VmssClient) Get(ctx context.Context, resourceGroupName, name string, expander *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error) { + vmo, err := c.client.Get(ctx, resourceGroupName, name, &armcompute.VirtualMachineScaleSetsClientGetOptions{ + Expand: expander, + }) if err != nil { - if IsAzureAPINotFoundError(err) { - return nil, nil - } - return nil, err + return nil, FilterNotFoundError(err) } - return &vmo, nil + return &vmo.VirtualMachineScaleSet, nil } // Create will create a vmss. -func (c VmssClient) Create(ctx context.Context, resourceGroupName, name string, properties *compute.VirtualMachineScaleSet) (*compute.VirtualMachineScaleSet, error) { - future, err := c.client.CreateOrUpdate(ctx, resourceGroupName, name, *properties) +func (c VmssClient) CreateOrUpdate(ctx context.Context, resourceGroupName, name string, properties armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error) { + future, err := c.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, properties, nil) if err != nil { return nil, err } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return nil, err - } - vmo, err := future.Result(c.client) + res, err := future.PollUntilDone(ctx, nil) if err != nil { return nil, err } - return &vmo, nil + return &res.VirtualMachineScaleSet, nil } // Delete will delete a vmss. func (c VmssClient) Delete(ctx context.Context, resourceGroupName, name string, forceDeletion *bool) error { - future, err := c.client.Delete(ctx, resourceGroupName, name, forceDeletion) + future, err := c.client.BeginDelete(ctx, resourceGroupName, name, &armcompute.VirtualMachineScaleSetsClientBeginDeleteOptions{ + ForceDeletion: forceDeletion, + }) if err != nil { - if IsAzureAPINotFoundError(err) { - return nil - } - return err - } - if err := future.WaitForCompletionRef(ctx, c.client.Client); err != nil { - return err - } - result, err := future.Result(c.client) - if err != nil { - return err - } - if result.StatusCode == http.StatusOK || result.StatusCode == http.StatusAccepted || result.StatusCode == http.StatusNoContent { - return nil + return FilterNotFoundError(err) } - return fmt.Errorf("deletion of vmss %s failed. statuscode=%d", name, result.StatusCode) + _, err = future.PollUntilDone(ctx, nil) + return err } diff --git a/pkg/azure/client/vnet.go b/pkg/azure/client/vnet.go new file mode 100644 index 000000000..ae165110e --- /dev/null +++ b/pkg/azure/client/vnet.go @@ -0,0 +1,63 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +// NewVnetClient creates a new VnetClient. +func NewVnetClient(auth internal.ClientAuth) (*VnetClient, error) { + cred, err := auth.GetAzClientCredentials() + if err != nil { + return nil, err + } + client, err := armnetwork.NewVirtualNetworksClient(auth.SubscriptionID, cred, nil) + return &VnetClient{client}, err +} + +// CreateOrUpdate creates or updates a virtual network. +func (v VnetClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error) { + poller, err := v.client.BeginCreateOrUpdate(ctx, resourceGroupName, name, parameters, nil) + if err != nil { + return nil, fmt.Errorf("cannot create virtual network: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + return &res.VirtualNetwork, err +} + +// Delete a given an existing virtual network. +func (v VnetClient) Delete(ctx context.Context, resourceGroup, vnetName string) (err error) { + poller, err := v.client.BeginDelete(ctx, resourceGroup, vnetName, nil) + if err != nil { + return FilterNotFoundError(err) + } + _, err = poller.PollUntilDone(ctx, nil) + return err +} + +// Get gets a given virtual network by name +func (v VnetClient) Get(ctx context.Context, resourceGroupName, name string) (*armnetwork.VirtualNetwork, error) { + res, err := v.client.Get(ctx, resourceGroupName, name, nil) + if err != nil { + return nil, FilterNotFoundError(err) + } + return &res.VirtualNetwork, err +} diff --git a/pkg/controller/backupbucket/actuator.go b/pkg/controller/backupbucket/actuator.go index 34316e3cf..714389808 100644 --- a/pkg/controller/backupbucket/actuator.go +++ b/pkg/controller/backupbucket/actuator.go @@ -42,7 +42,10 @@ func (a *actuator) InjectClient(client client.Client) error { } func (a *actuator) Reconcile(ctx context.Context, _ logr.Logger, backupBucket *extensionsv1alpha1.BackupBucket) error { - var factory = azureclient.NewAzureClientFactory(a.client) + factory, err := azureclient.NewAzureClientFactory(ctx, a.client, backupBucket.Spec.SecretRef) + if err != nil { + return err + } // If the generated secret in the backupbucket status not exists that means // no backupbucket exists and it need to be created. @@ -71,7 +74,10 @@ func (a *actuator) Delete(ctx context.Context, _ logr.Logger, backupBucket *exte return nil } - var factory = azureclient.NewAzureClientFactory(a.client) + factory, err := azureclient.NewAzureClientFactory(ctx, a.client, backupBucket.Spec.SecretRef) + if err != nil { + return util.DetermineError(err, helper.KnownCodes) + } secret, err := a.getBackupBucketGeneratedSecret(ctx, backupBucket) if err != nil { @@ -89,11 +95,11 @@ func (a *actuator) Delete(ctx context.Context, _ logr.Logger, backupBucket *exte } // Get resource group client and delete the resource group which contains the backup storage account. - groupClient, err := factory.Group(ctx, backupBucket.Spec.SecretRef) + groupClient, err := factory.Group() if err != nil { return util.DetermineError(err, helper.KnownCodes) } - if err := groupClient.DeleteIfExits(ctx, backupBucket.Name); err != nil { + if err := groupClient.Delete(ctx, backupBucket.Name); err != nil { return util.DetermineError(err, helper.KnownCodes) } diff --git a/pkg/controller/backupbucket/backupbucket.go b/pkg/controller/backupbucket/backupbucket.go index 79887412a..d85f5f3d7 100644 --- a/pkg/controller/backupbucket/backupbucket.go +++ b/pkg/controller/backupbucket/backupbucket.go @@ -32,16 +32,16 @@ func ensureBackupBucket(ctx context.Context, client client.Client, factory azure ) // Get resource group client to ensure resource group to host backup storage account exists. - groupClient, err := factory.Group(ctx, backupBucket.Spec.SecretRef) + groupClient, err := factory.Group() if err != nil { return "", "", err } - if err := groupClient.CreateOrUpdate(ctx, backupBucket.Name, backupBucket.Spec.Region); err != nil { + if _, err := groupClient.CreateOrUpdate(ctx, backupBucket.Name, backupBucket.Spec.Region); err != nil { return "", "", err } // Get storage account client to create the backup storage account. - storageAccountClient, err := factory.StorageAccount(ctx, backupBucket.Spec.SecretRef) + storageAccountClient, err := factory.StorageAccount() if err != nil { return "", "", err } diff --git a/pkg/controller/backupentry/actuator.go b/pkg/controller/backupentry/actuator.go index 9831cf261..531a73ce0 100644 --- a/pkg/controller/backupentry/actuator.go +++ b/pkg/controller/backupentry/actuator.go @@ -46,7 +46,10 @@ func (a *actuator) GetETCDSecretData(ctx context.Context, _ logr.Logger, be *ext } func (a *actuator) Delete(ctx context.Context, _ logr.Logger, backupEntry *extensionsv1alpha1.BackupEntry) error { - factory := azureclient.NewAzureClientFactory(a.client) + factory, err := azureclient.NewAzureClientFactory(ctx, a.client, backupEntry.Spec.SecretRef) + if err != nil { + return util.DetermineError(err, helper.KnownCodes) + } storageClient, err := factory.Storage(ctx, backupEntry.Spec.SecretRef) if err != nil { return util.DetermineError(err, helper.KnownCodes) diff --git a/pkg/controller/bastion/actuator.go b/pkg/controller/bastion/actuator.go index d98fc63bc..d75e91a71 100644 --- a/pkg/controller/bastion/actuator.go +++ b/pkg/controller/bastion/actuator.go @@ -21,8 +21,9 @@ import ( "encoding/json" "fmt" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" "github.com/gardener/gardener/extensions/pkg/controller" "github.com/gardener/gardener/extensions/pkg/controller/bastion" "github.com/go-logr/logr" @@ -51,21 +52,21 @@ func (a *actuator) InjectClient(client client.Client) error { return nil } -func createBastionInstance(ctx context.Context, factory azureclient.Factory, opt *Options, parameters *compute.VirtualMachine) (*compute.VirtualMachine, error) { - vmClient, err := factory.VirtualMachine(ctx, opt.SecretReference) +func createBastionInstance(ctx context.Context, factory azureclient.Factory, opt *Options, parameters armcompute.VirtualMachine) (*armcompute.VirtualMachine, error) { + vmClient, err := factory.VirtualMachine() if err != nil { return nil, err } - instance, err := vmClient.Create(ctx, opt.ResourceGroupName, opt.BastionInstanceName, parameters) + instance, err := vmClient.CreateOrUpdate(ctx, opt.ResourceGroupName, opt.BastionInstanceName, parameters) if err != nil { return nil, fmt.Errorf("unable to create VM instance %s: %w", opt.BastionInstanceName, err) } return instance, nil } -func createOrUpdatePublicIP(ctx context.Context, factory azureclient.Factory, opt *Options, parameters *network.PublicIPAddress) (*network.PublicIPAddress, error) { - publicClient, err := factory.PublicIP(ctx, opt.SecretReference) +func createOrUpdatePublicIP(ctx context.Context, factory azureclient.Factory, opt *Options, parameters *armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) { + publicClient, err := factory.PublicIP() if err != nil { return nil, err } @@ -77,12 +78,12 @@ func createOrUpdatePublicIP(ctx context.Context, factory azureclient.Factory, op return ip, nil } -func createOrUpdateNetworkSecGroup(ctx context.Context, factory azureclient.Factory, opt *Options, parameters *network.SecurityGroup) error { - if parameters == nil || parameters.SecurityRules == nil { +func createOrUpdateNetworkSecGroup(ctx context.Context, factory azureclient.Factory, opt *Options, parameters *armnetwork.SecurityGroup) error { + if parameters == nil || parameters.Properties.SecurityRules == nil { return fmt.Errorf("network security group nor SecurityRules can't be nil, securityGroupName: %s", opt.SecurityGroupName) } - nsgClient, err := factory.NetworkSecurityGroup(ctx, opt.SecretReference) + nsgClient, err := factory.NetworkSecurityGroup() if err != nil { return err } @@ -94,13 +95,13 @@ func createOrUpdateNetworkSecGroup(ctx context.Context, factory azureclient.Fact return nil } -func getBastionInstance(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*compute.VirtualMachine, error) { - vmClient, err := factory.VirtualMachine(ctx, opt.SecretReference) +func getBastionInstance(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*armcompute.VirtualMachine, error) { + vmClient, err := factory.VirtualMachine() if err != nil { return nil, err } - instance, err := vmClient.Get(ctx, opt.ResourceGroupName, opt.BastionInstanceName, compute.InstanceViewTypesInstanceView) + instance, err := vmClient.Get(ctx, opt.ResourceGroupName, opt.BastionInstanceName, to.Ptr(armcompute.InstanceViewTypesInstanceView)) if err != nil { if azureclient.IsAzureAPINotFoundError(err) { log.Info("Instance not found,", "instance_name", opt.BastionInstanceName) @@ -111,13 +112,13 @@ func getBastionInstance(ctx context.Context, log logr.Logger, factory azureclien return instance, nil } -func getNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*network.Interface, error) { - nicClient, err := factory.NetworkInterface(ctx, opt.SecretReference) +func getNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*armnetwork.Interface, error) { + nicClient, err := factory.NetworkInterface() if err != nil { return nil, err } - nic, err := nicClient.Get(ctx, opt.ResourceGroupName, opt.NicName, "") + nic, err := nicClient.Get(ctx, opt.ResourceGroupName, opt.NicName) if err != nil { if azureclient.IsAzureAPINotFoundError(err) { log.Info("Nic not found,", "nic_name", opt.NicName) @@ -129,13 +130,13 @@ func getNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, o return nic, nil } -func getNetworkSecurityGroup(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*network.SecurityGroup, error) { - nsgClient, err := factory.NetworkSecurityGroup(ctx, opt.SecretReference) +func getNetworkSecurityGroup(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*armnetwork.SecurityGroup, error) { + nsgClient, err := factory.NetworkSecurityGroup() if err != nil { return nil, err } - nsgResp, err := nsgClient.Get(ctx, opt.ResourceGroupName, opt.SecurityGroupName, "") + nsgResp, err := nsgClient.Get(ctx, opt.ResourceGroupName, opt.SecurityGroupName) if err != nil { if azureclient.IsAzureAPINotFoundError(err) { log.Error(err, "Network Security Group not found, test environment?", "nsg_name", opt.SecurityGroupName) @@ -167,13 +168,13 @@ func getWorkersCIDR(cluster *controller.Cluster) ([]string, error) { return nil, fmt.Errorf("InfrastructureConfig.Networks.Workers is nil") } -func getPublicIP(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*network.PublicIPAddress, error) { - ipClient, err := factory.PublicIP(ctx, opt.SecretReference) +func getPublicIP(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*armnetwork.PublicIPAddress, error) { + ipClient, err := factory.PublicIP() if err != nil { return nil, err } - ip, err := ipClient.Get(ctx, opt.ResourceGroupName, opt.BastionPublicIPName, "") + ip, err := ipClient.Get(ctx, opt.ResourceGroupName, opt.BastionPublicIPName) if err != nil { if azureclient.IsAzureAPINotFoundError(err) { log.Info("public IP not found,", "publicIP_name", opt.BastionPublicIPName) @@ -184,9 +185,9 @@ func getPublicIP(ctx context.Context, log logr.Logger, factory azureclient.Facto return ip, nil } -func getSubnet(ctx context.Context, log logr.Logger, factory azureclient.Factory, infrastructureStatus *azure.InfrastructureStatus, opt *Options) (*network.Subnet, error) { +func getSubnet(ctx context.Context, log logr.Logger, factory azureclient.Factory, infrastructureStatus *azure.InfrastructureStatus, opt *Options) (*armnetwork.Subnet, error) { var sg string - subnetClient, err := factory.Subnet(ctx, opt.SecretReference) + subnetClient, err := factory.Subnet() if err != nil { return nil, err } @@ -197,7 +198,7 @@ func getSubnet(ctx context.Context, log logr.Logger, factory azureclient.Factory sg = opt.ResourceGroupName } - subnet, err := subnetClient.Get(ctx, sg, infrastructureStatus.Networks.VNet.Name, infrastructureStatus.Networks.Subnets[0].Name, "") + subnet, err := subnetClient.Get(ctx, sg, infrastructureStatus.Networks.VNet.Name, infrastructureStatus.Networks.Subnets[0].Name) if err != nil { return nil, err } @@ -210,16 +211,15 @@ func getSubnet(ctx context.Context, log logr.Logger, factory azureclient.Factory return subnet, nil } -func deleteSecurityRuleDefinitionsByName(rulesArr *[]network.SecurityRule, namesToRemove ...string) bool { +func deleteSecurityRuleDefinitionsByName(rulesArr []*armnetwork.SecurityRule, namesToRemove ...string) ([]*armnetwork.SecurityRule, bool) { + rulesWereDeleted := false if rulesArr == nil { - return false + return rulesArr, rulesWereDeleted } - rulesWereDeleted := false - result := make([]network.SecurityRule, 0, len(*rulesArr)) - + result := make([]*armnetwork.SecurityRule, 0, len(rulesArr)) rules: - for _, rule := range *rulesArr { + for _, rule := range rulesArr { for _, nameToDelete := range namesToRemove { if rule.Name != nil && *rule.Name == nameToDelete { rulesWereDeleted = true @@ -228,9 +228,7 @@ rules: } result = append(result, rule) } - - *rulesArr = result - return rulesWereDeleted + return result, rulesWereDeleted } func equalNotNil(str1 *string, str2 *string) bool { diff --git a/pkg/controller/bastion/actuator_delete.go b/pkg/controller/bastion/actuator_delete.go index 612c6ffdf..a7488ffd5 100644 --- a/pkg/controller/bastion/actuator_delete.go +++ b/pkg/controller/bastion/actuator_delete.go @@ -32,7 +32,6 @@ import ( ) func (a *actuator) Delete(ctx context.Context, log logr.Logger, bastion *extensionsv1alpha1.Bastion, cluster *controller.Cluster) error { - var factory = azureclient.NewAzureClientFactory(a.client) infrastructureStatus, err := getInfrastructureStatus(ctx, a, cluster) if err != nil { @@ -43,6 +42,10 @@ func (a *actuator) Delete(ctx context.Context, log logr.Logger, bastion *extensi if err != nil { return err } + factory, err := azureclient.NewAzureClientFactory(ctx, a.client, opt.SecretReference) + if err != nil { + return err + } err = removeBastionInstance(ctx, log, factory, opt) if err != nil { @@ -97,7 +100,8 @@ func removeNSGRule(ctx context.Context, log logr.Logger, factory azureclient.Fac NSGEgressAllowOnlyResourceName(opt.BastionInstanceName), } - rulesWereDeleted := deleteSecurityRuleDefinitionsByName(securityGroupResp.SecurityRules, rules...) + modifiedRules, rulesWereDeleted := deleteSecurityRuleDefinitionsByName(securityGroupResp.Properties.SecurityRules, rules...) + securityGroupResp.Properties.SecurityRules = modifiedRules if !rulesWereDeleted { return nil } @@ -112,7 +116,7 @@ func removeNSGRule(ctx context.Context, log logr.Logger, factory azureclient.Fac } func removePublicIP(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) error { - publicClient, err := factory.PublicIP(ctx, opt.SecretReference) + publicClient, err := factory.PublicIP() if err != nil { return err } @@ -127,7 +131,7 @@ func removePublicIP(ctx context.Context, log logr.Logger, factory azureclient.Fa } func removeNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) error { - nicClient, err := factory.NetworkInterface(ctx, opt.SecretReference) + nicClient, err := factory.NetworkInterface() if err != nil { return err } @@ -142,7 +146,7 @@ func removeNic(ctx context.Context, log logr.Logger, factory azureclient.Factory } func removeDisk(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) error { - diskClient, err := factory.Disk(ctx, opt.SecretReference) + diskClient, err := factory.Disk() if err != nil { return err } @@ -156,7 +160,7 @@ func removeDisk(ctx context.Context, log logr.Logger, factory azureclient.Factor } func removeBastionInstance(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) error { - vmClient, err := factory.VirtualMachine(ctx, opt.SecretReference) + vmClient, err := factory.VirtualMachine() if err != nil { return err } diff --git a/pkg/controller/bastion/actuator_reconcile.go b/pkg/controller/bastion/actuator_reconcile.go index e53ec1bf7..7b5fba47a 100644 --- a/pkg/controller/bastion/actuator_reconcile.go +++ b/pkg/controller/bastion/actuator_reconcile.go @@ -21,7 +21,7 @@ import ( "net" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" "github.com/gardener/gardener/extensions/pkg/controller" "github.com/gardener/gardener/extensions/pkg/util" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" @@ -51,8 +51,6 @@ func (be *bastionEndpoints) Ready() bool { } func (a *actuator) Reconcile(ctx context.Context, log logr.Logger, bastion *extensionsv1alpha1.Bastion, cluster *controller.Cluster) error { - var factory = azureclient.NewAzureClientFactory(a.client) - infrastructureStatus, err := getInfrastructureStatus(ctx, a, cluster) if err != nil { return err @@ -62,6 +60,10 @@ func (a *actuator) Reconcile(ctx context.Context, log logr.Logger, bastion *exte if err != nil { return err } + factory, err := azureclient.NewAzureClientFactory(ctx, a.client, opt.SecretReference) + if err != nil { + return err + } publicIP, err := ensurePublicIPAddress(ctx, log, factory, opt) if err != nil { @@ -149,15 +151,15 @@ func getInfrastructureStatus(ctx context.Context, a *actuator, cluster *extensio return infrastructureStatus, nil } -func getPrivateIPv4Address(nic *network.Interface) (string, error) { - if nic.IPConfigurations == nil { - return "", fmt.Errorf("nic.IPConfigurations %s is nil", *nic.ID) +func getPrivateIPv4Address(nic *armnetwork.Interface) (string, error) { + if len(nic.Properties.IPConfigurations) == 0 { + return "", fmt.Errorf("nic.IPConfigurations %s is empty", *nic.ID) } - ipConfigurations := *nic.IPConfigurations + ipConfigurations := nic.Properties.IPConfigurations for _, ipConfiguration := range ipConfigurations { - if ipConfiguration.PrivateIPAddress != nil { - ipv4 := net.ParseIP(*ipConfiguration.PrivateIPAddress).To4() + if ipConfiguration.Properties.PrivateIPAddress != nil { + ipv4 := net.ParseIP(*ipConfiguration.Properties.PrivateIPAddress).To4() if ipv4 != nil { return ipv4.String(), nil } @@ -167,15 +169,15 @@ func getPrivateIPv4Address(nic *network.Interface) (string, error) { return "", fmt.Errorf("failed to get IPv4 PrivateIPAddress on nic %s", *nic.ID) } -func getPrivateIPv6Address(nic *network.Interface) (string, error) { - if nic.IPConfigurations == nil { - return "", fmt.Errorf("nic.IPConfigurations %s is nil", *nic.ID) +func getPrivateIPv6Address(nic *armnetwork.Interface) (string, error) { + if len(nic.Properties.IPConfigurations) == 0 { + return "", fmt.Errorf("nic.IPConfigurations %s is empty", *nic.ID) } - ipConfigurations := *nic.IPConfigurations + ipConfigurations := nic.Properties.IPConfigurations for _, ipConfiguration := range ipConfigurations { - if ipConfiguration.PrivateIPAddress != nil { - ip := net.ParseIP(*ipConfiguration.PrivateIPAddress) + if ipConfiguration.Properties.PrivateIPAddress != nil { + ip := net.ParseIP(*ipConfiguration.Properties.PrivateIPAddress) if len(ip.To4()) == net.IPv4len { continue } @@ -195,11 +197,11 @@ func ensureNetworkSecurityGroups(ctx context.Context, log logr.Logger, factory a return err } - if expectedNSGRulesPresentAndValid(networkSecGroupResp.SecurityRules, expectedNSGRuleList) { + if expectedNSGRulesPresentAndValid(networkSecGroupResp.Properties.SecurityRules, expectedNSGRuleList) { return nil } - addOrReplaceNsgRulesDefinition(networkSecGroupResp.SecurityRules, expectedNSGRuleList) + networkSecGroupResp.Properties.SecurityRules = addOrReplaceNsgRulesDefinition(networkSecGroupResp.Properties.SecurityRules, expectedNSGRuleList) if err := createOrUpdateNetworkSecGroup(ctx, factory, opt, networkSecGroupResp); err != nil { return err @@ -207,14 +209,14 @@ func ensureNetworkSecurityGroups(ctx context.Context, log logr.Logger, factory a log.Info("created or updated bastion security rules of network security group", "nsg", opt.SecurityGroupName, - "rules", networkSecGroupResp.SecurityRules, + "rules", networkSecGroupResp.Properties.SecurityRules, ) return nil } -func prepareNSGRules(opt *Options) *[]network.SecurityRule { - res := make([]network.SecurityRule, 0) +func prepareNSGRules(opt *Options) []*armnetwork.SecurityRule { + res := make([]*armnetwork.SecurityRule, 0) res = append(res, nsgEgressDenyAllIPv4(opt)) res = append(res, nsgEgressAllowSSHToWorkerIPv4(opt)) @@ -237,17 +239,17 @@ func prepareNSGRules(opt *Options) *[]network.SecurityRule { res = append(res, nsgIngressAllowSSH(ipv6Name, opt.PrivateIPAddressV6, ipv6cidr)) } - return &res + return res } -func ensurePublicIPAddress(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*network.PublicIPAddress, error) { +func ensurePublicIPAddress(ctx context.Context, log logr.Logger, factory azureclient.Factory, opt *Options) (*armnetwork.PublicIPAddress, error) { publicIP, err := getPublicIP(ctx, log, factory, opt) if err != nil { return nil, err } if publicIP != nil { - if publicIP.ProvisioningState != "Succeeded" { - return nil, fmt.Errorf("public IP with name %v is not in \"Succeeded\" status: %s", publicIP.Name, publicIP.ProvisioningState) + if *publicIP.Properties.ProvisioningState != "Succeeded" { + return nil, fmt.Errorf("public IP with name %v is not in \"Succeeded\" status: %s", publicIP.Name, *publicIP.Properties.ProvisioningState) } return publicIP, nil } @@ -259,7 +261,7 @@ func ensurePublicIPAddress(ctx context.Context, log logr.Logger, factory azurecl return nil, err } - log.Info("bastion compute instance public ip address created", "publicIP", *publicIP.IPAddress) + log.Info("bastion compute instance public ip address created", "publicIP", *publicIP.Properties.IPAddress) return publicIP, nil } @@ -270,13 +272,13 @@ func ensureComputeInstance(ctx context.Context, log logr.Logger, bastion *extens } if instance != nil { - if instance.ProvisioningState == nil { + if instance.Properties.ProvisioningState == nil { return fmt.Errorf("instance not running, status: nil") } - if *instance.ProvisioningState == "Succeeded" { + if *instance.Properties.ProvisioningState == "Succeeded" { return nil } else { - return fmt.Errorf("instance not running, status: %v", *instance.ProvisioningState) + return fmt.Errorf("instance not running, status: %v", *instance.Properties.ProvisioningState) } } @@ -295,14 +297,14 @@ func ensureComputeInstance(ctx context.Context, log logr.Logger, bastion *extens return nil } -func ensureNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, infrastructureStatus *azure.InfrastructureStatus, opt *Options, publicIP *network.PublicIPAddress) (*network.Interface, error) { +func ensureNic(ctx context.Context, log logr.Logger, factory azureclient.Factory, infrastructureStatus *azure.InfrastructureStatus, opt *Options, publicIP *armnetwork.PublicIPAddress) (*armnetwork.Interface, error) { nic, err := getNic(ctx, log, factory, opt) if err != nil { return nil, err } if nic != nil { - if nic.ProvisioningState != "Succeeded" { - return nil, fmt.Errorf("network interface with name %v is not in \"Succeeded\" status: %s", nic.Name, nic.ProvisioningState) + if *nic.Properties.ProvisioningState != "Succeeded" { + return nil, fmt.Errorf("network interface with name %v is not in \"Succeeded\" status: %s", nic.Name, *nic.Properties.ProvisioningState) } return nic, nil } @@ -320,7 +322,7 @@ func ensureNic(ctx context.Context, log logr.Logger, factory azureclient.Factory parameters := nicDefine(opt, publicIP, subnet) - nicClient, err := factory.NetworkInterface(ctx, opt.SecretReference) + nicClient, err := factory.NetworkInterface() if err != nil { return nil, err } @@ -333,7 +335,7 @@ func ensureNic(ctx context.Context, log logr.Logger, factory azureclient.Factory return nic, nil } -func getInstanceEndpoints(nic *network.Interface, publicIP *network.PublicIPAddress) (*bastionEndpoints, error) { +func getInstanceEndpoints(nic *armnetwork.Interface, publicIP *armnetwork.PublicIPAddress) (*bastionEndpoints, error) { endpoints := &bastionEndpoints{} internalIP, err := getPrivateIPv4Address(nic) @@ -348,7 +350,7 @@ func getInstanceEndpoints(nic *network.Interface, publicIP *network.PublicIPAddr // Azure does not automatically assign a public dns name to the instance (in contrast to e.g. AWS). // As we provide an externalIP to connect to the bastion, having a public dns name would just be an alternative way to connect to the bastion. // Out of this reason, we spare the effort to create a PTR record (see https://docs.microsoft.com/en-us/azure/dns/dns-reverse-dns-hosting) just for the sake of having it. - externalIP := publicIP.IPAddress + externalIP := publicIP.Properties.IPAddress if ingress := addressToIngress(nil, externalIP); ingress != nil { endpoints.public = ingress } @@ -381,20 +383,20 @@ func addressToIngress(dnsName *string, ipAddress *string) *corev1.LoadBalancerIn return ingress } -func expectedNSGRulesPresentAndValid(existingRules *[]network.SecurityRule, expectedRules *[]network.SecurityRule) bool { +func expectedNSGRulesPresentAndValid(existingRules []*armnetwork.SecurityRule, expectedRules []*armnetwork.SecurityRule) bool { if existingRules == nil || expectedRules == nil { return false } - for _, desRule := range *expectedRules { + for _, desRule := range expectedRules { ruleExistAndValid := false - for _, existingRule := range *existingRules { + for _, existingRule := range existingRules { // compare firewall rules by its names because names here kind of "IDs" if equalNotNil(desRule.Name, existingRule.Name) { - if notEqualNotNil(desRule.SourceAddressPrefix, existingRule.SourceAddressPrefix) { + if notEqualNotNil(desRule.Properties.SourceAddressPrefix, existingRule.Properties.SourceAddressPrefix) { return false } - if notEqualNotNil(desRule.DestinationAddressPrefix, existingRule.DestinationAddressPrefix) { + if notEqualNotNil(desRule.Properties.DestinationAddressPrefix, existingRule.Properties.DestinationAddressPrefix) { return false } ruleExistAndValid = true @@ -407,23 +409,23 @@ func expectedNSGRulesPresentAndValid(existingRules *[]network.SecurityRule, expe return true } -func addOrReplaceNsgRulesDefinition(existingRules *[]network.SecurityRule, desiredRules *[]network.SecurityRule) { +func addOrReplaceNsgRulesDefinition(existingRules []*armnetwork.SecurityRule, desiredRules []*armnetwork.SecurityRule) (newRules []*armnetwork.SecurityRule) { if existingRules == nil || desiredRules == nil { return } - result := make([]network.SecurityRule, 0, len(*existingRules)+len(*desiredRules)) + result := make([]*armnetwork.SecurityRule, 0, len(existingRules)+len(desiredRules)) bookedPriorityIDs := make(map[int32]bool) - for _, rule := range *existingRules { - if rule.Priority == nil { + for _, rule := range existingRules { + if rule.Properties.Priority == nil { continue } - bookedPriorityIDs[*rule.Priority] = true + bookedPriorityIDs[*rule.Properties.Priority] = true } // filter rules intended to be replaced - for _, existentRule := range *existingRules { + for _, existentRule := range existingRules { if RuleExist(existentRule.Name, desiredRules) { continue } @@ -431,21 +433,22 @@ func addOrReplaceNsgRulesDefinition(existingRules *[]network.SecurityRule, desir } // ensure uniq priority numbers - for _, desiredRule := range *desiredRules { - desiredRule.Priority = findNextFreeNumber(bookedPriorityIDs, *desiredRule.Priority) + for _, desiredRule := range desiredRules { + desiredRule.Properties.Priority = findNextFreeNumber(bookedPriorityIDs, *desiredRule.Properties.Priority) } - result = append(result, *desiredRules...) - *existingRules = result + result = append(result, desiredRules...) + newRules = result + return } // RuleExist checks if the rule with the given name is present in the list of rules. -func RuleExist(ruleName *string, rules *[]network.SecurityRule) bool { +func RuleExist(ruleName *string, rules []*armnetwork.SecurityRule) bool { if ruleName == nil { return false } - for _, rule := range *rules { + for _, rule := range rules { if rule.Name != nil && *rule.Name == *ruleName { return true } diff --git a/pkg/controller/bastion/bastion_test.go b/pkg/controller/bastion/bastion_test.go index 9fe529882..4e77f0f74 100644 --- a/pkg/controller/bastion/bastion_test.go +++ b/pkg/controller/bastion/bastion_test.go @@ -17,7 +17,7 @@ package bastion import ( "encoding/json" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" "github.com/Azure/go-autorest/autorest/to" "github.com/gardener/gardener/extensions/pkg/controller" gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" @@ -36,6 +36,23 @@ import ( api "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" ) +func createRule(name, sourceAddrPrefix, destinationAddressPrefix string) *armnetwork.SecurityRule { + return &armnetwork.SecurityRule{ + Name: pointer.String(name), Properties: &armnetwork.SecurityRulePropertiesFormat{ + SourceAddressPrefix: pointer.String(sourceAddrPrefix), + DestinationAddressPrefix: pointer.String(destinationAddressPrefix), + }, + } +} + +func createRuleWithPriority(name string, priority int32) *armnetwork.SecurityRule { + return &armnetwork.SecurityRule{ + Name: pointer.String(name), Properties: &armnetwork.SecurityRulePropertiesFormat{ + Priority: to.Int32Ptr(priority), + }, + } +} + var _ = Describe("Bastion test", func() { var ( cluster *extensions.Cluster @@ -66,7 +83,7 @@ var _ = Describe("Bastion test", func() { CIDRs: []string{"213.69.151.131/32", "2001:db8:3333:4444:5555:6666:7777:8888/128"}, } rules := prepareNSGRules(opt) - Expect(len(*rules)).Should(Equal(4)) + Expect(len(rules)).Should(Equal(4)) }) It("should return 2 rules without ipv6", func() { opt := &Options{ @@ -74,78 +91,50 @@ var _ = Describe("Bastion test", func() { CIDRs: []string{"213.69.151.131/32", "2001:db8:3333:4444:5555:6666:7777:8888/128"}, } rules := prepareNSGRules(opt) - Expect(len(*rules)).Should(Equal(3)) + Expect(len(rules)).Should(Equal(3)) }) }) Describe("Testing manipulations with Firewall Rules", func() { It("Should be valid", func() { - ruleSet1 := []network.SecurityRule{ - {Name: pointer.String("ruleName2"), SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - SourceAddressPrefix: pointer.String("1.1.1.1"), - DestinationAddressPrefix: pointer.String("*"), - }}, - {Name: pointer.String("ruleName1"), SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - SourceAddressPrefix: pointer.String("*"), - DestinationAddressPrefix: pointer.String("*"), - }}, + ruleSet1 := []*armnetwork.SecurityRule{ + createRule("ruleName2", "1.1.1.1", "*"), + createRule("ruleName1", "*", "*"), } - ruleSet2 := []network.SecurityRule{ - {Name: pointer.String("ruleName1"), SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - SourceAddressPrefix: pointer.String("8.8.8.8"), - DestinationAddressPrefix: pointer.String("*"), - }}, + ruleSet2 := []*armnetwork.SecurityRule{ + createRule("ruleName1", "8.8.8.8", "*"), } - ruleSet3 := []network.SecurityRule{ - {Name: pointer.String("ruleName1"), SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - SourceAddressPrefix: pointer.String("*"), - DestinationAddressPrefix: pointer.String("8.8.8.8"), - }}, + ruleSet3 := []*armnetwork.SecurityRule{ + createRule("ruleName1", "*", "8.8.8.8"), } - Expect(expectedNSGRulesPresentAndValid(&ruleSet1, &ruleSet1)).To(Equal(true)) - Expect(expectedNSGRulesPresentAndValid(&ruleSet1, &ruleSet2)).To(Equal(false)) - Expect(expectedNSGRulesPresentAndValid(&ruleSet1, &ruleSet3)).To(Equal(false)) + Expect(expectedNSGRulesPresentAndValid(ruleSet1, ruleSet1)).To(Equal(true)) + Expect(expectedNSGRulesPresentAndValid(ruleSet1, ruleSet2)).To(Equal(false)) + Expect(expectedNSGRulesPresentAndValid(ruleSet1, ruleSet3)).To(Equal(false)) }) It("should add Rules with new priority numbers and delete old one", func() { - oldSet := &[]network.SecurityRule{ - { - Name: pointer.String("defaultRule"), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{Priority: pointer.Int32(50)}, - }, - { - Name: pointer.String("ruleName1"), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{Priority: pointer.Int32(100)}, - }, - { - Name: pointer.String("ruleName2"), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{Priority: pointer.Int32(200)}, - }, + oldSet := []*armnetwork.SecurityRule{ + createRuleWithPriority("defaultRule", 50), + createRuleWithPriority("ruleName1", 100), + createRuleWithPriority("ruleName2", 200), } - newSet := []network.SecurityRule{ - { - Name: pointer.String("ruleName1"), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{Priority: pointer.Int32(100)}, - }, - { - Name: pointer.String("ruleName2"), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{Priority: pointer.Int32(200)}, - }, + newSet := []*armnetwork.SecurityRule{ + createRuleWithPriority("ruleName1", 100), + createRuleWithPriority("ruleName2", 200), } - addOrReplaceNsgRulesDefinition(oldSet, &newSet) - result := *oldSet + result := addOrReplaceNsgRulesDefinition(oldSet, newSet) Expect(*result[0].Name).To(Equal("defaultRule")) Expect(*result[1].Name).To(Equal("ruleName1")) Expect(*result[2].Name).To(Equal("ruleName2")) - Expect(*result[0].Priority).To(Equal(int32(50))) - Expect(*result[1].Priority).To(Equal(int32(101))) - Expect(*result[2].Priority).To(Equal(int32(201))) + Expect(*result[0].Properties.Priority).To(Equal(int32(50))) + Expect(*result[1].Properties.Priority).To(Equal(int32(101))) + Expect(*result[2].Properties.Priority).To(Equal(int32(201))) }) }) @@ -272,49 +261,50 @@ var _ = Describe("Bastion test", func() { Describe("remove Security Rule", func() { It("should return nil if pass nil", func() { - var rulesArr *[]network.SecurityRule = nil - result := deleteSecurityRuleDefinitionsByName(rulesArr, "") + var rulesArr []*armnetwork.SecurityRule = nil + var deleted bool + rulesArr, deleted = deleteSecurityRuleDefinitionsByName(rulesArr, "") - Expect(result).To(Equal(false)) + Expect(deleted).To(Equal(false)) Expect(rulesArr).To(BeNil()) }) It("Should return single security rule and keep with NIL name", func() { - original := &[]network.SecurityRule{ + original := []*armnetwork.SecurityRule{ {Name: nil}, {Name: pointer.String("ruleName1")}, {Name: pointer.String("ruleName2")}, {Name: pointer.String("ruleName3")}, } - someDeleted := deleteSecurityRuleDefinitionsByName(original, "ruleName1", "ruleName2", "non-exist-rule") + modified, someDeleted := deleteSecurityRuleDefinitionsByName(original, "ruleName1", "ruleName2", "non-exist-rule") Expect(someDeleted).To(Equal(true)) - Expect(original).To(Equal(&[]network.SecurityRule{ + Expect(modified).To(Equal([]*armnetwork.SecurityRule{ {Name: nil}, {Name: pointer.String("ruleName3")}, })) - Expect(len(*original)).To(Equal(2)) + Expect(len(modified)).To(Equal(2)) }) }) Describe("check getPrivateIPAddress ", func() { - nic := &network.Interface{ - InterfacePropertiesFormat: &network.InterfacePropertiesFormat{ - IPConfigurations: &[]network.InterfaceIPConfiguration{ + nic := &armnetwork.Interface{ + Properties: &armnetwork.InterfacePropertiesFormat{ + IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ { - InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{ + Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ PrivateIPAddress: to.StringPtr("192.168.1.2"), }, }, { - InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{ + Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ PrivateIPAddress: to.StringPtr("2001:db8:3333:4444:5555:6666:7777:8888"), }, }, { - InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{ + Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ PrivateIPAddress: to.StringPtr("192.168.1.1"), }, }, diff --git a/pkg/controller/bastion/resourcesdefine.go b/pkg/controller/bastion/resourcesdefine.go index 236bab12c..c54b70f52 100644 --- a/pkg/controller/bastion/resourcesdefine.go +++ b/pkg/controller/bastion/resourcesdefine.go @@ -17,25 +17,25 @@ package bastion import ( "encoding/base64" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" - "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" ) -func nicDefine(opt *Options, publicIP *network.PublicIPAddress, subnet *network.Subnet) *network.Interface { - return &network.Interface{ +func nicDefine(opt *Options, publicIP *armnetwork.PublicIPAddress, subnet *armnetwork.Subnet) *armnetwork.Interface { + return &armnetwork.Interface{ Name: &opt.NicName, Location: &opt.Location, - InterfacePropertiesFormat: &network.InterfacePropertiesFormat{ - IPConfigurations: &[]network.InterfaceIPConfiguration{ + Properties: &armnetwork.InterfacePropertiesFormat{ + IPConfigurations: []*armnetwork.InterfaceIPConfiguration{ { - Name: to.StringPtr("ipConfig1"), - InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{ - Subnet: &network.Subnet{ + Name: to.Ptr("ipConfig1"), + Properties: &armnetwork.InterfaceIPConfigurationPropertiesFormat{ + Subnet: &armnetwork.Subnet{ ID: subnet.ID, }, - PrivateIPAllocationMethod: network.Dynamic, + PrivateIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodDynamic), PublicIPAddress: publicIP, }, }, @@ -45,65 +45,65 @@ func nicDefine(opt *Options, publicIP *network.PublicIPAddress, subnet *network. } } -func publicIPAddressDefine(opt *Options) *network.PublicIPAddress { - return &network.PublicIPAddress{ +func publicIPAddressDefine(opt *Options) *armnetwork.PublicIPAddress { + return &armnetwork.PublicIPAddress{ Name: &opt.BastionPublicIPName, Location: &opt.Location, - Sku: &network.PublicIPAddressSku{ - Name: network.PublicIPAddressSkuNameStandard, + SKU: &armnetwork.PublicIPAddressSKU{ + Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard), }, - PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{ - PublicIPAddressVersion: network.IPv4, - PublicIPAllocationMethod: network.Static, + Properties: &armnetwork.PublicIPAddressPropertiesFormat{ + PublicIPAddressVersion: to.Ptr(armnetwork.IPVersionIPv4), + PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), }, Tags: opt.Tags, } } -func computeInstanceDefine(opt *Options, bastion *extensionsv1alpha1.Bastion, publickey string) *compute.VirtualMachine { - return &compute.VirtualMachine{ +func computeInstanceDefine(opt *Options, bastion *extensionsv1alpha1.Bastion, publickey string) armcompute.VirtualMachine { + return armcompute.VirtualMachine{ Location: &opt.Location, - VirtualMachineProperties: &compute.VirtualMachineProperties{ - HardwareProfile: &compute.HardwareProfile{ - VMSize: compute.VirtualMachineSizeTypesStandardB1s, + Properties: &armcompute.VirtualMachineProperties{ + HardwareProfile: &armcompute.HardwareProfile{ + VMSize: to.Ptr(armcompute.VirtualMachineSizeTypesStandardB1S), }, - StorageProfile: &compute.StorageProfile{ - ImageReference: &compute.ImageReference{ - Publisher: to.StringPtr("Canonical"), - Offer: to.StringPtr("UbuntuServer"), - Sku: to.StringPtr("18.04-LTS"), - Version: to.StringPtr("latest"), + StorageProfile: &armcompute.StorageProfile{ + ImageReference: &armcompute.ImageReference{ + Publisher: to.Ptr("Canonical"), + Offer: to.Ptr("UbuntuServer"), + SKU: to.Ptr("18.04-LTS"), + Version: to.Ptr("latest"), }, - OsDisk: &compute.OSDisk{ - CreateOption: compute.DiskCreateOptionTypesFromImage, - DiskSizeGB: to.Int32Ptr(32), + OSDisk: &armcompute.OSDisk{ + CreateOption: to.Ptr(armcompute.DiskCreateOptionTypesFromImage), + DiskSizeGB: to.Ptr(int32(32)), Name: &opt.DiskName, }, }, - OsProfile: &compute.OSProfile{ + OSProfile: &armcompute.OSProfile{ ComputerName: &opt.BastionInstanceName, - AdminUsername: to.StringPtr("gardener"), - LinuxConfiguration: &compute.LinuxConfiguration{ - DisablePasswordAuthentication: to.BoolPtr(true), - SSH: &compute.SSHConfiguration{ - PublicKeys: &[]compute.SSHPublicKey{ + AdminUsername: to.Ptr("gardener"), + LinuxConfiguration: &armcompute.LinuxConfiguration{ + DisablePasswordAuthentication: to.Ptr(true), + SSH: &armcompute.SSHConfiguration{ + PublicKeys: []*armcompute.SSHPublicKey{ { - Path: to.StringPtr("/home/gardener/.ssh/authorized_keys"), + Path: to.Ptr("/home/gardener/.ssh/authorized_keys"), // Random, temporary SSH public key to suffice the azure API, as creating an instance without a public key is not possible. The UserData will overwrite it later. // We could have also used the user's public SSH key but currently it's not available on the `Bastion` extension resource. - KeyData: to.StringPtr(publickey), + KeyData: to.Ptr(publickey), }, }, }, }, }, - UserData: to.StringPtr(base64.StdEncoding.EncodeToString(bastion.Spec.UserData)), - NetworkProfile: &compute.NetworkProfile{ - NetworkInterfaces: &[]compute.NetworkInterfaceReference{ + UserData: to.Ptr(base64.StdEncoding.EncodeToString(bastion.Spec.UserData)), + NetworkProfile: &armcompute.NetworkProfile{ + NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ { ID: &opt.NicID, - NetworkInterfaceReferenceProperties: &compute.NetworkInterfaceReferenceProperties{ - Primary: to.BoolPtr(true), + Properties: &armcompute.NetworkInterfaceReferenceProperties{ + Primary: to.Ptr(true), }, }, }, @@ -113,53 +113,53 @@ func computeInstanceDefine(opt *Options, bastion *extensionsv1alpha1.Bastion, pu } } -func nsgIngressAllowSSH(ruleName string, destinationAddress string, sourceAddresses []string) network.SecurityRule { - return network.SecurityRule{ - Name: to.StringPtr(ruleName), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - Protocol: network.SecurityRuleProtocolTCP, - SourceAddressPrefixes: &sourceAddresses, - SourcePortRange: to.StringPtr("*"), +func nsgIngressAllowSSH(ruleName string, destinationAddress string, sourceAddresses []string) *armnetwork.SecurityRule { + return &armnetwork.SecurityRule{ + Name: to.Ptr(ruleName), + Properties: &armnetwork.SecurityRulePropertiesFormat{ + Protocol: to.Ptr(armnetwork.SecurityRuleProtocolTCP), + SourceAddressPrefixes: to.SliceOfPtrs(sourceAddresses...), + SourcePortRange: to.Ptr("*"), DestinationAddressPrefix: &destinationAddress, - DestinationPortRange: to.StringPtr(SSHPort), - Access: network.SecurityRuleAccessAllow, - Direction: network.SecurityRuleDirectionInbound, - Priority: to.Int32Ptr(400), - Description: to.StringPtr("SSH access for Bastion"), + DestinationPortRange: to.Ptr(SSHPort), + Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), + Direction: to.Ptr(armnetwork.SecurityRuleDirectionInbound), + Priority: to.Ptr(int32(400)), + Description: to.Ptr("SSH access for Bastion"), }, } } -func nsgEgressDenyAllIPv4(opt *Options) network.SecurityRule { - return network.SecurityRule{ - Name: to.StringPtr(NSGEgressDenyAllResourceName(opt.BastionInstanceName)), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - Protocol: network.SecurityRuleProtocolAsterisk, +func nsgEgressDenyAllIPv4(opt *Options) *armnetwork.SecurityRule { + return &armnetwork.SecurityRule{ + Name: to.Ptr(NSGEgressDenyAllResourceName(opt.BastionInstanceName)), + Properties: &armnetwork.SecurityRulePropertiesFormat{ + Protocol: to.Ptr(armnetwork.SecurityRuleProtocolAsterisk), SourceAddressPrefix: &opt.PrivateIPAddressV4, - SourcePortRange: to.StringPtr("*"), - DestinationAddressPrefix: to.StringPtr("*"), - DestinationPortRange: to.StringPtr("*"), - Access: network.SecurityRuleAccessDeny, - Direction: network.SecurityRuleDirectionOutbound, - Priority: to.Int32Ptr(1000), - Description: to.StringPtr("Bastion egress deny ipv4"), + SourcePortRange: to.Ptr("*"), + DestinationAddressPrefix: to.Ptr("*"), + DestinationPortRange: to.Ptr("*"), + Access: to.Ptr(armnetwork.SecurityRuleAccessDeny), + Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), + Priority: to.Ptr(int32(1000)), + Description: to.Ptr("Bastion egress deny ipv4"), }, } } -func nsgEgressAllowSSHToWorkerIPv4(opt *Options) network.SecurityRule { - return network.SecurityRule{ - Name: to.StringPtr(NSGEgressAllowOnlyResourceName(opt.BastionInstanceName)), - SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{ - Protocol: network.SecurityRuleProtocolTCP, +func nsgEgressAllowSSHToWorkerIPv4(opt *Options) *armnetwork.SecurityRule { + return &armnetwork.SecurityRule{ + Name: to.Ptr(NSGEgressAllowOnlyResourceName(opt.BastionInstanceName)), + Properties: &armnetwork.SecurityRulePropertiesFormat{ + Protocol: to.Ptr(armnetwork.SecurityRuleProtocolTCP), SourceAddressPrefix: &opt.PrivateIPAddressV4, - SourcePortRange: to.StringPtr("*"), - DestinationAddressPrefixes: to.StringSlicePtr(opt.WorkersCIDR), - DestinationPortRange: to.StringPtr(SSHPort), - Access: network.SecurityRuleAccessAllow, - Direction: network.SecurityRuleDirectionOutbound, - Priority: to.Int32Ptr(401), - Description: to.StringPtr("Allow Bastion egress to Shoot workers ipv4"), + SourcePortRange: to.Ptr("*"), + DestinationAddressPrefixes: to.SliceOfPtrs(opt.WorkersCIDR...), + DestinationPortRange: to.Ptr(SSHPort), + Access: to.Ptr(armnetwork.SecurityRuleAccessAllow), + Direction: to.Ptr(armnetwork.SecurityRuleDirectionOutbound), + Priority: to.Ptr(int32(401)), + Description: to.Ptr("Allow Bastion egress to Shoot workers ipv4"), }, } } diff --git a/pkg/controller/dnsrecord/actuator.go b/pkg/controller/dnsrecord/actuator.go index e12f77fa5..f891a29aa 100644 --- a/pkg/controller/dnsrecord/actuator.go +++ b/pkg/controller/dnsrecord/actuator.go @@ -56,18 +56,17 @@ func NewActuator(client client.Client, azureClientFactory azureclient.Factory) d func (a *actuator) InjectClient(client client.Client) error { a.client = client - a.azureClientFactory = azureclient.NewAzureClientFactory(client) return nil } // Reconcile reconciles the DNSRecord. func (a *actuator) Reconcile(ctx context.Context, log logr.Logger, dns *extensionsv1alpha1.DNSRecord, cluster *extensionscontroller.Cluster) error { // Create Azure DNS zone and recordset clients - dnsZoneClient, err := a.azureClientFactory.DNSZone(ctx, dns.Spec.SecretRef) + dnsZoneClient, err := a.azureClientFactory.DNSZone() if err != nil { return util.DetermineError(fmt.Errorf("could not create Azure DNS zone client: %+v", err), helper.KnownCodes) } - dnsRecordSetClient, err := a.azureClientFactory.DNSRecordSet(ctx, dns.Spec.SecretRef) + dnsRecordSetClient, err := a.azureClientFactory.DNSRecordSet() if err != nil { return util.DetermineError(fmt.Errorf("could not create Azure DNS recordset client: %+v", err), helper.KnownCodes) } @@ -109,11 +108,11 @@ func (a *actuator) Reconcile(ctx context.Context, log logr.Logger, dns *extensio // Delete deletes the DNSRecord. func (a *actuator) Delete(ctx context.Context, log logr.Logger, dns *extensionsv1alpha1.DNSRecord, cluster *extensionscontroller.Cluster) error { // Create Azure DNS zone and recordset clients - dnsZoneClient, err := a.azureClientFactory.DNSZone(ctx, dns.Spec.SecretRef) + dnsZoneClient, err := a.azureClientFactory.DNSZone() if err != nil { return util.DetermineError(fmt.Errorf("could not create Azure DNS zone client: %+v", err), helper.KnownCodes) } - dnsRecordSetClient, err := a.azureClientFactory.DNSRecordSet(ctx, dns.Spec.SecretRef) + dnsRecordSetClient, err := a.azureClientFactory.DNSRecordSet() if err != nil { return util.DetermineError(fmt.Errorf("could not create Azure DNS recordset client: %+v", err), helper.KnownCodes) } @@ -155,7 +154,7 @@ func (a *actuator) getZone(ctx context.Context, log logr.Logger, dns *extensions default: // The zone is not specified in the resource status or spec. Try to determine the zone by // getting all zones of the account and searching for the longest zone name that is a suffix of dns.spec.Name - zones, err := dnsZoneClient.GetAll(ctx) + zones, err := dnsZoneClient.List(ctx) if err != nil { return "", &reconcilerutils.RequeueAfterError{ Cause: fmt.Errorf("could not get DNS zones: %+v", err), diff --git a/pkg/controller/dnsrecord/actuator_test.go b/pkg/controller/dnsrecord/actuator_test.go index bb5f1ac47..d74223b60 100644 --- a/pkg/controller/dnsrecord/actuator_test.go +++ b/pkg/controller/dnsrecord/actuator_test.go @@ -107,9 +107,9 @@ var _ = Describe("Actuator", func() { Describe("#Reconcile", func() { It("should reconcile the DNSRecord", func() { - azureClientFactory.EXPECT().DNSZone(ctx, dns.Spec.SecretRef).Return(azureDNSZoneClient, nil) - azureClientFactory.EXPECT().DNSRecordSet(ctx, dns.Spec.SecretRef).Return(azureDNSRecordSetClient, nil) - azureDNSZoneClient.EXPECT().GetAll(ctx).Return(zones, nil) + azureClientFactory.EXPECT().DNSZone().Return(azureDNSZoneClient, nil) + azureClientFactory.EXPECT().DNSRecordSet().Return(azureDNSRecordSetClient, nil) + azureDNSZoneClient.EXPECT().List(ctx).Return(zones, nil) azureDNSRecordSetClient.EXPECT().CreateOrUpdate(ctx, zone, domainName, string(extensionsv1alpha1.DNSRecordTypeA), []string{address}, int64(120)).Return(nil) azureDNSRecordSetClient.EXPECT().Delete(ctx, zone, "comment-"+domainName, "TXT").Return(nil) sw.EXPECT().Patch(ctx, gomock.AssignableToTypeOf(&extensionsv1alpha1.DNSRecord{}), gomock.Any()).DoAndReturn( @@ -130,8 +130,8 @@ var _ = Describe("Actuator", func() { It("should delete the DNSRecord", func() { dns.Status.Zone = pointer.String(zone) - azureClientFactory.EXPECT().DNSZone(ctx, dns.Spec.SecretRef).Return(azureDNSZoneClient, nil) - azureClientFactory.EXPECT().DNSRecordSet(ctx, dns.Spec.SecretRef).Return(azureDNSRecordSetClient, nil) + azureClientFactory.EXPECT().DNSZone().Return(azureDNSZoneClient, nil) + azureClientFactory.EXPECT().DNSRecordSet().Return(azureDNSRecordSetClient, nil) azureDNSRecordSetClient.EXPECT().Delete(ctx, zone, domainName, string(extensionsv1alpha1.DNSRecordTypeA)).Return(nil) err := a.Delete(ctx, logger, dns, nil) diff --git a/pkg/controller/infrastructure/actuator.go b/pkg/controller/infrastructure/actuator.go index cb1add0d9..53997d78d 100644 --- a/pkg/controller/infrastructure/actuator.go +++ b/pkg/controller/infrastructure/actuator.go @@ -16,18 +16,19 @@ package infrastructure import ( "context" - "encoding/json" - "github.com/gardener/gardener/extensions/pkg/controller" "github.com/gardener/gardener/extensions/pkg/controller/common" "github.com/gardener/gardener/extensions/pkg/controller/infrastructure" - "github.com/gardener/gardener/extensions/pkg/terraformer" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" - api "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" - infrainternal "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" +) + +const ( + // AnnotationKeyUseFlow is the annotation key used to enable reconciliation with flow instead of terraformer. + AnnotationKeyUseFlow = "azure.provider.extensions.gardener.cloud/use-flow" ) // InfrastructureState represents the last known State of an Infrastructure resource. @@ -51,38 +52,9 @@ func NewActuator(disableProjectedTokenMount bool) infrastructure.Actuator { } } -func (a *actuator) updateProviderStatus(ctx context.Context, tf terraformer.Terraformer, infra *extensionsv1alpha1.Infrastructure, config *api.InfrastructureConfig, cluster *controller.Cluster) error { - status, err := infrainternal.ComputeStatus(ctx, tf, infra, config, cluster) - if err != nil { - return err - } - - terraformState, err := tf.GetRawState(ctx) - if err != nil { - return err - } - - stateByte, err := terraformState.Marshal() - if err != nil { - return err - } - - infraState := &InfrastructureState{ - SavedProviderStatus: &runtime.RawExtension{ - Object: status, - }, - TerraformState: &runtime.RawExtension{ - Raw: stateByte, - }, - } - - infraStateBytes, err := json.Marshal(infraState) - if err != nil { - return err - } - +func patchProviderStatusAndState(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, status *v1alpha1.InfrastructureStatus, infraStateBytes []byte, actuatorClient client.Client) error { patch := client.MergeFrom(infra.DeepCopy()) infra.Status.ProviderStatus = &runtime.RawExtension{Object: status} infra.Status.State = &runtime.RawExtension{Raw: infraStateBytes} - return a.Client().Status().Patch(ctx, infra, patch) + return actuatorClient.Status().Patch(ctx, infra, patch) } diff --git a/pkg/controller/infrastructure/actuator_delete.go b/pkg/controller/infrastructure/actuator_delete.go index be16922d4..974f9f01a 100644 --- a/pkg/controller/infrastructure/actuator_delete.go +++ b/pkg/controller/infrastructure/actuator_delete.go @@ -16,19 +16,19 @@ package infrastructure import ( "context" + "fmt" "github.com/gardener/gardener/extensions/pkg/controller" "github.com/gardener/gardener/extensions/pkg/terraformer" "github.com/gardener/gardener/extensions/pkg/util" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" "github.com/go-logr/logr" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/helper" azureclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" - "github.com/gardener/gardener-extension-provider-azure/pkg/internal" - "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" ) var ( @@ -36,68 +36,38 @@ var ( NewAzureClientFactory = newAzureClientFactory ) -func newAzureClientFactory(client client.Client) azureclient.Factory { - return azureclient.NewAzureClientFactory(client) +func newAzureClientFactory(ctx context.Context, client client.Client, secretRef v1.SecretReference) (azureclient.Factory, error) { + return azureclient.NewAzureClientFactory(ctx, client, secretRef) } // Delete implements infrastructure.Actuator. func (a *actuator) Delete(ctx context.Context, log logr.Logger, infra *extensionsv1alpha1.Infrastructure, cluster *controller.Cluster) error { - tf, err := internal.NewTerraformer(log, a.RESTConfig(), infrastructure.TerraformerPurpose, infra, a.disableProjectedTokenMount) - if err != nil { - return util.DetermineError(err, helper.KnownCodes) - } - - // terraform pod from previous reconciliation might still be running, ensure they are gone before doing any operations - if err := tf.EnsureCleanedUp(ctx); err != nil { - return err - } - config, err := helper.InfrastructureConfigFromInfrastructure(infra) if err != nil { return err } - azureClientFactory := NewAzureClientFactory(a.Client()) - resourceGroupExists, err := infrastructure.IsShootResourceGroupAvailable(ctx, azureClientFactory, infra, config) + selector := StrategySelector{} + useFlow, err := selector.ShouldDeleteWithFlow(infra.Status) if err != nil { - if azureclient.IsAzureAPIUnauthorized(err) { - log.Error(err, "Failed to check resource group availability due to invalid credentials") - } else { - return err - } + return util.DetermineError(err, helper.KnownCodes) } - - if !resourceGroupExists { - if !azureclient.IsAzureAPIUnauthorized(err) { - if err := infrastructure.DeleteNodeSubnetIfExists(ctx, azureClientFactory, infra, config); err != nil { - return err - } + var reconciler Reconciler + if useFlow { + if err := cleanupTerraform(ctx, log, a, infra); err != nil { + return fmt.Errorf("failed to cleanup terraform resources: %w", err) } - - if err := tf.RemoveTerraformerFinalizerFromConfig(ctx); err != nil { + reconciler, err = NewFlowReconciler(ctx, a, infra, log) + if err != nil { return err } - - return tf.CleanupConfiguration(ctx) - } - - // If the Terraform state is empty then we can exit early as we didn't create anything. Though, we clean up potentially - // created configmaps/secrets related to the Terraformer. - stateIsEmpty := tf.IsStateEmpty(ctx) - if stateIsEmpty { - log.Info("exiting early as infrastructure state is empty - nothing to do") - return tf.CleanupConfiguration(ctx) - } - - terraformFiles, err := infrastructure.RenderTerraformerTemplate(infra, config, cluster) - if err != nil { - return util.DetermineError(err, helper.KnownCodes) + } else { + reconciler, err = NewTerraformReconciler(a, log, terraformer.StateConfigMapInitializerFunc(NoOpStateInitializer)) + if err != nil { + return fmt.Errorf("failed to initialize terraform reconciler: %w", err) + } } - - return util.DetermineError(tf. - InitializeWith(ctx, terraformer.DefaultInitializer(a.Client(), terraformFiles.Main, terraformFiles.Variables, terraformFiles.TFVars, terraformer.StateConfigMapInitializerFunc(NoOpStateInitializer))). - SetEnvVars(internal.TerraformerEnvVars(infra.Spec.SecretRef)...). - Destroy(ctx), helper.KnownCodes) + return util.DetermineError(reconciler.Delete(ctx, infra, config, cluster), helper.KnownCodes) } // NoOpStateInitializer is a no-op StateConfigMapInitializerFunc. diff --git a/pkg/controller/infrastructure/actuator_migrate.go b/pkg/controller/infrastructure/actuator_migrate.go index d788e6ea1..3f7bcfdd8 100644 --- a/pkg/controller/infrastructure/actuator_migrate.go +++ b/pkg/controller/infrastructure/actuator_migrate.go @@ -23,19 +23,12 @@ import ( "github.com/go-logr/logr" "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/helper" - "github.com/gardener/gardener-extension-provider-azure/pkg/internal" - "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" ) // Migrate implements infrastructure.Actuator. func (a *actuator) Migrate(ctx context.Context, log logr.Logger, infra *extensionsv1alpha1.Infrastructure, cluster *controller.Cluster) error { - tf, err := internal.NewTerraformer(log, a.RESTConfig(), infrastructure.TerraformerPurpose, infra, a.disableProjectedTokenMount) - if err != nil { + if err := cleanupTerraform(ctx, log, a, infra); err != nil { return util.DetermineError(err, helper.KnownCodes) } - - if err := tf.CleanupConfiguration(ctx); err != nil { - return err - } - return tf.RemoveTerraformerFinalizerFromConfig(ctx) + return nil } diff --git a/pkg/controller/infrastructure/actuator_reconcile.go b/pkg/controller/infrastructure/actuator_reconcile.go index 6754c5c53..87876fa15 100644 --- a/pkg/controller/infrastructure/actuator_reconcile.go +++ b/pkg/controller/infrastructure/actuator_reconcile.go @@ -16,11 +16,9 @@ package infrastructure import ( "context" - "fmt" "github.com/gardener/gardener/extensions/pkg/controller" "github.com/gardener/gardener/extensions/pkg/terraformer" - "github.com/gardener/gardener/extensions/pkg/util" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" "github.com/go-logr/logr" @@ -39,23 +37,37 @@ func (a *actuator) reconcile(ctx context.Context, logger logr.Logger, infra *ext if err != nil { return err } - - terraformFiles, err := infrastructure.RenderTerraformerTemplate(infra, config, cluster) + factory := ReconcilerFactoryImpl{ + ctx: ctx, + log: logger, + a: a, + infra: infra, + stateInitializer: stateInitializer, + } + strategy := StrategySelector{ + Factory: factory, + Client: a.Client(), + } + useFlow, err := strategy.ShouldReconcileWithFlow(infra, cluster) if err != nil { return err } + return strategy.Reconcile(useFlow, ctx, infra, config, cluster) +} - tf, err := internal.NewTerraformerWithAuth(logger, a.RESTConfig(), infrastructure.TerraformerPurpose, infra, a.disableProjectedTokenMount) +func cleanupTerraform(ctx context.Context, logger logr.Logger, a *actuator, infra *extensionsv1alpha1.Infrastructure) error { + tf, err := internal.NewTerraformer(logger, a.RESTConfig(), infrastructure.TerraformerPurpose, infra, a.disableProjectedTokenMount) if err != nil { - return util.DetermineError(err, helper.KnownCodes) + return err + } + // terraform pod from previous reconciliation might still be running, ensure they are gone before doing any operations + if err := tf.EnsureCleanedUp(ctx); err != nil { + return err } - if err := tf. - InitializeWith(ctx, terraformer.DefaultInitializer(a.Client(), terraformFiles.Main, terraformFiles.Variables, terraformFiles.TFVars, stateInitializer)). - Apply(ctx); err != nil { - - return util.DetermineError(fmt.Errorf("failed to apply the terraform config: %w", err), helper.KnownCodes) + if err := tf.CleanupConfiguration(ctx); err != nil { + return err } - return a.updateProviderStatus(ctx, tf, infra, config, cluster) + return tf.RemoveTerraformerFinalizerFromConfig(ctx) } diff --git a/pkg/controller/infrastructure/actuator_test.go b/pkg/controller/infrastructure/actuator_test.go index d7736f081..6285746b3 100644 --- a/pkg/controller/infrastructure/actuator_test.go +++ b/pkg/controller/infrastructure/actuator_test.go @@ -20,7 +20,7 @@ import ( "errors" "net/http" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/Azure/go-autorest/autorest" "github.com/gardener/gardener/extensions/pkg/controller/infrastructure" "github.com/gardener/gardener/extensions/pkg/terraformer" @@ -34,7 +34,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -217,23 +217,23 @@ var _ = Describe("Actuator", func() { Describe("#Delete", func() { var ( azureClientFactory *azureclientmocks.MockFactory - azureGroupClient *azureclientmocks.MockGroup + azureGroupClient *azureclientmocks.MockResourceGroup resourceGroupName string ) BeforeEach(func() { azureClientFactory = azureclientmocks.NewMockFactory(ctrl) - azureGroupClient = azureclientmocks.NewMockGroup(ctrl) + azureGroupClient = azureclientmocks.NewMockResourceGroup(ctrl) resourceGroupName = infra.Namespace - NewAzureClientFactory = func(c client.Client) azureclient.Factory { - return azureClientFactory + NewAzureClientFactory = func(context.Context, client.Client, v1.SecretReference) (azureclient.Factory, error) { + return azureClientFactory, nil } }) It("should delete the Infrastructure", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) - azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&resources.Group{Name: &resourceGroupName}, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) + azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&armresources.ResourceGroup{Name: &resourceGroupName}, nil) tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().IsStateEmpty(ctx).Return(false) @@ -247,7 +247,7 @@ var _ = Describe("Actuator", func() { }) It("should delete the Infrastructure with invalid credentials", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(nil, autorest.DetailedError{Response: &http.Response{StatusCode: http.StatusUnauthorized}}) tf.EXPECT().EnsureCleanedUp(ctx) @@ -259,8 +259,8 @@ var _ = Describe("Actuator", func() { }) It("should exit early if the Infrastructure's terraform state is empty", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) - azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&resources.Group{Name: &resourceGroupName}, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) + azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&armresources.ResourceGroup{Name: &resourceGroupName}, nil) tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().IsStateEmpty(ctx).Return(true) @@ -286,8 +286,8 @@ var _ = Describe("Actuator", func() { }) It("should return error if terraform state is empty and cleaning up the terraform config fails", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) - azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&resources.Group{Name: &resourceGroupName}, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) + azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&armresources.ResourceGroup{Name: &resourceGroupName}, nil) tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().IsStateEmpty(ctx).Return(true) @@ -297,8 +297,8 @@ var _ = Describe("Actuator", func() { }) It("should return an error if terraform can not be destroyed", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) - azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&resources.Group{Name: &resourceGroupName}, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) + azureGroupClient.EXPECT().Get(ctx, infra.Namespace).Return(&armresources.ResourceGroup{Name: &resourceGroupName}, nil) tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().IsStateEmpty(ctx).Return(false) @@ -425,6 +425,7 @@ var _ = Describe("Actuator", func() { Describe("#Migrate", func() { It("should migrate the Infrastructure", func() { + tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().CleanupConfiguration(ctx) tf.EXPECT().RemoveTerraformerFinalizerFromConfig(ctx) err := a.Migrate(ctx, log, infra, cluster) @@ -442,12 +443,14 @@ var _ = Describe("Actuator", func() { }) It("should return error if cleaning up terraform configuration fails", func() { + tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().CleanupConfiguration(ctx).Return(errors.New("could not clean up terraform config")) err := a.Migrate(ctx, log, infra, cluster) Expect(err).To(HaveOccurred()) }) It("should return error if removal of finalizers on terraform resources fails", func() { + tf.EXPECT().EnsureCleanedUp(ctx) tf.EXPECT().CleanupConfiguration(ctx) tf.EXPECT().RemoveTerraformerFinalizerFromConfig(ctx).Return(errors.New("could not clean up finalizers")) err := a.Migrate(ctx, log, infra, cluster) @@ -496,7 +499,7 @@ func createInfra(providerConfig *api.InfrastructureConfig) (*extensionsv1alpha1. Type: azure.Type, ProviderConfig: &runtime.RawExtension{Raw: providerConfigBytes}, }, - SecretRef: corev1.SecretReference{ + SecretRef: v1.SecretReference{ Name: "foo", }, Region: region, diff --git a/pkg/controller/infrastructure/flowreconciler.go b/pkg/controller/infrastructure/flowreconciler.go new file mode 100644 index 000000000..db445345e --- /dev/null +++ b/pkg/controller/infrastructure/flowreconciler.go @@ -0,0 +1,78 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infrastructure + +import ( + "context" + "fmt" + "strings" + + "github.com/gardener/gardener/extensions/pkg/controller" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/go-logr/logr" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + azureclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" +) + +type Reconciler interface { + Reconcile(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) (*v1alpha1.InfrastructureStatus, error) + GetState(ctx context.Context, status *v1alpha1.InfrastructureStatus) ([]byte, error) + Delete(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) error +} + +type ReconcilerFactory interface { + Build(useFlow bool) (Reconciler, error) +} + +// HasFlowAnnotation returns true if the new flow reconciler should be used for the reconciliation. +func HasFlowAnnotation(infrastructure *extensionsv1alpha1.Infrastructure, cluster *controller.Cluster) bool { + shootAnnotation := (infrastructure.Annotations != nil && strings.EqualFold(infrastructure.Annotations[AnnotationKeyUseFlow], "true")) || + (cluster.Shoot != nil && cluster.Shoot.Annotations != nil && strings.EqualFold(cluster.Shoot.Annotations[AnnotationKeyUseFlow], "true")) + + seedAnnotation := (cluster.Seed != nil && cluster.Seed.Annotations != nil && strings.EqualFold(cluster.Seed.Annotations[AnnotationKeyUseFlow], "true")) + return shootAnnotation || seedAnnotation +} + +// NewFlowReconciler creates a new flow reconciler. +func NewFlowReconciler(ctx context.Context, a *actuator, infra *extensionsv1alpha1.Infrastructure, logger logr.Logger) (Reconciler, error) { + client := a.Client() + if client == nil { + return nil, fmt.Errorf("infrastructure actuator has no client set") + } + auth, err := internal.GetClientAuthData(ctx, client, infra.Spec.SecretRef, false) + if err != nil { + return nil, err + } + factory, err := azureclient.NewAzureClientFactoryWithAuth(auth, client) + if err != nil { + return nil, err + } + reconciler := infraflow.NewFlowReconciler(factory, logger) + return &FlowReconcilerAdapter{reconciler}, nil +} + +type FlowReconcilerAdapter struct { + *infraflow.FlowReconciler +} + +func (f *FlowReconcilerAdapter) GetState(ctx context.Context, status *v1alpha1.InfrastructureStatus) ([]byte, error) { + emptyState := shared.NewPersistentState() + return emptyState.ToJSON() +} diff --git a/pkg/controller/infrastructure/infraflow/azreconciler.go b/pkg/controller/infrastructure/infraflow/azreconciler.go new file mode 100644 index 000000000..979958754 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/azreconciler.go @@ -0,0 +1,431 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/gardener/gardener/extensions/pkg/controller" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "k8s.io/utils/pointer" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" +) + +// azureReconciler allows to reconcile the individual cloud resources +type azureReconciler struct { + tf TerraformAdapter + factory client.Factory +} + +// NewAzureReconciler creates a new azureReconciler +func NewAzureReconciler(infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster, factory client.Factory) (*azureReconciler, error) { + tfAdapter, err := NewTerraformAdapter(infra, cfg, cluster) + return &azureReconciler{tf: tfAdapter, factory: factory}, err +} + +// GetInfrastructureStatus returns the infrastructure status +func (f azureReconciler) GetInfrastructureStatus(ctx context.Context) (*v1alpha1.InfrastructureStatus, error) { + status := f.tf.StaticInfrastructureStatus() + err := f.enrichStatusWithIdentity(ctx, status) + if err != nil { + return status, err + } + err = f.enrichStatusWithAvailabilitySet(ctx, status) + if err != nil { + return status, err + } + return status, nil +} + +func (f azureReconciler) enrichStatusWithAvailabilitySet(ctx context.Context, status *v1alpha1.InfrastructureStatus) error { + if f.tf.isCreate(AvailabilitySet) { + client, err := f.factory.AvailabilitySet() + if err != nil { + return err + } + avset := f.tf.AvailabilitySet() + res, err := client.Get(ctx, f.tf.ResourceGroup(), avset.Name) + if err != nil { + return err + } + status.AvailabilitySets = append(status.AvailabilitySets, v1alpha1.AvailabilitySet{ + Name: avset.Name, + ID: *res.ID, + CountFaultDomains: pointer.Int32Ptr(avset.CountFaultDomains), + CountUpdateDomains: pointer.Int32Ptr(avset.CountUpdateDomains), + Purpose: v1alpha1.PurposeNodes, + }) + } + return nil +} + +func (f azureReconciler) enrichStatusWithIdentity(ctx context.Context, status *v1alpha1.InfrastructureStatus) error { + if identity := f.tf.Identity(); identity != nil { + client, err := f.factory.ManagedUserIdentity() + if err != nil { + return err + } + res, err := client.Get(ctx, identity.ResourceGroup, identity.Name) + if err != nil { + return err + } + if res.ID == nil || res.ClientID == nil { + return nil + } + + status.Identity = &v1alpha1.IdentityStatus{ + ID: *res.ID, + ClientID: res.ClientID.String(), + } + } + return nil +} + +// Delete deletes all resources managed by the reconciler +func (f azureReconciler) Delete(ctx context.Context) error { + if err := f.deleteSubnetsInForeignGroup(ctx); err != nil { + return fmt.Errorf("failed to delete foreign subnet: %w", err) + } + return f.deleteResourceGroup(ctx) +} + +func (f azureReconciler) deleteResourceGroup(ctx context.Context) error { + client, err := f.factory.Group() + if err != nil { + return err + } + return client.Delete(ctx, f.tf.ResourceGroup()) +} + +// deleteSubnetsInForeignGroup deletes all managed subnets in a foreign resource group +func (f azureReconciler) deleteSubnetsInForeignGroup(ctx context.Context) error { + if !f.tf.isCreate(Vnet) { + subnetClient, err := f.factory.Subnet() + if err != nil { + return err + } + subnets := f.tf.Zones() + for _, subnet := range subnets { + resourceGroup := *f.tf.Vnet().ResourceGroup() // safe because we manage a foreign vnet + err := subnetClient.Delete(ctx, resourceGroup, f.tf.Vnet().Name(), subnet.SubnetName()) + if err != nil { + return err + } + } + if err != nil { + return fmt.Errorf("failed to delete foreign subnet: %w", err) + } + } + return nil +} + +// EnsureVnet creates or updates a Vnet +func (f azureReconciler) EnsureVnet(ctx context.Context) error { + if f.tf.isCreate(Vnet) { + client, err := f.factory.Vnet() + if err != nil { + return err + } + parameters := armnetwork.VirtualNetwork{ + Location: to.Ptr(f.tf.Region()), + Properties: &armnetwork.VirtualNetworkPropertiesFormat{ + AddressSpace: &armnetwork.AddressSpace{}, + }, + } + + cidr := f.tf.Vnet().Cidr() // only supports single cidr range + if cidr != nil { + parameters.Properties.AddressSpace.AddressPrefixes = []*string{cidr} + } + + ddosId := f.tf.Vnet().DDosProtectionPlanID() + if ddosId != nil { + parameters.Properties.EnableDdosProtection = to.Ptr(true) + parameters.Properties.DdosProtectionPlan = &armnetwork.SubResource{ID: ddosId} + } + _, err = client.CreateOrUpdate(ctx, f.tf.ResourceGroup(), f.tf.Vnet().Name(), parameters) + return err + } else { + return nil // TODO update foreign vnet? + } +} + +// EnsureRouteTables creates or updates a RouteTable +func (f azureReconciler) EnsureRouteTables(ctx context.Context) (armnetwork.RouteTable, error) { + client, err := f.factory.RouteTables() + if err != nil { + return armnetwork.RouteTable{}, err + } + parameters := armnetwork.RouteTable{ + Location: to.Ptr(f.tf.Region()), + } + resp, err := client.CreateOrUpdate(ctx, f.tf.ResourceGroup(), f.tf.RouteTableName(), parameters) + + return *resp, err +} + +// EnsureSecurityGroups creates or updates a SecurityGroup +func (f azureReconciler) EnsureSecurityGroups(ctx context.Context) (*armnetwork.SecurityGroup, error) { + client, err := f.factory.NetworkSecurityGroup() + if err != nil { + return nil, err + } + parameters := armnetwork.SecurityGroup{ + Location: to.Ptr(f.tf.Region()), + } + resp, err := client.CreateOrUpdate(ctx, f.tf.ResourceGroup(), f.tf.SecurityGroupName(), parameters) + return resp, err +} + +// EnsureAvailabilitySet creates or updates an AvailabilitySet +func (f azureReconciler) EnsureAvailabilitySet(ctx context.Context) error { + if f.tf.isCreate(AvailabilitySet) { + asClient, err := f.factory.AvailabilitySet() + if err != nil { + return err + } + avset := f.tf.AvailabilitySet() + parameters := armcompute.AvailabilitySet{ + Location: to.Ptr(f.tf.Region()), + Properties: &armcompute.AvailabilitySetProperties{ + PlatformFaultDomainCount: to.Ptr(avset.CountFaultDomains), + PlatformUpdateDomainCount: to.Ptr(avset.CountUpdateDomains), + }, + SKU: &armcompute.SKU{Name: to.Ptr(string(armcompute.AvailabilitySetSKUTypesAligned))}, // equal to managed = True in tf + } + _, err = asClient.CreateOrUpdate(ctx, f.tf.ResourceGroup(), avset.Name, parameters) + return err + } else { + return nil // TODO update foreign avset? + } +} + +// EnsurePublicIPs creates or updates PublicIPs for the NATs +func (f azureReconciler) EnsurePublicIPs(ctx context.Context) (map[string][]*armnetwork.PublicIPAddress, error) { + res := make(map[string][]*armnetwork.PublicIPAddress) + client, err := f.factory.PublicIP() + if err != nil { + return res, err + } + err = f.deleteOldNatIPs(ctx, client) + if err != nil { + return res, err + } + ips := f.tf.EnabledNats() + if len(ips) == 0 { + return res, nil + } + for _, ip := range ips { + params := armnetwork.PublicIPAddress{ + Location: to.Ptr(f.tf.Region()), + SKU: &armnetwork.PublicIPAddressSKU{Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard)}, + Properties: &armnetwork.PublicIPAddressPropertiesFormat{ + PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), + }, + } + if ip.Zone() != nil { + params.Zones = []*string{ip.Zone()} + } + resp, err := client.CreateOrUpdate(ctx, f.tf.ResourceGroup(), ip.IpName(), params) + if err != nil { + return res, err + } + res[ip.SubnetName()] = append(res[ip.SubnetName()], resp) + + } + return res, nil +} + +// EnrichResponseWithUserManagedIPs adds the IDs of user managed IPs to the input map of associated IPs of the NATs +func (f azureReconciler) EnrichResponseWithUserManagedIPs(ctx context.Context, res map[string][]*armnetwork.PublicIPAddress) error { + ips := f.tf.UserManagedIPs() + if len(ips) == 0 { + return nil + } + client, err := f.factory.PublicIP() + if err != nil { + return err + } + for _, ip := range ips { + resp, err := client.Get(ctx, ip.ResourceGroup, ip.Name) + if err == nil { + res[ip.SubnetName] = append(res[ip.SubnetName], &armnetwork.PublicIPAddress{ + ID: resp.ID, + }) + } else { + return err + } + } + return nil +} + +func checkAllZonesWithFn(name string, zones []zoneTf, check func(zone zoneTf, name string) bool) bool { + for _, n := range zones { + if check(n, name) { + return true + } + } + return false +} + +// EnsureNatGateways creates or updates NAT Gateways. It also deletes old NATGateways. +func (f azureReconciler) EnsureNatGateways(ctx context.Context, ips map[string][]*armnetwork.PublicIPAddress) (map[string]*armnetwork.NatGateway, error) { + res := make(map[string]*armnetwork.NatGateway) + client, err := f.factory.NatGateway() + if err != nil { + return res, err + } + err = f.deleteOldNatGateways(ctx, client) + if err != nil { + return res, err + } + for _, nat := range f.tf.EnabledNats() { + resp, err := f.createOrUpdateNatGateway(ctx, nat, ips, client) + if err != nil { + return res, err + } + res[nat.SubnetName()] = resp + } + return res, nil +} + +func (f azureReconciler) createOrUpdateNatGateway(ctx context.Context, nat zoneTf, ips map[string][]*armnetwork.PublicIPAddress, client client.NatGateway) (*armnetwork.NatGateway, error) { + params := armnetwork.NatGateway{ + Properties: &armnetwork.NatGatewayPropertiesFormat{ + IdleTimeoutInMinutes: nat.idleConnectionTimeoutMinutes, + }, + Location: to.Ptr(f.tf.Region()), + SKU: &armnetwork.NatGatewaySKU{Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard)}, + } + ipResources, ok := ips[nat.SubnetName()] + if !ok { + return nil, fmt.Errorf("no public IP found for NAT Gateway %s", nat.NatName()) + } else { + params.Properties.PublicIPAddresses = []*armnetwork.SubResource{} + for _, ip := range ipResources { + params.Properties.PublicIPAddresses = append(params.Properties.PublicIPAddresses, &armnetwork.SubResource{ID: ip.ID}) + } + } + if nat.Zone() != nil { + params.Zones = []*string{nat.Zone()} + } + resp, err := client.CreateOrUpdate(ctx, f.tf.ResourceGroup(), nat.NatName(), params) + if err != nil { + return nil, err + } + return resp, nil +} + +// EnsureResourceGroup creates or updates the resource group +func (f azureReconciler) EnsureResourceGroup(ctx context.Context) error { + rgClient, err := f.factory.Group() + if err != nil { + return err + } + _, err = rgClient.CreateOrUpdate(ctx, f.tf.ResourceGroup(), f.tf.Region()) + return err +} + +// delete IPs of NAT Gateways that got disabled +func (f azureReconciler) deleteOldNatIPs(ctx context.Context, client client.PublicIP) error { + existingIPs, err := client.List(ctx, f.tf.ResourceGroup()) + if err != nil { + return err + } + for _, ip := range existingIPs { + if ip.Name == nil { + continue + } + isIpInNats := checkAllZonesWithFn(*ip.Name, f.tf.EnabledNats(), func(nat zoneTf, name string) bool { return nat.IpName() == name }) + if !isIpInNats { + err := client.Delete(ctx, f.tf.ResourceGroup(), *ip.Name) + if err != nil { + return err + } + } + } + return nil +} + +// delete NAT Gateways that got disabled +func (f azureReconciler) deleteOldNatGateways(ctx context.Context, client client.NatGateway) error { + existingNats, err := client.List(ctx, f.tf.ResourceGroup()) + if err != nil { + return err + } + for _, nat := range existingNats { + if nat.Name == nil { + continue + } + isNatInNats := checkAllZonesWithFn(*nat.Name, f.tf.EnabledNats(), func(nat zoneTf, name string) bool { return nat.NatName() == name }) + if !isNatInNats { + err := client.Delete(ctx, f.tf.ResourceGroup(), *nat.Name) + if err != nil { + return err + } + } + } + return nil +} + +// EnsureSubnets creates or updates subnets +func (f azureReconciler) EnsureSubnets(ctx context.Context, securityGroup armnetwork.SecurityGroup, routeTable armnetwork.RouteTable, nats map[string]*armnetwork.NatGateway) (err error) { + subnetClient, err := f.factory.Subnet() + if err != nil { + return err + } + subnets := f.tf.Zones() + for _, subnet := range subnets { + endpoints := make([]*armnetwork.ServiceEndpointPropertiesFormat, 0) + for _, endpoint := range subnet.serviceEndpoints { + endpoints = append(endpoints, &armnetwork.ServiceEndpointPropertiesFormat{ + Service: to.Ptr(endpoint), + }) + } + + parameters := armnetwork.Subnet{ + Properties: &armnetwork.SubnetPropertiesFormat{ + AddressPrefix: to.Ptr(subnet.cidr), + ServiceEndpoints: endpoints, + NetworkSecurityGroup: &armnetwork.SecurityGroup{ + ID: securityGroup.ID, + }, + RouteTable: &armnetwork.RouteTable{ + ID: routeTable.ID, + }, + }, + } + nat, ok := nats[subnet.SubnetName()] + if ok { + parameters.Properties.NatGateway = &armnetwork.SubResource{ + ID: nat.ID, + } + } + + vnetRgroup := f.tf.Vnet().ResourceGroup() // try to use existing vnet resource + if vnetRgroup == nil { + vnetRgroup = to.Ptr(f.tf.ResourceGroup()) // expect that it was created previously + } + _, err = subnetClient.CreateOrUpdate(ctx, *vnetRgroup, f.tf.Vnet().Name(), subnet.SubnetName(), parameters) + } + return err +} diff --git a/pkg/controller/infrastructure/infraflow/azreconciler_test.go b/pkg/controller/infrastructure/infraflow/azreconciler_test.go new file mode 100644 index 000000000..6cf7f909c --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/azreconciler_test.go @@ -0,0 +1,463 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow_test + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" + "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/gofrs/uuid" + "github.com/golang/mock/gomock" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + mockclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client/mock" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" +) + +func newBasicConfig() *azure.InfrastructureConfig { + return &azure.InfrastructureConfig{ + Networks: azure.NetworkConfig{ + VNet: azure.VNet{ + CIDR: to.Ptr("10.0.0.0/8"), + }, + Workers: to.Ptr("10.0.0.0/16"), + ServiceEndpoints: []string{}, + }, + } + +} + +var _ = Describe("AzureReconciler", func() { + location := "westeurope" + clusterName := "test_cluster" + infra := &v1alpha1.Infrastructure{Spec: v1alpha1.InfrastructureSpec{Region: location}, ObjectMeta: metav1.ObjectMeta{Namespace: clusterName}} + resourceGroupName := infra.Namespace //if not specified this is assumed name "t-i545428" // TODO what if resource group not given? by default Tf uses infra.Namespace + vnetName := infra.Namespace //if not specified this is assumed name "vnet-i545428" + cluster := infrastructure.MakeCluster("11.0.0.0/16", "12.0.0.0/16", infra.Spec.Region, 1, 1) + var factory *mockclient.MockFactory + Describe("Vnet reconcilation", func() { + Context("new vnet", func() { + cfg := newBasicConfig() + It("calls the client with the correct parameters: vnet name, resource group, region ,cidr", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armnetwork.VirtualNetwork{ + Location: to.Ptr(location), + Properties: &armnetwork.VirtualNetworkPropertiesFormat{ + AddressSpace: &armnetwork.AddressSpace{ + AddressPrefixes: []*string{cfg.Networks.VNet.CIDR}, + }, + }, + } + mock.assertVnetCalledWithParameters(vnetName, parameters) + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureVnet(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + Context("with ddosId", func() { + ddosId := "ddos-plan-id" + cfg := newBasicConfig() + cfg.Networks.VNet.DDosProtectionPlanID = to.Ptr(ddosId) + It("calls the client with the correct parameters: vnet name, resource group, region ,cidr, ddos id", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armnetwork.VirtualNetwork{ + Location: to.Ptr(location), + Properties: &armnetwork.VirtualNetworkPropertiesFormat{ + AddressSpace: &armnetwork.AddressSpace{ + AddressPrefixes: []*string{cfg.Networks.VNet.CIDR}, + }, + }, + } + parameters.Properties.DdosProtectionPlan = &armnetwork.SubResource{ID: to.Ptr(ddosId)} + parameters.Properties.EnableDdosProtection = to.Ptr(true) + mock.assertVnetCalledWithParameters(vnetName, parameters) + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureVnet(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + + }) + }) + Context("with existing vnet", func() { + cfg := newBasicConfig() + cfg.Networks.VNet.Name = to.Ptr("existing-vnet") + cfg.Networks.VNet.ResourceGroup = to.Ptr("existing-rg") + It("does not reconcile", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureVnet(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + + }) + }) + }) + Describe("Route table reconcilation", func() { + cfg := newBasicConfig() + It("calls the client with correct route table name", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + //parameters := armnetwork.RouteTable{ + // Location: to.Ptr(location), + // Properties: &armnetwork.RouteTablePropertiesFormat{ + // //AddressSpace: &armnetwork.AddressSpace{ + // // AddressPrefixes: []*string{cfg.Networks.VNet.CIDR}, + // //}, + // }, + //} + mock.assertRouteTableCalled("worker_route_table") + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + _, err = sut.EnsureRouteTables(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + }) + Describe("Security group reconcilation", func() { + cfg := newBasicConfig() + It("calls the client with correct route table name", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + + mock.assertSecurityGroupCalled(clusterName + "-workers") + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + _, err = sut.EnsureSecurityGroups(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + + }) + }) + Describe("Availability set reconcilation", func() { + Context("zoned cluster", func() { + cfg := newBasicConfig() // cannot share varible in describe + cfg.Zoned = true + It("does not create availability set", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + factory = mock.GetFactory() + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureAvailabilitySet(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + }) + Context("non-zoned cluster", func() { + cfg := newBasicConfig() + cfg.Zoned = false + It("create the client with correct availability set name and parameters", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armcompute.AvailabilitySet{ + Location: to.Ptr(location), + Properties: &armcompute.AvailabilitySetProperties{ + PlatformFaultDomainCount: to.Ptr(int32(1)), + PlatformUpdateDomainCount: to.Ptr(int32(1)), + }, + SKU: &armcompute.SKU{Name: to.Ptr(string(armcompute.AvailabilitySetSKUTypesAligned))}, // equal to managed = True in tf + } + mock.assertAvailabilitySetCalledWithParameters("test_cluster-workers", parameters) + + factory = mock.GetFactory() + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureAvailabilitySet(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + }) + }) + Describe("PublicIP reconcilation", func() { + Context("with 2 zones, no NAT enabled and user managed IP", func() { + cfg := newBasicConfig() + cfg.Networks.NatGateway = &azure.NatGatewayConfig{ + Zone: to.Ptr(int32(1)), + Enabled: false, + } + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: false, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16"}} + BeforeEach(func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + mock.assertPublicIPCalledWithoutCreation() + factory = mock.GetFactory() + }) + It("does not create NAT IPs and does not update user-managed public IPs", func() { + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + _, err = sut.EnsurePublicIPs(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + }) + }) + Context("with 2 zones, 1 NAT enabled and user managed IP", func() { + cfg := newBasicConfig() + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16"}} + BeforeEach(func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armnetwork.PublicIPAddress{ + Location: to.Ptr(location), + SKU: &armnetwork.PublicIPAddressSKU{Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard)}, + Properties: &armnetwork.PublicIPAddressPropertiesFormat{ + PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), + }, + Zones: []*string{to.Ptr("1")}, + } + mock.assertPublicIPCalledWithParameters(MatchAnyOfStrings([]string{"test_cluster-nat-gateway-z1-ip"}), parameters) + factory = mock.GetFactory() + }) + It("only creates NAT IP for 1 zone and does not update user-managed public IPs", func() { + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + _, err = sut.EnsurePublicIPs(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + + }) + }) + Context("single zoned with NAT enabled", func() { + cfg := newBasicConfig() + cfg.Networks.NatGateway = &azure.NatGatewayConfig{ + Zone: to.Ptr(int32(1)), + } + BeforeEach(func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armnetwork.PublicIPAddress{ + Location: to.Ptr(location), + SKU: &armnetwork.PublicIPAddressSKU{Name: to.Ptr(armnetwork.PublicIPAddressSKUNameStandard)}, + Properties: &armnetwork.PublicIPAddressPropertiesFormat{ + PublicIPAllocationMethod: to.Ptr(armnetwork.IPAllocationMethodStatic), + }, + } + mock.assertPublicIPCalledWithParameters(MatchAnyOfStrings([]string{"test_cluster-nat-gateway-ip"}), parameters) + factory = mock.GetFactory() + }) + }) + Context("basic config with old ip (not NAT associated IP)", func() { + cfg := newBasicConfig() + It("should delete the old IP in the resource group during reconcilation", func() { + ctrl := gomock.NewController(GinkgoT()) + factory := mockclient.NewMockFactory(ctrl) + ip := mockclient.NewMockPublicIP(ctrl) + ip.EXPECT().List(gomock.Any(), resourceGroupName).Return([]*armnetwork.PublicIPAddress{{Name: to.Ptr("old-ip")}}, nil) + ip.EXPECT().Delete(gomock.Any(), resourceGroupName, "old-ip").Return(fmt.Errorf("delete error to not call create IP in test")) + factory.EXPECT().PublicIP().Return(ip, nil) + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + + _, err = sut.EnsurePublicIPs(context.TODO()) + Expect(err).To(HaveOccurred()) + }) + }) + Describe("Nat gateway reconcilation", func() { + cfg := newBasicConfig() + Context("with 2 zones and 1 with NAT", func() { + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16"}} + ipId := to.Ptr("ip-id") + It("calls the client with correct nat gateway name and parameters", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + parameters := armnetwork.NatGateway{ + Location: to.Ptr(location), + Properties: &armnetwork.NatGatewayPropertiesFormat{ + PublicIPAddresses: []*armnetwork.SubResource{ + { + ID: ipId, + }, + }, + IdleTimeoutInMinutes: nil, + }, + SKU: &armnetwork.NatGatewaySKU{Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard)}, + Zones: []*string{to.Ptr("1")}, + } + mock.assertNatGatewayCalledWithParameters("test_cluster-nat-gateway-z1", parameters) + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + _, err = sut.EnsureNatGateways(context.TODO(), map[string][]*armnetwork.PublicIPAddress{"test_cluster-nodes-z1": {{ + ID: ipId, + }, + }}) + Expect(err).ToNot(HaveOccurred()) + }) + }) + Context("with single subnet and NAT (old nat), then disabled", func() { + cfg := newBasicConfig() + cfg.Networks.NatGateway = &azure.NatGatewayConfig{ + Zone: to.Ptr(int32(1)), + Enabled: true, + } + It("deletes the old NAT during reconcilation", func() { + ctrl := gomock.NewController(GinkgoT()) + factory := mockclient.NewMockFactory(ctrl) + nat := mockclient.NewMockNatGateway(ctrl) + nat.EXPECT().List(gomock.Any(), resourceGroupName).Return([]*armnetwork.NatGateway{{Name: to.Ptr("old-nat")}}, nil) + nat.EXPECT().Delete(gomock.Any(), resourceGroupName, "old-nat").Return(fmt.Errorf("delete error to not call create NAT in test")) + factory.EXPECT().NatGateway().Return(nat, nil) + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + + _, err = sut.EnsureNatGateways(context.TODO(), map[string][]*armnetwork.PublicIPAddress{}) + Expect(err).To(HaveOccurred()) + }) + }) + }) + Describe("Subnet reconcilation", func() { + cfg := newBasicConfig() + Context("with 2 zones", func() { + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16"}} + It("calls the client with correct nat gateway name and parameters", func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + //parameters := armnetwork.NatGateway{ + // Location: to.Ptr(location), + // Properties: &armnetwork.NatGatewayPropertiesFormat{ + // PublicIPAddresses: []*armnetwork.SubResource{ + // { + // ID: to.Ptr("/subscriptions/123/resourceGroups/test_rg/providers/Microsoft.Network/publicIPAddresses/test_cluster-nat-gateway-z1-ip"), + // }, + // }, + // }, + //} + mock.assertSubnetCalled(vnetName, MatchAnyOfStrings([]string{"test_cluster-nodes-z2", "test_cluster-nodes-z1"})).Times(2) + factory = mock.GetFactory() + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + err = sut.EnsureSubnets(context.TODO(), armnetwork.SecurityGroup{}, armnetwork.RouteTable{}, map[string]*armnetwork.NatGateway{}) + Expect(err).ToNot(HaveOccurred()) + + }) + }) + + }) + Describe("Enrich IP reponse", func() { + Context("with 2 zones with user managed IPs for each", func() { + cfg := newBasicConfig() + cfg.Zoned = true + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip1", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip2", ResourceGroup: resourceGroupName}}}}} + + BeforeEach(func() { + mock := NewMockFactoryWrapper(resourceGroupName, location) + mock.assertPublicIPGet(resourceGroupName, MatchAnyOfStrings([]string{"my-ip1", "my-ip2"})).Times(2) + factory = mock.GetFactory() + }) + It("enriches with 2 user managed IPs", func() { + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + res := make(map[string][]*armnetwork.PublicIPAddress) + err = sut.EnrichResponseWithUserManagedIPs(context.TODO(), res) + Expect(err).ToNot(HaveOccurred()) + Expect(res).To(HaveKey("test_cluster-nodes-z1")) + Expect(res).To(HaveKey("test_cluster-nodes-z2")) + }) + }) + }) + Describe("Infrastructure Status", func() { + Context("Basic zonal cluster with 2 zones", func() { + cfg := newBasicConfig() + cfg.Networks.Zones = []azure.Zone{{Name: 1, CIDR: "10.0.0.0/16", NatGateway: &azure.ZonedNatGatewayConfig{Enabled: true, IPAddresses: []azure.ZonedPublicIPReference{{Name: "my-ip", ResourceGroup: resourceGroupName}}}}, {Name: 2, CIDR: "10.1.0.0/16"}} + cfg.Zoned = true + It("returns the correct (static) infrastructure status without AvailabilitySet and identity enrichment", func() { + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + infra, err := sut.GetInfrastructureStatus(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + + Expect(infra.TypeMeta).To(Equal(infrastructure.StatusTypeMeta)) + Expect(infra.ResourceGroup.Name).To(Equal(resourceGroupName)) + Expect(infra.Networks.VNet.Name).To(Not(BeEmpty())) + Expect(infra.RouteTables).To(Not(BeEmpty())) + Expect(infra.SecurityGroups).To(Not(BeEmpty())) + Expect(infra.SecurityGroups).To(Not(BeEmpty())) + Expect(infra.Networks.Subnets).To(HaveLen(2)) + }) + }) + Context("Basic non-zoned cluster with identity", func() { + cfg := newBasicConfig() + cfg.Zoned = false + cfg.Identity = &azure.IdentityConfig{Name: "my-identity", ResourceGroup: resourceGroupName} + + It("enriches the status with the AvailabilitySet and identity", func() { + ctrl := gomock.NewController(GinkgoT()) + aclient := mockclient.NewMockAvailabilitySet(ctrl) + aclient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(&armcompute.AvailabilitySet{ID: to.Ptr("av-id")}, nil) + + iclient := mockclient.NewMockManagedUserIdentity(ctrl) + identity := &msi.Identity{ID: to.Ptr("identity-id"), UserAssignedIdentityProperties: &msi.UserAssignedIdentityProperties{ClientID: to.Ptr(uuid.FromStringOrNil("69359037-9599-48e7-b8f2-48393c019135"))}} + + iclient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(identity, nil) + + factory := mockclient.NewMockFactory(ctrl) + factory.EXPECT().AvailabilitySet().Return(aclient, nil) + factory.EXPECT().ManagedUserIdentity().Return(iclient, nil) + + sut, err := infraflow.NewAzureReconciler(infra, cfg, cluster, factory) + Expect(err).ToNot(HaveOccurred()) + infra, err := sut.GetInfrastructureStatus(context.TODO()) + Expect(err).ToNot(HaveOccurred()) + Expect(infra.AvailabilitySets).To(HaveLen(1)) + Expect(infra.AvailabilitySets[0].ID).To(Equal("av-id")) + + Expect(infra.Identity.ID).To(Equal("identity-id")) + }) + }) + }) + // foreignName := "foreign-name" + // //Expect(err).ToNot(HaveOccurred()) + + // //var cleanupHandle framework.CleanupActionHandle + // //cleanupHandle = framework.AddCleanupAction(func() { + // // Expect(ignoreAzureNotFoundError(teardownResourceGroup(ctx, clientSet, foreignName))).To(Succeed()) + // // framework.RemoveCleanupAction(cleanupHandle) + // //}) + // auth := readAuthFromFile(*secretYamlPath) + // clientId = &auth.ClientID + // clientSecret = &auth.ClientSecret + // subscriptionId = &auth.SubscriptionID + // tenantId = &auth.TenantID + + // Expect(prepareNewResourceGroup(ctx, log, clientSet, foreignName, location)).To(Succeed()) + // Expect(prepareNewIdentity(ctx, log, clientSet, foreignName, foreignName, *region)).To(Succeed()) + + //}) + + }) +}) + +type MatchParameters (armnetwork.VirtualNetwork) + +func (m MatchParameters) Matches(x interface{}) bool { + bytes, _ := armnetwork.VirtualNetwork(m).MarshalJSON() + Otherbytes, _ := x.(armnetwork.VirtualNetwork).MarshalJSON() + println(string(bytes)) + println(string(Otherbytes)) + return string(bytes) == string(Otherbytes) +} + +func (m MatchParameters) String() string { + bytes, _ := armnetwork.VirtualNetwork(m).MarshalJSON() + return string(bytes) +} diff --git a/pkg/controller/infrastructure/infraflow/infraflow_suite_test.go b/pkg/controller/infrastructure/infraflow/infraflow_suite_test.go new file mode 100644 index 000000000..0eacd68b1 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/infraflow_suite_test.go @@ -0,0 +1,27 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestInfraflow(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Infraflow Suite") +} diff --git a/pkg/controller/infrastructure/infraflow/mock_factory_test.go b/pkg/controller/infrastructure/infraflow/mock_factory_test.go new file mode 100644 index 000000000..943118c63 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/mock_factory_test.go @@ -0,0 +1,125 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow_test + +import ( + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/golang/mock/gomock" + . "github.com/onsi/ginkgo/v2" + + mockclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client/mock" +) + +type MatchAnyOfStrings ([]string) + +func (m MatchAnyOfStrings) Matches(x interface{}) bool { + for _, v := range m { + if v == x.(string) { + return true + } + } + return false +} + +func (m MatchAnyOfStrings) String() string { + return fmt.Sprintf("is one of %v", []string(m)) +} + +type MockFactoryWrapper struct { + ctrl *gomock.Controller + *mockclient.MockFactory + resourceGroup string + location string +} + +func (f *MockFactoryWrapper) GetFactory() *mockclient.MockFactory { + return f.MockFactory +} + +func NewMockFactoryWrapper(resourceGroup, location string) *MockFactoryWrapper { + ctrl := gomock.NewController(GinkgoT()) + factory := mockclient.NewMockFactory(ctrl) + return &MockFactoryWrapper{ctrl, factory, resourceGroup, location} +} + +func (f *MockFactoryWrapper) assertAvailabilitySetCalledWithParameters(name string, params interface{}) *gomock.Call { + aset := mockclient.NewMockAvailabilitySet(f.ctrl) + f.EXPECT().AvailabilitySet().Return(aset, nil) + return aset.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, gomock.Any(), params).Return(&armcompute.AvailabilitySet{}, nil) +} + +func (f *MockFactoryWrapper) assertRouteTableCalled(name string) *gomock.Call { + rt := mockclient.NewMockRouteTables(f.ctrl) + f.EXPECT().RouteTables().Return(rt, nil) + return rt.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, name, gomock.Any()).Return( + &armnetwork.RouteTable{ + ID: to.Ptr("routeId"), + }, nil) +} + +func (f *MockFactoryWrapper) assertSecurityGroupCalled(name string) *gomock.Call { + sg := mockclient.NewMockNetworkSecurityGroup(f.ctrl) + f.EXPECT().NetworkSecurityGroup().Return(sg, nil) + return sg.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, name, gomock.Any()).Return(&armnetwork.SecurityGroup{ + ID: to.Ptr("sgId"), + }, nil) +} + +func (f *MockFactoryWrapper) assertVnetCalledWithParameters(name string, params interface{}) *gomock.Call { + vnet := mockclient.NewMockVnet(f.ctrl) + f.EXPECT().Vnet().Return(vnet, nil) + return vnet.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, name, params).Return(nil, nil) +} + +func (f *MockFactoryWrapper) VnetFactoryCalled() *gomock.Call { + vnet := mockclient.NewMockVnet(f.ctrl) + return f.EXPECT().Vnet().Return(vnet, nil) +} + +func (f *MockFactoryWrapper) assertSubnetCalled(vnetName string, name interface{}) *gomock.Call { + subnet := mockclient.NewMockSubnet(f.ctrl) + f.EXPECT().Subnet().Return(subnet, nil) + return subnet.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, vnetName, name, gomock.Any()).Return(nil, nil) +} + +func (f *MockFactoryWrapper) assertNatGatewayCalledWithParameters(name string, params interface{}) *gomock.Call { + nat := mockclient.NewMockNatGateway(f.ctrl) + f.EXPECT().NatGateway().Return(nat, nil) + nat.EXPECT().List(gomock.Any(), f.resourceGroup).Return([]*armnetwork.NatGateway{}, nil).AnyTimes() // simple fake (deletion not tested in mocks) + return nat.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, name, params).Return(&armnetwork.NatGateway{ID: to.Ptr("natId")}, nil) +} + +func (f *MockFactoryWrapper) assertPublicIPCalledWithoutCreation() *gomock.Call { + ip := mockclient.NewMockPublicIP(f.ctrl) + f.EXPECT().PublicIP().Return(ip, nil) + return ip.EXPECT().List(gomock.Any(), f.resourceGroup).Return([]*armnetwork.PublicIPAddress{}, nil).AnyTimes() // simple fake (deletion not tested in mocks) +} + +func (f *MockFactoryWrapper) assertPublicIPCalledWithParameters(name interface{}, params interface{}) *gomock.Call { + ip := mockclient.NewMockPublicIP(f.ctrl) + f.EXPECT().PublicIP().Return(ip, nil) + ip.EXPECT().List(gomock.Any(), f.resourceGroup).Return([]*armnetwork.PublicIPAddress{}, nil).AnyTimes() // simple fake (deletion not tested in mocks) + return ip.EXPECT().CreateOrUpdate(gomock.Any(), f.resourceGroup, name, params).Return(&armnetwork.PublicIPAddress{ID: to.Ptr("ipId")}, nil) +} + +func (f *MockFactoryWrapper) assertPublicIPGet(resourceGroup, name interface{}) *gomock.Call { + ip := mockclient.NewMockPublicIP(f.ctrl) + f.EXPECT().PublicIP().Return(ip, nil) + return ip.EXPECT().Get(gomock.Any(), resourceGroup, name).Return(&armnetwork.PublicIPAddress{ID: to.Ptr("my-id")}, nil) +} diff --git a/pkg/controller/infrastructure/infraflow/reconciler.go b/pkg/controller/infrastructure/infraflow/reconciler.go new file mode 100644 index 000000000..013fa5e6e --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/reconciler.go @@ -0,0 +1,197 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow + +import ( + "context" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/gardener/gardener/extensions/pkg/controller" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/gardener/gardener/pkg/utils/flow" + "github.com/go-logr/logr" + "k8s.io/utils/pointer" + logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" +) + +// Key names for the whiteboard object to pass results between the reconcilation tasks +const ( + routeTableID = "route_table_id" + sGroupID = "security_group_id" + natGatewayMap = "nategateway_map" + publicIPMap = "public_ip_map" +) + +// FlowReconciler is the reconciler for all managed resources +type FlowReconciler struct { + factory client.Factory + logger logr.Logger +} + +// NewFlowReconciler creates a new FlowReconciler +func NewFlowReconciler(factory client.Factory, logger logr.Logger) *FlowReconciler { + return &FlowReconciler{ + factory: factory, + logger: logger, + } +} + +// Delete deletes all resources managed by the reconciler +func (f *FlowReconciler) Delete(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) error { + reconciler, err := NewAzureReconciler(infra, cfg, cluster, f.factory) + if err != nil { + return err + } + + graph := flow.NewGraph("Azure infrastructure deletion") + foreignSubnets := f.addTask(graph, "delete subnets in foreign resource group", reconciler.deleteSubnetsInForeignGroup) + f.addTask(graph, "delete resource group", reconciler.deleteResourceGroup, shared.Dependencies(foreignSubnets)) + fl := graph.Compile() + if err := fl.Run(ctx, flow.Opts{}); err != nil { + return flow.Causes(err) + } + return nil +} + +// Reconcile reconciles all resources +func (f *FlowReconciler) Reconcile(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) (*v1alpha1.InfrastructureStatus, error) { + reconciler, err := NewAzureReconciler(infra, cfg, cluster, f.factory) + if err != nil { + return nil, err + } + graph := f.buildReconcileGraph(reconciler) + fl := graph.Compile() + if err := fl.Run(ctx, flow.Opts{}); err != nil { + return nil, flow.Causes(err) + } + return reconciler.GetInfrastructureStatus(ctx) +} + +func (f FlowReconciler) buildReconcileGraph(reconciler *azureReconciler) *flow.Graph { + whiteboard := shared.NewWhiteboard() + + g := flow.NewGraph("Azure infrastructure reconcilation") + resourceGroup := f.addTask(g, "resource group creation", reconciler.EnsureResourceGroup) + + vnet := f.addTask(g, "vnet creation", reconciler.EnsureVnet, shared.Dependencies(resourceGroup)) + + f.addTask(g, "availability set creation", reconciler.EnsureAvailabilitySet, shared.Dependencies(resourceGroup)) + + routeTable := f.addTask(g, "route table creation", func(ctx context.Context) error { + routeTable, err := reconciler.EnsureRouteTables(ctx) + whiteboard.Set(routeTableID, *routeTable.ID) + return err + }, shared.Dependencies(resourceGroup)) + + securityGroup := f.addTask(g, "security group creation", func(ctx context.Context) error { + securityGroup, err := reconciler.EnsureSecurityGroups(ctx) + whiteboard.Set(sGroupID, *securityGroup.ID) + return err + }, shared.Dependencies(resourceGroup)) + + ip := f.addTask(g, "ips creation", func(ctx context.Context) error { + ips, err := reconciler.EnsurePublicIPs(ctx) + if err != nil { + return err + } + err = reconciler.EnrichResponseWithUserManagedIPs(ctx, ips) + if err != nil { + return fmt.Errorf("enrichment with user managed IPs failed: %v", err) + } + whiteboard.SetObject(publicIPMap, ips) + return nil + }, shared.Dependencies(resourceGroup)) + + natGateway := f.addTask(g, "nat gateway creation", func(ctx context.Context) error { + ips := whiteboard.GetObject(publicIPMap).(map[string][]*armnetwork.PublicIPAddress) + resp, err := reconciler.EnsureNatGateways(ctx, ips) + whiteboard.SetObject(natGatewayMap, resp) + return err + }, shared.Dependencies(ip)) + + f.addTask(g, "subnet creation", func(ctx context.Context) error { + routeTable := armnetwork.RouteTable{ + ID: whiteboard.Get(routeTableID), + } + securityGroup := armnetwork.SecurityGroup{ + ID: whiteboard.Get(sGroupID), + } + natGateway := whiteboard.GetObject(natGatewayMap).(map[string]*armnetwork.NatGateway) + return reconciler.EnsureSubnets(ctx, securityGroup, routeTable, natGateway) + }, shared.Dependencies(securityGroup), shared.Dependencies(routeTable), shared.Dependencies(natGateway), shared.Dependencies(vnet)) + return g + +} + +// TODO copy from AWS PR (use taskBuilder component to share?) +// addTask adds a wrapped task for the given task function and options. +func (f FlowReconciler) addTask(g *flow.Graph, name string, fn flow.TaskFn, options ...shared.TaskOption) flow.TaskIDer { + allOptions := shared.TaskOption{} + for _, opt := range options { + if len(opt.Dependencies) > 0 { + allOptions.Dependencies = append(allOptions.Dependencies, opt.Dependencies...) + } + if opt.Timeout > 0 { + allOptions.Timeout = opt.Timeout + } + if opt.DoIf != nil { + condition := true + if allOptions.DoIf != nil { + condition = *allOptions.DoIf + } + condition = condition && *opt.DoIf + allOptions.DoIf = pointer.Bool(condition) + } + } + + tunedFn := fn + if allOptions.DoIf != nil { + tunedFn = tunedFn.DoIf(*allOptions.DoIf) + if !*allOptions.DoIf { + name = "[Skipped] " + name + } + } + if allOptions.Timeout > 0 { + tunedFn = tunedFn.Timeout(allOptions.Timeout) + } + task := flow.Task{ + Name: name, + Fn: f.wrapTaskFn(g.Name(), name, tunedFn), + } + + if len(allOptions.Dependencies) > 0 { + task.Dependencies = flow.NewTaskIDs(allOptions.Dependencies...) + } + + return g.Add(task) +} + +func (f FlowReconciler) wrapTaskFn(flowName, taskName string, fn flow.TaskFn) flow.TaskFn { + return func(ctx context.Context) error { + taskCtx := logf.IntoContext(ctx, f.logger.WithValues("flow", flowName, "task", taskName)) + err := fn(taskCtx) + if err != nil { + // don't wrap error with '%w', as otherwise the error context get lost + err = fmt.Errorf("failed to %s: %s", taskName, err) + } + return err + } +} diff --git a/pkg/controller/infrastructure/infraflow/shared/basic_context.go b/pkg/controller/infrastructure/infraflow/shared/basic_context.go new file mode 100644 index 000000000..a6f0fd961 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/basic_context.go @@ -0,0 +1,177 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/gardener/gardener/pkg/utils/flow" + "github.com/go-logr/logr" + "k8s.io/utils/pointer" + logf "sigs.k8s.io/controller-runtime/pkg/log" +) + +// TaskOption contains options for created flow tasks +type TaskOption struct { + Dependencies []flow.TaskIDer + Timeout time.Duration + DoIf *bool +} + +// Dependencies creates a TaskOption for dependencies +func Dependencies(dependencies ...flow.TaskIDer) TaskOption { + return TaskOption{Dependencies: dependencies} +} + +// Timeout creates a TaskOption for Timeout +func Timeout(timeout time.Duration) TaskOption { + return TaskOption{Timeout: timeout} +} + +// DoIf creates a TaskOption for DoIf +func DoIf(condition bool) TaskOption { + return TaskOption{DoIf: pointer.Bool(condition)} +} + +// FlowStatePersistor persists the flat map to the provider status +type FlowStatePersistor func(ctx context.Context, flatMap FlatMap) error + +// BasicFlowContext provides logic for persisting the state and add tasks to the flow graph. +type BasicFlowContext struct { + Log logr.Logger + + exporter StateExporter + persistorLock sync.Mutex + flowStatePersistor FlowStatePersistor + lastPersistedGeneration int64 + lastPersistedAt time.Time + PersistInterval time.Duration +} + +// StateExporter knows how to export the internal state to a flat string map. +type StateExporter interface { + // CurrentGeneration is a counter which increments on changes of the internal state. + CurrentGeneration() int64 + // Exports all or parts of the internal state to a flat string map. + ExportAsFlatMap() FlatMap +} + +// NewBasicFlowContext creates a new `BasicFlowContext`. +func NewBasicFlowContext(log logr.Logger, exporter StateExporter, persistor FlowStatePersistor) *BasicFlowContext { + flowContext := &BasicFlowContext{ + Log: log, + exporter: exporter, + flowStatePersistor: persistor, + PersistInterval: 10 * time.Second, + } + return flowContext +} + +// PersistState persists the internal state to the provider status if it has changed and force is true +// or it has not been persisted during the `PersistInterval`. +func (c *BasicFlowContext) PersistState(ctx context.Context, force bool) error { + c.persistorLock.Lock() + defer c.persistorLock.Unlock() + + if !force && c.lastPersistedAt.Add(c.PersistInterval).After(time.Now()) { + return nil + } + currentGeneration := c.exporter.CurrentGeneration() + if c.lastPersistedGeneration == currentGeneration { + return nil + } + if c.flowStatePersistor != nil { + newState := c.exporter.ExportAsFlatMap() + if err := c.flowStatePersistor(ctx, newState); err != nil { + return err + } + } + c.lastPersistedGeneration = currentGeneration + c.lastPersistedAt = time.Now() + return nil +} + +// LogFromContext returns the log from the context when called within a task function added with the `AddTask` method. +func (c *BasicFlowContext) LogFromContext(ctx context.Context) logr.Logger { + if log, err := logr.FromContext(ctx); err != nil { + return c.Log + } else { + return log + } +} + +// AddTask adds a wrapped task for the given task function and options. +func (c *BasicFlowContext) AddTask(g *flow.Graph, name string, fn flow.TaskFn, options ...TaskOption) flow.TaskIDer { + allOptions := TaskOption{} + for _, opt := range options { + if len(opt.Dependencies) > 0 { + allOptions.Dependencies = append(allOptions.Dependencies, opt.Dependencies...) + } + if opt.Timeout > 0 { + allOptions.Timeout = opt.Timeout + } + if opt.DoIf != nil { + condition := true + if allOptions.DoIf != nil { + condition = *allOptions.DoIf + } + condition = condition && *opt.DoIf + allOptions.DoIf = pointer.Bool(condition) + } + } + + tunedFn := fn + if allOptions.DoIf != nil { + tunedFn = tunedFn.DoIf(*allOptions.DoIf) + if !*allOptions.DoIf { + name = "[Skipped] " + name + } + } + if allOptions.Timeout > 0 { + tunedFn = tunedFn.Timeout(allOptions.Timeout) + } + task := flow.Task{ + Name: name, + Fn: c.wrapTaskFn(g.Name(), name, tunedFn), + } + + if len(allOptions.Dependencies) > 0 { + task.Dependencies = flow.NewTaskIDs(allOptions.Dependencies...) + } + + return g.Add(task) +} + +func (c *BasicFlowContext) wrapTaskFn(flowName, taskName string, fn flow.TaskFn) flow.TaskFn { + return func(ctx context.Context) error { + taskCtx := logf.IntoContext(ctx, c.Log.WithValues("flow", flowName, "task", taskName)) + err := fn(taskCtx) + if err != nil { + // don't wrap error with '%w', as otherwise the error context get lost + err = fmt.Errorf("failed to %s: %s", taskName, err) + } + if perr := c.PersistState(taskCtx, false); perr != nil { + if err != nil { + c.Log.Error(perr, "persisting state failed") + } else { + err = perr + } + } + return err + } +} diff --git a/pkg/controller/infrastructure/infraflow/shared/basic_context_test.go b/pkg/controller/infrastructure/infraflow/shared/basic_context_test.go new file mode 100644 index 000000000..f06cff095 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/basic_context_test.go @@ -0,0 +1,166 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared_test + +import ( + "bytes" + "context" + "fmt" + "time" + + "github.com/gardener/gardener/pkg/utils/flow" + "github.com/go-logr/logr" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "k8s.io/utils/pointer" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" +) + +type testFlowContext struct { + shared.BasicFlowContext + state shared.Whiteboard +} + +func newTestFlowContext(log logr.Logger, state shared.Whiteboard, persistor shared.FlowStatePersistor) *testFlowContext { + return &testFlowContext{ + BasicFlowContext: *shared.NewBasicFlowContext(log, state, persistor), + state: state, + } +} + +var _ = Describe("BasicFlowContext", func() { + It("should create and run a graph flow", func() { + var ( + logBuffer bytes.Buffer + log = zap.New(zap.WriteTo(&logBuffer)) + state = shared.NewWhiteboard() + forcePersistorError = false + forceTask3Error = false + persistedData shared.FlatMap + persistCallCount = 0 + persistor = func(ctx context.Context, data shared.FlatMap) error { + if forcePersistorError { + return fmt.Errorf("forced persistor error") + } + persistedData = shared.FlatMap{} + for k, v := range data { + persistedData[k] = v + } + persistCallCount++ + return nil + } + ctx = context.Background() + err error + expectedData1 = shared.FlatMap{ + "key1": "id1", + "key2": "id2b", + } + ) + + c := newTestFlowContext(log, state, persistor) + c.PersistInterval = 10 * time.Millisecond + + By("persists only if needed", func() { + c.state.Set("key1", "id1") + err = c.PersistState(ctx, false) + Expect(err).NotTo(HaveOccurred()) + Expect(persistCallCount).To(Equal(1)) + + // no immediate persistence with force = false + c.state.Set("key2", "id2") + err = c.PersistState(ctx, false) + Expect(err).NotTo(HaveOccurred()) + Expect(persistCallCount).To(Equal(1)) + + // persist after interval + time.Sleep(c.PersistInterval) + err = c.PersistState(ctx, false) + Expect(err).NotTo(HaveOccurred()) + Expect(persistCallCount).To(Equal(2)) + + // immediate persistence with force = true + c.state.Set("key2", "id2b") + err = c.PersistState(ctx, true) + Expect(err).NotTo(HaveOccurred()) + Expect(persistCallCount).To(Equal(3)) + Expect(persistedData).To(Equal(expectedData1)) + + // no change, no persist call in backend + err = c.PersistState(ctx, true) + Expect(err).NotTo(HaveOccurred()) + Expect(persistCallCount).To(Equal(3)) + }) + + By("logs with context", func() { + g := flow.NewGraph("test") + task1 := c.AddTask(g, "task1", + func(ctx context.Context) error { + c.state.Set("task1", "done") + return nil + }, + shared.DoIf(false), shared.DoIf(true)) + task2 := c.AddTask(g, "task2", + func(ctx context.Context) error { + c.state.Set("task2", "done") + task1Log := c.LogFromContext(ctx) + task1Log.Info("message from task2") + return nil + }, + shared.Dependencies(task1)) + _ = c.AddTask(g, "task3", + func(ctx context.Context) error { + c.state.SetPtr("afterTask2", c.state.Get("task2")) + time.Sleep(c.PersistInterval) + c.state.Set("task3", "done") + if forceTask3Error { + return fmt.Errorf("forceTask3Error") + } + return nil + }, + shared.DoIf(true), shared.Dependencies(task2), shared.DoIf(true)) + + f := g.Compile() + Expect(f.Len()).To(Equal(3)) + + forcePersistorError = true + forceTask3Error = false + err = f.Run(ctx, flow.Opts{Log: log}) + Expect(err.Error()).To(ContainSubstring(`flow "test" encountered task errors: [task "task3" failed: forced persistor error]`)) + + Expect(c.state.Get("task1")).To(BeNil()) + Expect(c.state.Get("task2")).To(Equal(pointer.String("done"))) + Expect(c.state.Get("afterTask2")).To(Equal(c.state.Get("task2"))) + Expect(c.state.Get("task3")).To(Equal(pointer.String("done"))) + Expect(logBuffer.String()).To(ContainSubstring(`"task":"[Skipped] task1"`)) + Expect(logBuffer.String()).To(ContainSubstring(`"task":"task2"`)) + Expect(logBuffer.String()).To(ContainSubstring(`"msg":"message from task2"`)) + Expect(logBuffer.String()).To(ContainSubstring(`"task":"task3"`)) + + forcePersistorError = false + forceTask3Error = true + c.state.Set("task1", "") + err = f.Run(ctx, flow.Opts{Log: log}) + Expect(err.Error()).To(ContainSubstring(`flow "test" encountered task errors: [task "task3" failed: failed to task3: forceTask3Error]`)) + + forcePersistorError = false + forceTask3Error = false + c.state.Set("task1", "") + err = f.Run(ctx, flow.Opts{Log: log}) + Expect(err).To(BeNil()) + }) + }) +}) diff --git a/pkg/controller/infrastructure/infraflow/shared/persistent_state.go b/pkg/controller/infrastructure/infraflow/shared/persistent_state.go new file mode 100644 index 000000000..67f9b005f --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/persistent_state.go @@ -0,0 +1,139 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared + +import ( + "fmt" + "strings" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/json" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" +) + +const ( + // PersistentStateVersion is the current version used for persisting the state. + PersistentStateVersion = "v1alpha1" + // PersistentStateAPIVersion is the APIVersion used for the persistent state + PersistentStateAPIVersion = azure.GroupName + "/" + PersistentStateVersion + // PersistentStateKind is the kind name for the persistent state + PersistentStateKind = "FlowState" +) + +// PersistentState is the state which is persisted as part of the infrastructure status. +type PersistentState struct { + metav1.TypeMeta + + Data map[string]string `json:"data"` +} + +// NewPersistentState creates empty PersistentState +func NewPersistentState() *PersistentState { + return &PersistentState{ + TypeMeta: metav1.TypeMeta{ + APIVersion: PersistentStateAPIVersion, + Kind: PersistentStateKind, + }, + Data: map[string]string{}, + } +} + +// NewPersistentStateFromJSON unmarshals PersistentState from JSON or YAML. +// Returns nil if input contains no kind field with value "FlowState". +func NewPersistentStateFromJSON(raw []byte) (*PersistentState, error) { + // first check if state is from flow or Terraformer + marker := &metav1.TypeMeta{} + if err := json.Unmarshal(raw, marker); err != nil { + return nil, err + } + if marker.Kind == "" { + // no flow state + return nil, nil + } + if marker.Kind != PersistentStateKind || !strings.HasPrefix(marker.APIVersion, azure.GroupName) { + return nil, fmt.Errorf("unknown kind or group: kind=%s, apiVersion=%s", marker.Kind, marker.APIVersion) + } + + state := &PersistentState{} + if err := json.Unmarshal(raw, state); err != nil { + return nil, err + } + if valid, err := state.HasValidVersion(); !valid { + return nil, err + } + + if state.Data == nil { + state.Data = map[string]string{} + } + return state, nil +} + +// NewPersistentStateFromFlatMap create new PersistentState and initialises data from input. +func NewPersistentStateFromFlatMap(flatState FlatMap) *PersistentState { + state := NewPersistentState() + state.Data = copyMap(flatState) + return state +} + +// HasValidVersion checks if flow version is supported. +func (s *PersistentState) HasValidVersion() (valid bool, err error) { + valid = s != nil && s.Kind == PersistentStateKind && s.APIVersion == PersistentStateAPIVersion + if !valid { + err = fmt.Errorf("unsupported APIVersion %s for kind %s", s.APIVersion, s.Kind) + } + return +} + +// ToFlatMap returns a copy of state as FlatMap +func (s *PersistentState) ToFlatMap() FlatMap { + return copyMap(s.Data) +} + +// ToJSON marshals state as JSON +func (s *PersistentState) ToJSON() ([]byte, error) { + return json.Marshal(s) +} + +//// MigratedFromTerraform returns trus if marker MarkerMigratedFromTerraform is set. +//func (s *PersistentState) MigratedFromTerraform() bool { +// return s.Data[MarkerMigratedFromTerraform] == "true" +//} + +//// SetMigratedFromTerraform sets the marker MarkerMigratedFromTerraform +//func (s *PersistentState) SetMigratedFromTerraform() { +// s.Data[MarkerMigratedFromTerraform] = "true" +//} + +//// TerraformCleanedUp returns trus if marker MarkerTerraformCleanedUp is set. +//func (s *PersistentState) TerraformCleanedUp() bool { +// return s.Data[MarkerTerraformCleanedUp] == "true" +//} + +//// SetTerraformCleanedUp sets the marker MarkerTerraformCleanedUp +//func (s *PersistentState) SetTerraformCleanedUp() { +// s.Data[MarkerTerraformCleanedUp] = "true" +//} + +func copyMap(src map[string]string) map[string]string { + if src == nil { + return nil + } + dst := map[string]string{} + for k, v := range src { + dst[k] = v + } + return dst +} diff --git a/pkg/controller/infrastructure/infraflow/shared/shared_suite_test.go b/pkg/controller/infrastructure/infraflow/shared/shared_suite_test.go new file mode 100644 index 000000000..a564b8120 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/shared_suite_test.go @@ -0,0 +1,27 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestAws(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Infraflow Shared Test Suite") +} diff --git a/pkg/controller/infrastructure/infraflow/shared/tf_state.go b/pkg/controller/infrastructure/infraflow/shared/tf_state.go new file mode 100644 index 000000000..cf93b9437 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/tf_state.go @@ -0,0 +1,187 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared + +import ( + "encoding/base64" + "encoding/json" + "fmt" + + "github.com/gardener/gardener/extensions/pkg/terraformer" +) + +const ( + // ModeManaged is mode value for managed resources. + ModeManaged = "managed" + // AttributeKeyId is the key for the id attribute + AttributeKeyId = "id" + // AttributeKeyName is the key for the name attribute + AttributeKeyName = "name" +) + +// TerraformState holds the unmarshalled terraformer state. +type TerraformState struct { + Version int `json:"version"` + TerraformVersion string `json:"terraform_version"` + Serial int `json:"serial"` + Lineage string `json:"lineage"` + Outputs map[string]TFOutput `json:"outputs,omitempty"` + Resources []TFResource `json:"resources,omitempty"` +} + +// TFOutput holds the value and type for a terraformer state output variable. +type TFOutput struct { + Value string `json:"value"` + Type string `json:"type"` +} + +// TFResource holds the attributes of a terraformer state resource. +type TFResource struct { + Mode string `json:"mode"` + Type string `json:"type"` + Name string `json:"name"` + Provider string `json:"provider"` + Instances []TFInstance +} + +// TFInstance holds the attributes of a terraformer state resource instance. +type TFInstance struct { + SchemaVersion int `json:"schema_version"` + Attributes map[string]interface{} `json:"attributes,omitempty"` + SensitiveAttributes []string `json:"sensitive_attributes,omitempty"` + Private string `json:"private,omitempty"` + Dependencies []string `json:"dependencies"` +} + +// LoadTerraformStateFromConfigMapData loads and unmarshalls the state from a config map data. +func LoadTerraformStateFromConfigMapData(data map[string]string) (*TerraformState, error) { + content := data["terraform.tfstate"] + if content == "" { + return nil, fmt.Errorf("key 'terraform.tfstate' not found") + } + + return UnmarshalTerraformState([]byte(content)) +} + +// UnmarshalTerraformStateFromTerraformer unmarshalls the Terraformer state from the raw state. +func UnmarshalTerraformStateFromTerraformer(state *terraformer.RawState) (*TerraformState, error) { + var ( + tfState *TerraformState + err error + data []byte + ) + + switch state.Encoding { + case "base64": + data, err = base64.StdEncoding.DecodeString(state.Data) + if err != nil { + return nil, fmt.Errorf("could not decode terraform raw state data: %w", err) + } + case "none": + data = []byte(state.Data) + default: + return nil, fmt.Errorf("unknown encoding of Terraformer raw state: %s", state.Encoding) + } + if tfState, err = UnmarshalTerraformState(data); err != nil { + return nil, fmt.Errorf("could not decode terraform state: %w", err) + } + return tfState, nil +} + +// UnmarshalTerraformState unmarshalls the terraformer state from a byte array. +func UnmarshalTerraformState(data []byte) (*TerraformState, error) { + state := &TerraformState{} + if err := json.Unmarshal(data, state); err != nil { + return nil, err + } + return state, nil +} + +// FindManagedResourceInstances finds all instances for a resource identified by type and name. +func (ts *TerraformState) FindManagedResourceInstances(tfType, resourceName string) []TFInstance { + for i := range ts.Resources { + resource := &ts.Resources[i] + if resource.Mode == ModeManaged && resource.Type == tfType && resource.Name == resourceName { + return resource.Instances + } + } + return nil +} + +// FindManagedResourcesByType finds all instances for all resources of the given type. +func (ts *TerraformState) FindManagedResourcesByType(tfType string) []*TFResource { + var result []*TFResource + for i := range ts.Resources { + resource := &ts.Resources[i] + if resource.Mode == ModeManaged && resource.Type == tfType { + result = append(result, resource) + } + } + return result +} + +// GetManagedResourceInstanceID returns the value of the id attribute of the only instance of a resource identified by type and name. +// It returns nil if either the resource is not found or the resource has not exactly one instance. +func (ts *TerraformState) GetManagedResourceInstanceID(tfType, resourceName string) *string { + return ts.GetManagedResourceInstanceAttribute(tfType, resourceName, AttributeKeyId) +} + +// GetManagedResourceInstanceName returns the value of the name attribute of the only instance of a resource identified by type and name. +// It returns nil if either the resource is not found or the resource has not exactly one instance. +func (ts *TerraformState) GetManagedResourceInstanceName(tfType, resourceName string) *string { + return ts.GetManagedResourceInstanceAttribute(tfType, resourceName, AttributeKeyName) +} + +// GetManagedResourceInstanceAttribute returns the value of the given attribute keys of the only instance of a resource identified by type and name. +// It returns nil if either the resource is not found or the resource has not exactly one instance or the attribute key is not existing. +func (ts *TerraformState) GetManagedResourceInstanceAttribute(tfType, resourceName, attributeKey string) *string { + instances := ts.FindManagedResourceInstances(tfType, resourceName) + if len(instances) == 1 { + if value, ok := AttributeAsString(instances[0].Attributes, attributeKey); ok { + return &value + } + } + return nil +} + +// GetManagedResourceInstances returns a map resource name to instance id for all resources of the given type. +// Only resources are included which have exactly one instance. +func (ts *TerraformState) GetManagedResourceInstances(tfType string) map[string]string { + result := map[string]string{} + for _, item := range ts.FindManagedResourcesByType(tfType) { + if len(item.Instances) == 1 { + if value, ok := AttributeAsString(item.Instances[0].Attributes, AttributeKeyId); ok { + result[item.Name] = value + } + } + } + return result +} + +// AttributeAsString returns the string value for the given key. `found` is only true if the map contains the key and the value is a string. +func AttributeAsString(attributes map[string]interface{}, key string) (svalue string, found bool) { + if attributes == nil { + return + } + value, ok := attributes[key] + if !ok { + return + } + if s, ok := value.(string); ok { + svalue = s + found = true + } + return +} diff --git a/pkg/controller/infrastructure/infraflow/shared/tf_state_test.go b/pkg/controller/infrastructure/infraflow/shared/tf_state_test.go new file mode 100644 index 000000000..77ddb6c17 --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/tf_state_test.go @@ -0,0 +1,245 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared_test + +import ( + "github.com/gardener/gardener/extensions/pkg/terraformer" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "k8s.io/utils/pointer" + + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" +) + +var _ = Describe("TerraformState", func() { + It("should unmarshall terraformer state", func() { + var () + + rawState := &terraformer.RawState{ + Data: tfstate, + Encoding: "none", + } + + tf, err := shared.UnmarshalTerraformStateFromTerraformer(rawState) + Expect(err).NotTo(HaveOccurred()) + + Expect(tf.Outputs["vpc_id"]).To(Equal(shared.TFOutput{Type: "string", Value: "vpc-0123456"})) + + tables := tf.FindManagedResourcesByType("aws_route_table") + Expect(len(tables)).To(Equal(2)) + + Expect(tf.GetManagedResourceInstanceID("aws_route_table", "routetable_private_utility_z0")). + To(Equal(pointer.String("rtb-77777"))) + + Expect(tf.GetManagedResourceInstanceName("aws_iam_role", "nodes")). + To(Equal(pointer.String("shoot--foo--bar-nodes"))) + + Expect(tf.GetManagedResourceInstanceAttribute("aws_nat_gateway", "natgw_z0", "private_ip")). + To(Equal(pointer.String("10.180.46.81"))) + + Expect(tf.GetManagedResourceInstanceAttribute("aws_nat_gateway", "natgw_z0", "foobar")). + To(BeNil()) + + Expect(tf.GetManagedResourceInstances("aws_route_table")). + To(Equal(map[string]string{ + "routetable_main": "rtb-66666", + "routetable_private_utility_z0": "rtb-77777", + })) + }) +}) + +const tfstate = `{ + "version": 4, + "terraform_version": "0.15.5", + "serial": 83, + "lineage": "674a5a9a-d0e5-eee1-ce57-d820c4313bf0", + "outputs": { + "vpc_id": { + "value": "vpc-0123456", + "type": "string" + } + }, + "resources": [ + { + "mode": "managed", + "type": "aws_iam_role", + "name": "nodes", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "shoot--foo--bar-nodes-id", + "max_session_duration": 3600, + "name": "shoot--foo--bar-nodes" + } + } + ] + }, + { + "mode": "managed", + "type": "aws_nat_gateway", + "name": "natgw_z0", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "allocation_id": "eipalloc-07aaaaa", + "connectivity_type": "public", + "id": "nat-22222", + "network_interface_id": "eni-33333", + "private_ip": "10.180.46.81", + "public_ip": "1.2.3.4", + "subnet_id": "subnet-44444", + "tags": { + "Name": "shoot--foo--bar-natgw-z0", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "tags_all": { + "Name": "shoot--foo--bar-natgw-z0", + "kubernetes.io/cluster/shoot--foo--bar": "1" + } + }, + "sensitive_attributes": [], + "private": "xxx", + "dependencies": [ + "aws_eip.eip_natgw_z0", + "aws_subnet.public_utility_z0", + "aws_vpc.vpc" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table", + "name": "routetable_main", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "rtb-66666", + "owner_id": "999999", + "propagating_vgws": [], + "route": [ + { + "cidr_block": "0.0.0.0/0" + } + ], + "tags": { + "Name": "shoot--foo--bar", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "tags_all": { + "Name": "shoot--foo--bar", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "timeouts": { + "create": "5m", + "delete": null, + "update": null + }, + "vpc_id": "vpc-0123456" + }, + "sensitive_attributes": [], + "private": "xxx", + "dependencies": [ + "aws_vpc.vpc" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table", + "name": "routetable_private_utility_z0", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "rtb-77777", + "owner_id": "999999", + "route": [ + { + "cidr_block": "0.0.0.0/0", + "nat_gateway_id": "nat-22222" + } + ], + "tags": { + "Name": "shoot--foo--bar-private-eu-west-1a", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "tags_all": { + "Name": "shoot--foo--bar-private-eu-west-1a", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "timeouts": { + "create": "5m", + "delete": null, + "update": null + }, + "vpc_id": "vpc-0123456" + }, + "sensitive_attributes": [], + "private": "xxx", + "dependencies": [ + "aws_vpc.vpc" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_vpc", + "name": "vpc", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:eu-west-1:999999:vpc/vpc-0123456", + "assign_generated_ipv6_cidr_block": false, + "cidr_block": "10.180.0.0/16", + "default_security_group_id": "sg-11111", + "enable_classiclink": false, + "enable_classiclink_dns_support": false, + "enable_dns_hostnames": true, + "enable_dns_support": true, + "id": "vpc-0123456", + "instance_tenancy": "default", + "ipv6_association_id": "", + "ipv6_cidr_block": "", + "main_route_table_id": "rtb-77888", + "owner_id": "999999", + "tags": { + "Name": "shoot--foo--bar", + "kubernetes.io/cluster/shoot--foo--bar": "1" + }, + "tags_all": { + "Name": "shoot--foo--bar", + "kubernetes.io/cluster/shoot--foo--bar": "1" + } + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + } + ] +} +` diff --git a/pkg/controller/infrastructure/infraflow/shared/whiteboard.go b/pkg/controller/infrastructure/infraflow/shared/whiteboard.go new file mode 100644 index 000000000..54b68862d --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/whiteboard.go @@ -0,0 +1,269 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared + +import ( + "sort" + "strings" + "sync" + "sync/atomic" + + "k8s.io/utils/pointer" +) + +const ( + // Separator is used to on translating keys to/from flat maps + Separator = "/" + // deleted is a special value to mark a resource id as deleted + deleted = "" +) + +// FlatMap is a semantic name for string map used for importing and exporting +type FlatMap map[string]string + +// Whiteboard is a hierarchical key/value store for the internal state. +// It is safe to be used concurrently. +// Additionally, it can cache objects for use in subsequent flow task. +type Whiteboard interface { + IsEmpty() bool + + // GetChild returns a sub-whiteboard for the given key. If no child exists with this name, it is created automatically. + // Each child has its own lock. + GetChild(key string) Whiteboard + // HasChild returns true if there is a non-empty child for that key + HasChild(key string) bool + // GetChildrenKeys returns all children keys + GetChildrenKeys() []string + + // Get returns a valid value or nil (never "" or special deleted value) + Get(key string) *string + Set(key, id string) + SetPtr(key string, id *string) + IsAlreadyDeleted(key string) bool + SetAsDeleted(key string) + // Keys returns all stored keys, even for deleted ones + Keys() []string + // AsMap returns a map with all valid key/values + AsMap() map[string]string + + GetObject(key string) any + SetObject(key string, obj any) + + // ImportFromFlatMap reconstructs the hierarchical structure from a flat map containing path-like keys + ImportFromFlatMap(data FlatMap) + // ExportAsFlatMap exports the hierarchical structure to a flat map with path-like keys. Objects are ignored. + ExportAsFlatMap() FlatMap + + // CurrentGeneration returns current generation, which increments with any change + CurrentGeneration() int64 +} + +type whiteboard struct { + sync.Mutex + + children map[string]*whiteboard + data map[string]string + objects map[string]any + generation *atomic.Int64 +} + +var _ Whiteboard = &whiteboard{} + +// NewWhiteboard creates an empty whiteboard. +func NewWhiteboard() Whiteboard { + return newWhiteboard(&atomic.Int64{}) +} + +func newWhiteboard(generation *atomic.Int64) *whiteboard { + return &whiteboard{ + children: map[string]*whiteboard{}, + data: map[string]string{}, + objects: map[string]any{}, + generation: generation, + } +} + +func (w *whiteboard) CurrentGeneration() int64 { + return w.generation.Load() +} + +func (w *whiteboard) IsEmpty() bool { + w.Lock() + defer w.Unlock() + + if len(w.data) != 0 || len(w.objects) != 0 { + return false + } + for _, child := range w.children { + if !child.IsEmpty() { + return false + } + } + return true +} + +func (w *whiteboard) GetChild(key string) Whiteboard { + return w.getChild(key) +} + +func (w *whiteboard) getChild(key string) *whiteboard { + w.Lock() + defer w.Unlock() + + child := w.children[key] + if child == nil { + child = newWhiteboard(w.generation) + w.children[key] = child + } + return child +} + +func (w *whiteboard) HasChild(key string) bool { + w.Lock() + defer w.Unlock() + + child := w.children[key] + return child != nil && !child.IsEmpty() +} + +func (w *whiteboard) GetChildrenKeys() []string { + w.Lock() + defer w.Unlock() + + return sortedKeys(w.children) +} + +func (w *whiteboard) GetObject(key string) any { + w.Lock() + defer w.Unlock() + return w.objects[key] +} + +func (w *whiteboard) SetObject(key string, obj any) { + w.Lock() + defer w.Unlock() + w.objects[key] = obj +} + +func (w *whiteboard) Keys() []string { + w.Lock() + defer w.Unlock() + + return sortedKeys(w.data) +} + +func (w *whiteboard) AsMap() map[string]string { + w.Lock() + defer w.Unlock() + + m := map[string]string{} + for key, value := range w.data { + if IsValidValue(value) { + m[key] = value + } + } + return m +} + +func (w *whiteboard) Get(key string) *string { + w.Lock() + defer w.Unlock() + id := w.data[key] + if !IsValidValue(id) { + return nil + } + return &id +} + +func (w *whiteboard) Set(key, id string) { + w.Lock() + defer w.Unlock() + oldId := w.data[key] + if id != "" { + w.data[key] = id + } else { + delete(w.data, key) + } + if oldId != id { + w.modified() + } +} + +func (w *whiteboard) SetPtr(key string, id *string) { + w.Set(key, pointer.StringDeref(id, "")) +} + +func (w *whiteboard) IsAlreadyDeleted(key string) bool { + w.Lock() + defer w.Unlock() + return w.data[key] == deleted +} + +func (w *whiteboard) SetAsDeleted(key string) { + w.Set(key, deleted) +} + +func (w *whiteboard) ImportFromFlatMap(data FlatMap) { + for key, value := range data { + parts := strings.Split(key, Separator) + level := w + for i := 0; i < len(parts)-1; i++ { + level = level.getChild(parts[i]) + } + level.Set(parts[len(parts)-1], value) + } +} + +func (w *whiteboard) ExportAsFlatMap() FlatMap { + data := map[string]string{} + w.copyMap(data, "") + fillDataFromChildren(data, "", w) + return data +} + +func (w *whiteboard) copyMap(data map[string]string, prefix string) { + w.Lock() + defer w.Unlock() + for k, v := range w.data { + data[prefix+k] = v + } +} + +func fillDataFromChildren(data map[string]string, parentPrefix string, parent *whiteboard) { + for _, childKey := range parent.GetChildrenKeys() { + child := parent.getChild(childKey) + childPrefix := parentPrefix + childKey + Separator + child.copyMap(data, childPrefix) + fillDataFromChildren(data, childPrefix, child) + } +} + +func (w *whiteboard) modified() { + w.generation.Add(1) +} + +func sortedKeys[V any](m map[string]V) []string { + var keys []string + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + return keys +} + +// IsValidValue returns true if an exported value is valid, i.e. not empty and not special value for deleted. +func IsValidValue(value string) bool { + return value != "" && value != deleted +} diff --git a/pkg/controller/infrastructure/infraflow/shared/whiteboard_test.go b/pkg/controller/infrastructure/infraflow/shared/whiteboard_test.go new file mode 100644 index 000000000..480027dbd --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/shared/whiteboard_test.go @@ -0,0 +1,103 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package shared_test + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "k8s.io/utils/pointer" + + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" +) + +var _ = Describe("Whiteboard", func() { + It("should create hierarchical whiteboard from flat map", func() { + var ( + data = shared.FlatMap{ + "key1": "id1", + "key2": "id2", + "child1/subchild1/key1": "id111", + "child1/subchild2/key1": "id121", + "child2/key2": "id22", + } + expectedData = shared.FlatMap{ + "key1": "", + "key2": "id2a", + "key3": "id3", + "child1/subchild1/key1": "id111b", + "child2/key2": "id22", + } + expectedMap = map[string]string{ + "key2": "id2a", + "key3": "id3", + } + expectedKeys = []string{"key1", "key2", "key3"} + ) + + w := shared.NewWhiteboard() + w.IsEmpty() + w.ImportFromFlatMap(data) + Expect(w.Get("key1")).NotTo(BeNil()) + Expect(*w.Get("key1")).To(Equal("id1")) + Expect(w.Get("key2")).NotTo(BeNil()) + Expect(*w.Get("key2")).To(Equal("id2")) + Expect(w.Get("child1")).To(BeNil()) + Expect(w.GetChild("child1").IsEmpty()).To(BeFalse()) + Expect(w.GetChild("child1").GetChild("subchild1").Get("key1")).To(Equal(pointer.String("id111"))) + Expect(w.GetChild("child1").GetChild("subchild2").Get("key1")).To(Equal(pointer.String("id121"))) + Expect(w.GetChild("child2").IsEmpty()).To(BeFalse()) + Expect(w.GetChild("child2").Get("key2")).To(Equal(pointer.String("id22"))) + Expect(w.GetChild("child3").IsEmpty()).To(BeTrue()) + generation1 := w.CurrentGeneration() + w.Set("key2", "id2") + Expect(w.CurrentGeneration()).To(Equal(generation1)) + w.GetChild("child1").GetChild("subchild1").Set("key1", "id111") + Expect(w.CurrentGeneration()).To(Equal(generation1)) + w.Set("key2", "id2a") + generation2 := w.CurrentGeneration() + Expect(generation2 > generation1).To(BeTrue()) + w.GetChild("child1").GetChild("subchild1").Set("key1", "id111b") + Expect(w.CurrentGeneration() > generation2).To(BeTrue()) + + Expect(w.GetChild("child1").GetChild("subchild2").IsAlreadyDeleted("key1")).To(BeFalse()) + w.GetChild("child1").GetChild("subchild2").Set("key1", "") + Expect(w.GetChild("child1").GetChild("subchild2").IsAlreadyDeleted("key1")).To(BeFalse()) + + Expect(w.Get("key1")).NotTo(BeNil()) + Expect(w.IsAlreadyDeleted("key1")).To(BeFalse()) + w.SetAsDeleted("key1") + Expect(w.Get("key1")).To(BeNil()) + Expect(w.IsAlreadyDeleted("key1")).To(BeTrue()) + + Expect(w.Get("key3")).To(BeNil()) + w.SetPtr("key3", pointer.String("id3")) + Expect(w.Get("key3")).NotTo(BeNil()) + + Expect(w.HasChild("child1")).To(BeTrue()) + Expect(w.HasChild("child3")).To(BeFalse()) + + Expect(w.AsMap()).To(Equal(expectedMap)) + + Expect(w.Keys()).To(Equal(expectedKeys)) + + generation3 := w.CurrentGeneration() + w.SetObject("obj1", expectedKeys) + Expect(w.GetObject("obj1")).To(Equal(expectedKeys)) + Expect(w.CurrentGeneration()).To(Equal(generation3)) + + exported := w.ExportAsFlatMap() + Expect(exported).To(Equal(expectedData)) + }) +}) diff --git a/pkg/controller/infrastructure/infraflow/terraformadapter.go b/pkg/controller/infrastructure/infraflow/terraformadapter.go new file mode 100644 index 000000000..b2030679c --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/terraformadapter.go @@ -0,0 +1,338 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow + +import ( + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/gardener/gardener/extensions/pkg/controller" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" +) + +type tfResource string + +const ( + // ResourceGroup is the attribute name for the isCreate function of the tf adapter + ResourceGroup tfResource = "resourceGroup" + // Vnet is the attribute name for the isCreate function of the tf adapter + Vnet tfResource = "vnet" + // AvailabilitySet is the attribute name for the isCreate function of the tf adapter + AvailabilitySet tfResource = "availabilitySet" +) + +// TerraformAdapter retrieves all configuration logic needed for reconcilation from the (soon) legacy Terraform configuration code +type TerraformAdapter struct { + values map[string]interface{} + config *azure.InfrastructureConfig +} + +// RouteTableName returns the name of the route table +func (t TerraformAdapter) RouteTableName() string { + return "worker_route_table" +} + +// SecurityGroupName returns the name of the security group +func (t TerraformAdapter) SecurityGroupName() string { + return t.ClusterName() + "-workers" +} + +type identityTf struct { + Name string + ResourceGroup string +} + +type availablilitySetTf struct { + Name string + CountFaultDomains int32 + CountUpdateDomains int32 +} + +// AvailabilitySet returns the availability set configuration +func (t TerraformAdapter) AvailabilitySet() availablilitySetTf { + return availablilitySetTf{t.availabilitySetName(), t.countFaultDomains(), t.countUpdateDomains()} +} + +// Identity returns the identity configuration +func (t TerraformAdapter) Identity() *identityTf { + identity := t.values["identity"].(map[string]interface{}) + name, ok := identity["name"] + if !ok { + return nil + } + resourceGroup, ok := identity["resourceGroup"] + if !ok { + return nil + } + return &identityTf{name.(string), resourceGroup.(string)} +} + +// StaticInfrastructureStatus returns the status part that only depends on the configuration and does not rely on metadata from resource reconcilation +func (t TerraformAdapter) StaticInfrastructureStatus() *v1alpha1.InfrastructureStatus { + infraState := v1alpha1.InfrastructureStatus{ + TypeMeta: infrastructure.StatusTypeMeta, + ResourceGroup: v1alpha1.ResourceGroup{ + Name: t.ResourceGroup(), + }, + Networks: v1alpha1.NetworkStatus{ + VNet: v1alpha1.VNetStatus{ + Name: t.Vnet().Name(), // if not set by user then assumes tf default (no state necessary) + }, + }, + AvailabilitySets: []v1alpha1.AvailabilitySet{}, + RouteTables: []v1alpha1.RouteTable{ + {Purpose: v1alpha1.PurposeNodes, Name: t.RouteTableName()}, + }, + SecurityGroups: []v1alpha1.SecurityGroup{ + {Name: t.SecurityGroupName(), Purpose: v1alpha1.PurposeNodes}, + }, + Zoned: false, + } + if t.config.Zoned { + infraState.Zoned = true + } + + if t.config.Networks.Workers == nil { + infraState.Networks.Layout = v1alpha1.NetworkLayoutMultipleSubnet + } else { + infraState.Networks.Layout = v1alpha1.NetworkLayoutSingleSubnet + } + + for _, subnet := range t.Zones() { + subnetV1 := v1alpha1.Subnet{ + Name: subnet.SubnetName(), + Purpose: v1alpha1.PurposeNodes, + Zone: subnet.Zone(), + } + if subnet.migrated != nil { + subnetV1.Migrated = *subnet.migrated + } + infraState.Networks.Subnets = append(infraState.Networks.Subnets, subnetV1) + } + + infraState.Networks.VNet.ResourceGroup = t.Vnet().ResourceGroup() + + return &infraState +} + +// NewTerraformAdapter creates a new TerraformAdapter +func NewTerraformAdapter(infra *extensionsv1alpha1.Infrastructure, config *azure.InfrastructureConfig, cluster *controller.Cluster) (TerraformAdapter, error) { + tfValues, err := infrastructure.ComputeTerraformerTemplateValues(infra, config, cluster) // use for migration of values.. + return TerraformAdapter{tfValues, config}, err +} + +func (t TerraformAdapter) isCreate(resource tfResource) bool { + create := t.values["create"].(map[string]interface{}) + return create[string(resource)].(bool) +} + +// Vnet returns the vnet configuration +func (t TerraformAdapter) Vnet() vnetTf { + cm := t.values["resourceGroup"].(map[string]interface{}) + return vnetTf(cm["vnet"].(map[string]interface{})) +} + +// ResourceGroup returns the resource group name +func (t TerraformAdapter) ResourceGroup() string { + return t.values["resourceGroup"].(map[string]interface{})["name"].(string) +} + +// Region returns the region +func (t TerraformAdapter) Region() string { + return t.values["azure"].(map[string]interface{})["region"].(string) +} + +func (t TerraformAdapter) countUpdateDomains() int32 { + return t.values["azure"].(map[string]interface{})["countUpdateDomains"].(int32) +} + +func (t TerraformAdapter) countFaultDomains() int32 { + return t.values["azure"].(map[string]interface{})["countFaultDomains"].(int32) +} + +// ClusterName returns the cluster name +func (t TerraformAdapter) ClusterName() string { + return t.values["clusterName"].(string) +} + +func (t TerraformAdapter) subnetName(subnet map[string]interface{}) string { + name := t.ClusterName() + "-nodes" + isMigrated, isMultiSubnet := subnet["migrated"] + if isMultiSubnet { + if !isMigrated.(bool) { + name = fmt.Sprintf("%s-z%d", name, subnet["name"].(int32)) + } + } + return name +} + +// EnabledNats returns all zones with NAT enabled +func (t TerraformAdapter) EnabledNats() []zoneTf { + res := make([]zoneTf, 0) + for _, nat := range t.Zones() { + if nat.enabled { + res = append(res, nat) + } + } + return res +} + +func (t TerraformAdapter) availabilitySetName() string { + return t.ClusterName() + "-avset-workers" +} + +type userManagedIP struct { + Name string + ResourceGroup string + SubnetName string +} + +// UserManagedIPs returns all user managed IPs +// tpl l.139 +func (t TerraformAdapter) UserManagedIPs() []userManagedIP { + res := make([]userManagedIP, 0) + rawSubnets := t.values["networks"].(map[string]interface{})["subnets"] + if rawSubnets == nil { + return res + } + for _, subnet := range rawSubnets.([]map[string]interface{}) { + subnetName := t.subnetName(subnet) + natRaw := subnet["natGateway"].(map[string]interface{}) + _, ok := natRaw["zone"] + if ok { + ipAddrRaw, ipOk := natRaw["ipAddresses"] + if ipOk { + ipAddrs := ipAddrRaw.([]map[string]interface{}) + for _, addr := range ipAddrs { + ipName := addr["name"].(string) + ipRgroup := addr["resourceGroup"].(string) + res = append(res, userManagedIP{ipName, ipRgroup, subnetName}) + } + } + } + } + return res +} + +// Zones returns all zone configurations +func (t TerraformAdapter) Zones() []zoneTf { + res := make([]zoneTf, 0) + rawSubnets := t.values["networks"].(map[string]interface{})["subnets"] + if rawSubnets == nil { + return res + } + for _, subnet := range rawSubnets.([]map[string]interface{}) { + natRaw := subnet["natGateway"].(map[string]interface{}) + + var idleConnectionTimeoutMinutes *int32 + if _, ok := natRaw["idleConnectionTimeoutMinutes"]; ok { + idleConnectionTimeoutMinutes = to.Ptr(natRaw["idleConnectionTimeoutMinutes"].(int32)) + } + cidr := subnet["cidr"].(string) + serviceEndpoints := subnet["serviceEndpoints"].([]string) + + // only for multi subnets + var isMigrated *bool + isMigratedRaw, isMultiSubnet := subnet["migrated"] + if isMultiSubnet { + isMigrated = to.Ptr(isMigratedRaw.(bool)) + } + + var zone *string + zoneRaw, ok := natRaw["zone"] + if ok { + zone = to.Ptr(fmt.Sprintf("%d", zoneRaw.(int32))) + } + + var rawNetNumber *int32 + netNumberRaw, ok := subnet["name"] + if ok { + rawNetNumber = to.Ptr(netNumberRaw.(int32)) + } + res = append(res, zoneTf{rawNetNumber, natRaw["enabled"].(bool), idleConnectionTimeoutMinutes, isMigrated, t.ClusterName(), zone, cidr, serviceEndpoints}) + } + return res +} + +type zoneTf struct { + rawNetNumber *int32 + enabled bool + idleConnectionTimeoutMinutes *int32 + migrated *bool + clusterName string + zone *string + cidr string + serviceEndpoints []string +} + +func (nat zoneTf) NatName() string { + name := nat.clusterName + "-nat-gateway" + if nat.migrated != nil && !*nat.migrated && nat.rawNetNumber != nil { + name = fmt.Sprintf("%s-z%d", name, *nat.rawNetNumber) + } + return name +} + +func (nat zoneTf) SubnetName() string { + name := nat.clusterName + "-nodes" + if nat.migrated != nil && !*nat.migrated && nat.rawNetNumber != nil { + name = fmt.Sprintf("%s-z%d", name, *nat.rawNetNumber) + } + return name +} + +func (nat zoneTf) IpName() string { + return nat.NatName() + "-ip" +} + +func (nat zoneTf) Zone() *string { + return nat.zone +} + +type vnetTf (map[string]interface{}) + +func (v vnetTf) Cidr() *string { + val, ok := v["cidr"] + if ok { + return to.Ptr(val.(string)) + } else { + return nil + } +} + +func (v vnetTf) DDosProtectionPlanID() *string { + val, ok := v["ddosProtectionPlanID"] + if ok { + return to.Ptr(val.(string)) + } else { + return nil + } +} + +func (v vnetTf) Name() string { + return v["name"].(string) +} + +func (v vnetTf) ResourceGroup() *string { + val, ok := v["resourceGroup"] + if !ok { + return nil + } + return to.Ptr(val.(string)) +} diff --git a/pkg/controller/infrastructure/infraflow/terraformadapter_test.go b/pkg/controller/infrastructure/infraflow/terraformadapter_test.go new file mode 100644 index 000000000..4f944ad0d --- /dev/null +++ b/pkg/controller/infrastructure/infraflow/terraformadapter_test.go @@ -0,0 +1,52 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infraflow_test + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" +) + +var _ = Describe("TfAdapter", func() { + location := "westeurope" + clusterName := "test_cluster" + infra := &v1alpha1.Infrastructure{Spec: v1alpha1.InfrastructureSpec{Region: location}, ObjectMeta: metav1.ObjectMeta{Namespace: clusterName}} + cluster := infrastructure.MakeCluster("11.0.0.0/16", "12.0.0.0/16", infra.Spec.Region, 1, 1) + It("should return the Identity information", func() { + cfg := newBasicConfig() + sut, err := infraflow.NewTerraformAdapter(infra, cfg, cluster) + Expect(err).ToNot(HaveOccurred()) + res := sut.Identity() + Expect(res).To(BeNil()) + }) + It("should return NAT config for single subnet", func() { + cfg := newBasicConfig() + cfg.Networks.NatGateway = &azure.NatGatewayConfig{ + Zone: to.Ptr(int32(1)), + Enabled: true, + } + sut, err := infraflow.NewTerraformAdapter(infra, cfg, cluster) + Expect(err).ToNot(HaveOccurred()) + res := sut.Zones() + Expect(res).NotTo(BeEmpty()) + }) +}) diff --git a/pkg/controller/infrastructure/mock/doc.go b/pkg/controller/infrastructure/mock/doc.go new file mode 100644 index 000000000..987686a1e --- /dev/null +++ b/pkg/controller/infrastructure/mock/doc.go @@ -0,0 +1,16 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//go:generate mockgen -package infrastructure -destination=mocks.go github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure Reconciler + +package infrastructure diff --git a/pkg/controller/infrastructure/mock/mocks.go b/pkg/controller/infrastructure/mock/mocks.go new file mode 100644 index 000000000..8b4b42036 --- /dev/null +++ b/pkg/controller/infrastructure/mock/mocks.go @@ -0,0 +1,83 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure (interfaces: Reconciler) + +// Package infrastructure is a generated GoMock package. +package infrastructure + +import ( + context "context" + reflect "reflect" + + azure "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + v1alpha1 "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + v1alpha10 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + extensions "github.com/gardener/gardener/pkg/extensions" + gomock "github.com/golang/mock/gomock" +) + +// MockReconciler is a mock of Reconciler interface. +type MockReconciler struct { + ctrl *gomock.Controller + recorder *MockReconcilerMockRecorder +} + +// MockReconcilerMockRecorder is the mock recorder for MockReconciler. +type MockReconcilerMockRecorder struct { + mock *MockReconciler +} + +// NewMockReconciler creates a new mock instance. +func NewMockReconciler(ctrl *gomock.Controller) *MockReconciler { + mock := &MockReconciler{ctrl: ctrl} + mock.recorder = &MockReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockReconciler) EXPECT() *MockReconcilerMockRecorder { + return m.recorder +} + +// Delete mocks base method. +func (m *MockReconciler) Delete(arg0 context.Context, arg1 *v1alpha10.Infrastructure, arg2 *azure.InfrastructureConfig, arg3 *extensions.Cluster) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockReconcilerMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockReconciler)(nil).Delete), arg0, arg1, arg2, arg3) +} + +// GetState mocks base method. +func (m *MockReconciler) GetState(arg0 context.Context, arg1 *v1alpha1.InfrastructureStatus) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetState", arg0, arg1) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetState indicates an expected call of GetState. +func (mr *MockReconcilerMockRecorder) GetState(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetState", reflect.TypeOf((*MockReconciler)(nil).GetState), arg0, arg1) +} + +// Reconcile mocks base method. +func (m *MockReconciler) Reconcile(arg0 context.Context, arg1 *v1alpha10.Infrastructure, arg2 *azure.InfrastructureConfig, arg3 *extensions.Cluster) (*v1alpha1.InfrastructureStatus, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Reconcile", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*v1alpha1.InfrastructureStatus) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Reconcile indicates an expected call of Reconcile. +func (mr *MockReconcilerMockRecorder) Reconcile(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reconcile", reflect.TypeOf((*MockReconciler)(nil).Reconcile), arg0, arg1, arg2, arg3) +} diff --git a/pkg/controller/infrastructure/strategyselector.go b/pkg/controller/infrastructure/strategyselector.go new file mode 100644 index 000000000..c9ed4ab97 --- /dev/null +++ b/pkg/controller/infrastructure/strategyselector.go @@ -0,0 +1,90 @@ +package infrastructure + +import ( + "context" + "fmt" + + "github.com/gardener/gardener/extensions/pkg/terraformer" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/gardener/gardener/pkg/extensions" + "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" +) + +type StrategySelector struct { + Factory ReconcilerFactory + Client client.Client +} + +type ReconcilerFactoryImpl struct { + ctx context.Context + log logr.Logger + a *actuator + infra *extensionsv1alpha1.Infrastructure + stateInitializer terraformer.StateConfigMapInitializer +} + +func (f ReconcilerFactoryImpl) Build(useFlow bool) (Reconciler, error) { + if useFlow { + if err := cleanupTerraform(f.ctx, f.log, f.a, f.infra); err != nil { + return nil, fmt.Errorf("failed to cleanup terraform resources: %w", err) + } + reconciler, err := NewFlowReconciler(f.ctx, f.a, f.infra, f.log) + if err != nil { + return nil, err + } + return reconciler, nil + } else { + reconciler, err := NewTerraformReconciler(f.a, f.log, f.stateInitializer) + if err != nil { + return nil, fmt.Errorf("failed to init terraform reconciler: %w", err) + } + return reconciler, nil + } +} + +func (s *StrategySelector) ShouldReconcileWithFlow(infrastructure *extensionsv1alpha1.Infrastructure, cluster *extensions.Cluster) (bool, error) { + hasState, err := s.hasFlowState(infrastructure.Status) + if err != nil { + return false, err + } + return hasState || HasFlowAnnotation(infrastructure, cluster), nil +} + +func (s *StrategySelector) Reconcile(useFlow bool, ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *extensions.Cluster) error { + reconciler, err := s.Factory.Build(useFlow) + if err != nil { + return err + } + status, err := reconciler.Reconcile(ctx, infra, cfg, cluster) + if err != nil { + return err + } + stateBytes, err := reconciler.GetState(ctx, status) + if err != nil { + return fmt.Errorf("failed to get infrastructure state: %w", err) + } + return patchProviderStatusAndState(ctx, infra, status, stateBytes, s.Client) +} + +func (s *StrategySelector) ShouldDeleteWithFlow(status extensionsv1alpha1.InfrastructureStatus) (bool, error) { + return s.hasFlowState(status) +} + +func (s *StrategySelector) hasFlowState(status extensionsv1alpha1.InfrastructureStatus) (bool, error) { + if status.State == nil { + return false, nil + } + state, err := shared.NewPersistentStateFromJSON(status.State.Raw) + if err != nil { + return false, fmt.Errorf("failed to read infrastructure state: %w", err) + } + if state == nil { // did not recognize flow Kind + return false, nil + } else { + return true, nil + } +} diff --git a/pkg/controller/infrastructure/strategyselector_test.go b/pkg/controller/infrastructure/strategyselector_test.go new file mode 100644 index 000000000..f0c1e95e3 --- /dev/null +++ b/pkg/controller/infrastructure/strategyselector_test.go @@ -0,0 +1,215 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infrastructure_test + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "github.com/gardener/gardener/pkg/apis/core/v1beta1" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + mockclient "github.com/gardener/gardener/pkg/mock/controller-runtime/client" + "github.com/golang/mock/gomock" + "github.com/google/go-cmp/cmp" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure" + "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/infraflow/shared" + imock "github.com/gardener/gardener-extension-provider-azure/pkg/controller/infrastructure/mock" + internalinfra "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" +) + +var _ = Describe("ShouldUseFlow", func() { + Context("without any flow annotation", func() { + It("should not use FlowReconciler", func() { + cluster := internalinfra.MakeCluster("11.0.0.0/16", "12.0.0.0/16", "europe", 1, 1) + Expect(infrastructure.HasFlowAnnotation(&extensionsv1alpha1.Infrastructure{}, cluster)).To(BeFalse()) + }) + }) + Context("with flow annotation in infrastruture", func() { + infra := &extensionsv1alpha1.Infrastructure{} + cluster := internalinfra.MakeCluster("11.0.0.0/16", "12.0.0.0/16", "europe", 1, 1) + metav1.SetMetaDataAnnotation(&infra.ObjectMeta, infrastructure.AnnotationKeyUseFlow, "true") + It("should use the FlowReconciler", func() { + Expect(infrastructure.HasFlowAnnotation(infra, cluster)).To(BeTrue()) + }) + }) + Context("with flow annotation in shoot", func() { + cluster := internalinfra.MakeCluster("11.0.0.0/16", "12.0.0.0/16", "europe", 1, 1) + metav1.SetMetaDataAnnotation(&cluster.Shoot.ObjectMeta, infrastructure.AnnotationKeyUseFlow, "true") + It("should use the FlowReconciler", func() { + Expect(infrastructure.HasFlowAnnotation(&extensionsv1alpha1.Infrastructure{}, cluster)).To(BeTrue()) + }) + }) + Context("with flow annotation in seed", func() { + cluster := internalinfra.MakeCluster("11.0.0.0/16", "12.0.0.0/16", "europe", 1, 1) + cluster.Seed = &v1beta1.Seed{} + metav1.SetMetaDataAnnotation(&cluster.Seed.ObjectMeta, infrastructure.AnnotationKeyUseFlow, "true") + It("should use the FlowReconciler", func() { + Expect(infrastructure.HasFlowAnnotation(&extensionsv1alpha1.Infrastructure{}, cluster)).To(BeTrue()) + }) + }) +}) + +var _ = Describe("ReconcilationStrategy", func() { + cluster := internalinfra.MakeCluster("11.0.0.0/16", "12.0.0.0/16", "europe", 1, 1) + It("should use Flow if an annotation is found", func() { + infra := &extensionsv1alpha1.Infrastructure{} + metav1.SetMetaDataAnnotation(&infra.ObjectMeta, infrastructure.AnnotationKeyUseFlow, "true") + + sut := infrastructure.StrategySelector{} + useFlow, err := sut.ShouldReconcileWithFlow(infra, cluster) + Expect(err).NotTo(HaveOccurred()) + Expect(useFlow).To(BeTrue()) + }) + It("should use Flow if resources were reconciled with Flow before, regardless of annotation", func() { + emptyState := shared.NewPersistentState() + stateRaw, err := emptyState.ToJSON() + Expect(err).NotTo(HaveOccurred()) + infra := &extensionsv1alpha1.Infrastructure{} + infra.Status.State = &runtime.RawExtension{Raw: stateRaw} + + sut := infrastructure.StrategySelector{} + useFlow, err := sut.ShouldReconcileWithFlow(infra, cluster) + Expect(err).NotTo(HaveOccurred()) + Expect(useFlow).To(BeTrue()) + }) + It("should use Terraform if no flow state is found and there is no flow annotation", func() { + infra := &extensionsv1alpha1.Infrastructure{} + infra.Status.State = &runtime.RawExtension{Raw: getRawTerraformState(`{"provider": "terraform"}`)} + + sut := infrastructure.StrategySelector{} + useFlow, err := sut.ShouldReconcileWithFlow(infra, cluster) + Expect(err).NotTo(HaveOccurred()) + Expect(useFlow).To(BeFalse()) + }) + + It("should delete with Terraform if resources were reconciled with Terraform", func() { + useFlow := false + stateRaw := getRawTerraformState(`{"provider": "terraform"}`) + + infra := &extensionsv1alpha1.Infrastructure{} + ctrl := gomock.NewController(GinkgoT()) + mockClient, patchedInfra := expectStatusAndStatePatch(ctrl, infra, stateRaw) + + sut := infrastructure.StrategySelector{ + Factory: MockFactory{ctrl, stateRaw}, + Client: mockClient, + } + err := sut.Reconcile(useFlow, context.TODO(), infra, &azure.InfrastructureConfig{}, cluster) + Expect(err).NotTo(HaveOccurred()) + + deleteWithFlow, err := sut.ShouldDeleteWithFlow(patchedInfra.Status) + Expect(err).NotTo(HaveOccurred()) + + Expect(deleteWithFlow).To(BeFalse()) + }) + It("should delete with Flow if resources were reconciled with Flow", func() { + useFlow := true + emptyState := shared.NewPersistentState() + stateRaw, err := emptyState.ToJSON() + Expect(err).NotTo(HaveOccurred()) + + infra := &extensionsv1alpha1.Infrastructure{} + ctrl := gomock.NewController(GinkgoT()) + mockClient, patchedInfra := expectStatusAndStatePatch(ctrl, infra, stateRaw) + sut := infrastructure.StrategySelector{ + Factory: MockFactory{ctrl, stateRaw}, + Client: mockClient, + } + + err = sut.Reconcile(useFlow, context.TODO(), infra, &azure.InfrastructureConfig{}, cluster) + Expect(err).NotTo(HaveOccurred()) + + resFlow, err := sut.ShouldDeleteWithFlow(patchedInfra.Status) + Expect(err).NotTo(HaveOccurred()) + + Expect(resFlow).To(BeTrue()) + }) + +}) + +func getRawTerraformState(jsonContent string) []byte { + state := infrastructure.InfrastructureState{ + TerraformState: &runtime.RawExtension{ + Raw: []byte(jsonContent), + }, + } + stateRaw, _ := json.Marshal(state) + return stateRaw +} + +func expectStatusAndStatePatch(ctrl *gomock.Controller, infra *extensionsv1alpha1.Infrastructure, expectedTfStateRaw []byte) (*mockclient.MockClient, *extensionsv1alpha1.Infrastructure) { + mClient := mockclient.NewMockClient(ctrl) + sw := mockclient.NewMockStatusWriter(ctrl) + mClient.EXPECT().Status().Return(sw).AnyTimes() + + patchedInfra := infra.DeepCopy() + patchedInfra.Status.State = &runtime.RawExtension{Raw: expectedTfStateRaw} + patchedInfra.Status.ProviderStatus = &runtime.RawExtension{Object: &v1alpha1.InfrastructureStatus{}} // reconciler mock returns an empty status + // expect patch with new State and Status + sw.EXPECT().Patch(gomock.Any(), EqMatcher(patchedInfra), gomock.Any()).Return(nil) + return mClient, patchedInfra +} + +type MockFactory struct { + *gomock.Controller + tfState []byte +} + +func (f MockFactory) Build(useFlow bool) (infrastructure.Reconciler, error) { + reconciler := imock.NewMockReconciler(f.Controller) + reconciler.EXPECT().Reconcile(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(&v1alpha1.InfrastructureStatus{}, nil) + if useFlow { + emptyState := shared.NewPersistentState() + byteState, err := emptyState.ToJSON() + if err != nil { + panic(err) + } + reconciler.EXPECT().GetState(gomock.Any(), gomock.Any()).Return(byteState, nil).AnyTimes() + } else { + reconciler.EXPECT().GetState(gomock.Any(), gomock.Any()).Return(f.tfState, nil).AnyTimes() + } + return reconciler, nil +} + +type eqMatcher struct { + want interface{} +} + +func EqMatcher(want interface{}) eqMatcher { + return eqMatcher{ + want: want, + } +} + +func (eq eqMatcher) Matches(got interface{}) bool { + return gomock.Eq(eq.want).Matches(got) +} + +func (eq eqMatcher) Got(got interface{}) string { + return fmt.Sprintf("%v (%T)\nDiff (-got +want):\n%s", got, got, strings.TrimSpace(cmp.Diff(got, eq.want))) +} + +func (eq eqMatcher) String() string { + return fmt.Sprintf("%v (%T)\n", eq.want, eq.want) +} diff --git a/pkg/controller/infrastructure/terraform_reconciler.go b/pkg/controller/infrastructure/terraform_reconciler.go new file mode 100644 index 000000000..82aeeca83 --- /dev/null +++ b/pkg/controller/infrastructure/terraform_reconciler.go @@ -0,0 +1,151 @@ +package infrastructure + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gardener/gardener/extensions/pkg/controller" + "github.com/gardener/gardener/extensions/pkg/terraformer" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" + azureclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal" + "github.com/gardener/gardener-extension-provider-azure/pkg/internal/infrastructure" +) + +// NewTerraformReconciler creates a new TerraformReconciler +func NewTerraformReconciler(a *actuator, logger logr.Logger, stateInitializer terraformer.StateConfigMapInitializer) (Reconciler, error) { + client := a.Client() + if client == nil { + return nil, fmt.Errorf("infrastructure actuator has no client set") + } + + return &TerraformReconciler{ + Client: client, + Logger: logger, + RestConfig: a.RESTConfig(), + DisableProjectedTokenMount: a.disableProjectedTokenMount, + StateInitializer: stateInitializer, + }, nil +} + +type TerraformReconciler struct { + Client client.Client + Logger logr.Logger + RestConfig *rest.Config + DisableProjectedTokenMount bool + StateInitializer terraformer.StateConfigMapInitializer + tf terraformer.Terraformer +} + +func (r *TerraformReconciler) Reconcile(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) (*v1alpha1.InfrastructureStatus, error) { + terraformFiles, err := infrastructure.RenderTerraformerTemplate(infra, cfg, cluster) + if err != nil { + return nil, err + } + + r.tf, err = internal.NewTerraformerWithAuth(r.Logger, r.RestConfig, infrastructure.TerraformerPurpose, infra, r.DisableProjectedTokenMount) + if err != nil { + return nil, err + } + + if err := r.tf. + InitializeWith(ctx, terraformer.DefaultInitializer(r.Client, terraformFiles.Main, terraformFiles.Variables, terraformFiles.TFVars, r.StateInitializer)). + Apply(ctx); err != nil { + + return nil, fmt.Errorf("failed to apply the terraform config: %w", err) + } + + status, err := infrastructure.ComputeTerraformStatus(ctx, r.tf, infra, cfg, cluster) + if err != nil { + return nil, err + } + return status, nil + +} + +func (r *TerraformReconciler) GetState(ctx context.Context, status *v1alpha1.InfrastructureStatus) ([]byte, error) { + + terraformState, err := r.tf.GetRawState(ctx) + if err != nil { + return nil, err + } + + stateByte, err := terraformState.Marshal() + if err != nil { + return nil, err + } + + infraState := InfrastructureState{ + SavedProviderStatus: &runtime.RawExtension{ + Object: status, + }, + TerraformState: &runtime.RawExtension{ + Raw: stateByte, + }, + } + return json.Marshal(infraState) +} + +func (r *TerraformReconciler) Delete(ctx context.Context, infra *extensionsv1alpha1.Infrastructure, cfg *azure.InfrastructureConfig, cluster *controller.Cluster) error { + tf, err := internal.NewTerraformer(r.Logger, r.RestConfig, infrastructure.TerraformerPurpose, infra, r.DisableProjectedTokenMount) + if err != nil { + return err + } + // terraform pod from previous reconciliation might still be running, ensure they are gone before doing any operations + if err := tf.EnsureCleanedUp(ctx); err != nil { + return err + } + + azureClientFactory, err := NewAzureClientFactory(ctx, r.Client, infra.Spec.SecretRef) + if err != nil { + return err + } + resourceGroupExists, err := infrastructure.IsShootResourceGroupAvailable(ctx, azureClientFactory, infra, cfg) + if err != nil { + if azureclient.IsAzureAPIUnauthorized(err) { + r.Logger.Error(err, "Failed to check resource group availability due to invalid credentials") + } else { + return err + } + } + + if !resourceGroupExists { + if !azureclient.IsAzureAPIUnauthorized(err) { + if err := infrastructure.DeleteNodeSubnetIfExists(ctx, azureClientFactory, infra, cfg); err != nil { + return err + } + } + + if err := tf.RemoveTerraformerFinalizerFromConfig(ctx); err != nil { + return err + } + + return tf.CleanupConfiguration(ctx) + } + + // If the Terraform state is empty then we can exit early as we didn't create anything. Though, we clean up potentially + // created configmaps/secrets related to the Terraformer. + stateIsEmpty := tf.IsStateEmpty(ctx) + if stateIsEmpty { + r.Logger.Info("exiting early as infrastructure state is empty - nothing to do") + return tf.CleanupConfiguration(ctx) + } + + terraformFiles, err := infrastructure.RenderTerraformerTemplate(infra, cfg, cluster) + if err != nil { + return err + } + + return tf. + InitializeWith(ctx, terraformer.DefaultInitializer(r.Client, terraformFiles.Main, terraformFiles.Variables, terraformFiles.TFVars, r.StateInitializer)). + SetEnvVars(internal.TerraformerEnvVars(infra.Spec.SecretRef)...). + Destroy(ctx) +} diff --git a/pkg/controller/worker/actuator.go b/pkg/controller/worker/actuator.go index 6d42f11b9..35d04274a 100644 --- a/pkg/controller/worker/actuator.go +++ b/pkg/controller/worker/actuator.go @@ -69,7 +69,10 @@ func (d *delegateFactory) WorkerDelegate(ctx context.Context, worker *extensions return nil, err } - factory := azureclient.NewAzureClientFactory(d.ClientContext.Client()) + factory, err := azureclient.NewAzureClientFactory(ctx, d.ClientContext.Client(), worker.Spec.SecretRef) + if err != nil { + return nil, err + } return NewWorkerDelegate(d.ClientContext, seedChartApplier, serverVersion.GitVersion, worker, cluster, factory) } diff --git a/pkg/controller/worker/machine_dependencies_test.go b/pkg/controller/worker/machine_dependencies_test.go index fc247e2c2..eeb5f121f 100644 --- a/pkg/controller/worker/machine_dependencies_test.go +++ b/pkg/controller/worker/machine_dependencies_test.go @@ -21,7 +21,8 @@ import ( "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/Azure/go-autorest/autorest" extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" @@ -30,7 +31,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/pointer" @@ -49,8 +49,7 @@ var _ = Describe("MachinesDependencies", func() { statusWriter *mockclient.MockStatusWriter factory *factorymock.MockFactory - ctx context.Context - secretRef corev1.SecretReference + ctx context.Context namespace, resourceGroupName, region string ) @@ -68,10 +67,6 @@ var _ = Describe("MachinesDependencies", func() { namespace = "shoot--foobar--azure" resourceGroupName = namespace region = "westeurope" - secretRef = corev1.SecretReference{ - Name: "secret", - Namespace: namespace, - } }) Describe("VMO Dependencies", func() { @@ -90,7 +85,7 @@ var _ = Describe("MachinesDependencies", func() { BeforeEach(func() { // Create a vmo client mock and let the factory always return the mocked vmo client. vmoClient = vmssmock.NewMockVmss(ctrl) - factory.EXPECT().Vmss(ctx, secretRef).AnyTimes().Return(vmoClient, nil) + factory.EXPECT().Vmss().AnyTimes().Return(vmoClient, nil) faultDomainCount = 3 cluster = makeCluster("", "westeurope", nil, nil, faultDomainCount) @@ -285,24 +280,24 @@ var _ = Describe("MachinesDependencies", func() { func expectVmoGetToSucceed(ctx context.Context, c *vmssmock.MockVmss, resourceGroupName, name, id string, faultDomainCount int32) { // As the vmo name (parameter 3) contains a random suffix, we use simply anything of type string for the mock. - c.EXPECT().Get(ctx, resourceGroupName, gomock.AssignableToTypeOf(""), compute.ExpandTypesForGetVMScaleSetsUserData).Return(&compute.VirtualMachineScaleSet{ - ID: pointer.String(id), - Name: pointer.String(name), - VirtualMachineScaleSetProperties: &compute.VirtualMachineScaleSetProperties{ + c.EXPECT().Get(ctx, resourceGroupName, gomock.AssignableToTypeOf(""), to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)).Return(&armcompute.VirtualMachineScaleSet{ + ID: pointer.StringPtr(id), + Name: pointer.StringPtr(name), + Properties: &armcompute.VirtualMachineScaleSetProperties{ PlatformFaultDomainCount: &faultDomainCount, }, }, nil) } -func expectVmoListToSucceed(ctx context.Context, c *vmssmock.MockVmss, resourceGroupName string, vmos ...compute.VirtualMachineScaleSet) { +func expectVmoListToSucceed(ctx context.Context, c *vmssmock.MockVmss, resourceGroupName string, vmos ...*armcompute.VirtualMachineScaleSet) { c.EXPECT().List(ctx, resourceGroupName).Return(vmos, nil) } func expectVmoCreateToSucceed(ctx context.Context, c *vmssmock.MockVmss, resourceGroupName, name, id string) { // As the vmo name (parameter 3) contains a random suffix, we use simply anything of type string for the mock. - c.EXPECT().Create(ctx, resourceGroupName, gomock.AssignableToTypeOf(""), gomock.AssignableToTypeOf(&compute.VirtualMachineScaleSet{})).Return(&compute.VirtualMachineScaleSet{ - ID: pointer.String(id), - Name: pointer.String(name), + c.EXPECT().CreateOrUpdate(ctx, resourceGroupName, gomock.AssignableToTypeOf(""), gomock.AssignableToTypeOf(armcompute.VirtualMachineScaleSet{})).Return(&armcompute.VirtualMachineScaleSet{ + ID: pointer.StringPtr(id), + Name: pointer.StringPtr(name), }, nil) } @@ -326,10 +321,10 @@ func generateWorkerStatusWithVmo(vmos ...v1alpha1.VmoDependency) *runtime.RawExt } } -func generateExpectedVmo(name, id string) compute.VirtualMachineScaleSet { - return compute.VirtualMachineScaleSet{ - ID: pointer.String(id), - Name: pointer.String(name), +func generateExpectedVmo(name, id string) *armcompute.VirtualMachineScaleSet { + return &armcompute.VirtualMachineScaleSet{ + ID: pointer.StringPtr(id), + Name: pointer.StringPtr(name), Tags: map[string]*string{ azure.MachineSetTagKey: pointer.String("1"), }, diff --git a/pkg/controller/worker/machineset_vmo.go b/pkg/controller/worker/machineset_vmo.go index 82baf2e44..4b0d15a39 100644 --- a/pkg/controller/worker/machineset_vmo.go +++ b/pkg/controller/worker/machineset_vmo.go @@ -20,7 +20,8 @@ import ( "reflect" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/gardener/gardener/pkg/utils" "k8s.io/utils/pointer" @@ -33,7 +34,7 @@ import ( func (w *workerDelegate) reconcileVmoDependencies(ctx context.Context, infrastructureStatus *azureapi.InfrastructureStatus, workerProviderStatus *azureapi.WorkerStatus) ([]azureapi.VmoDependency, error) { var vmoDependencies = copyVmoDependencies(workerProviderStatus) - vmoClient, err := w.clientFactory.Vmss(ctx, w.worker.Spec.SecretRef) + vmoClient, err := w.clientFactory.Vmss() if err != nil { return vmoDependencies, err } @@ -58,7 +59,7 @@ func (w *workerDelegate) reconcileVmoDependencies(ctx context.Context, infrastru func (w *workerDelegate) reconcileVMO(ctx context.Context, client azureclient.Vmss, dependencies []azureapi.VmoDependency, resourceGroupName, workerPoolName string, faultDomainCount int32) (*azureapi.VmoDependency, error) { var ( existingDependency *azureapi.VmoDependency - vmo *compute.VirtualMachineScaleSet + vmo *armcompute.VirtualMachineScaleSet err error ) @@ -72,7 +73,7 @@ func (w *workerDelegate) reconcileVMO(ctx context.Context, client azureclient.Vm // Try to fetch the VMO from Azure as it exists in the status. if existingDependency != nil { - vmo, err = client.Get(ctx, resourceGroupName, existingDependency.Name, compute.ExpandTypesForGetVMScaleSetsUserData) + vmo, err = client.Get(ctx, resourceGroupName, existingDependency.Name, to.Ptr(armcompute.ExpandTypesForGetVMScaleSetsUserData)) if err != nil { return nil, err } @@ -89,7 +90,7 @@ func (w *workerDelegate) reconcileVMO(ctx context.Context, client azureclient.Vm // VMO already exists. Check if the fault domain count configuration has been changed. // If yes then it is required to create a new VMO with the correct configuration. - if *vmo.PlatformFaultDomainCount != faultDomainCount { + if *vmo.Properties.PlatformFaultDomainCount != faultDomainCount { newVMO, err := generateAndCreateVmo(ctx, client, workerPoolName, resourceGroupName, w.worker.Spec.Region, faultDomainCount) if err != nil { return nil, err @@ -103,7 +104,7 @@ func (w *workerDelegate) reconcileVMO(ctx context.Context, client azureclient.Vm func (w *workerDelegate) cleanupVmoDependencies(ctx context.Context, infrastructureStatus *azureapi.InfrastructureStatus, workerProviderStatus *azureapi.WorkerStatus) ([]azureapi.VmoDependency, error) { var vmoDependencies = copyVmoDependencies(workerProviderStatus) - vmoClient, err := w.clientFactory.Vmss(ctx, w.worker.Spec.SecretRef) + vmoClient, err := w.clientFactory.Vmss() if err != nil { return vmoDependencies, err } @@ -191,7 +192,7 @@ func (w *workerDelegate) determineWorkerPoolVmoDependency(ctx context.Context, i } // Second: The vmo dependency was not found in the worker status. Check if a corresponding vmo exists on Azure. - vmoClient, err := w.clientFactory.Vmss(ctx, w.worker.Spec.SecretRef) + vmoClient, err := w.clientFactory.Vmss() if err != nil { return nil, err } @@ -202,13 +203,13 @@ func (w *workerDelegate) determineWorkerPoolVmoDependency(ctx context.Context, i } vmoList := filterGardenerManagedVmos(vmoListAll) - var existingVmo *compute.VirtualMachineScaleSet + var existingVmo *armcompute.VirtualMachineScaleSet for _, vmo := range vmoList { if vmo.Name != nil && strings.Contains(*vmo.Name, workerPoolName) { if existingVmo != nil { return nil, fmt.Errorf("found multiple vmos for workerpool %q in resource group %q", workerPoolName, infrastructureStatus.ResourceGroup.Name) } - vmoSnapshot := &vmo + vmoSnapshot := vmo existingVmo = vmoSnapshot } } @@ -241,10 +242,10 @@ func (w *workerDelegate) determineWorkerPoolVmoDependency(ctx context.Context, i // VMO Helper func generateAndCreateVmo(ctx context.Context, client azureclient.Vmss, workerPoolName, resourceGroupName, region string, faultDomainCount int32) (*azureapi.VmoDependency, error) { - var properties = &compute.VirtualMachineScaleSet{ + var properties = armcompute.VirtualMachineScaleSet{ Location: ®ion, - VirtualMachineScaleSetProperties: &compute.VirtualMachineScaleSetProperties{ - SinglePlacementGroup: pointer.Bool(false), + Properties: &armcompute.VirtualMachineScaleSetProperties{ + SinglePlacementGroup: pointer.BoolPtr(false), PlatformFaultDomainCount: &faultDomainCount, }, Tags: map[string]*string{ @@ -257,7 +258,7 @@ func generateAndCreateVmo(ctx context.Context, client azureclient.Vmss, workerPo return nil, err } - newVMO, err := client.Create(ctx, resourceGroupName, fmt.Sprintf("vmo-%s-%s", workerPoolName, randomString), properties) + newVMO, err := client.CreateOrUpdate(ctx, resourceGroupName, fmt.Sprintf("vmo-%s-%s", workerPoolName, randomString), properties) if err != nil { return nil, err } @@ -304,8 +305,8 @@ func removeVmoDependency(dependencies []azureapi.VmoDependency, dependency azure return dependencies } -func filterGardenerManagedVmos(list []compute.VirtualMachineScaleSet) []compute.VirtualMachineScaleSet { - var filteredList = []compute.VirtualMachineScaleSet{} +func filterGardenerManagedVmos(list []*armcompute.VirtualMachineScaleSet) []*armcompute.VirtualMachineScaleSet { + var filteredList = []*armcompute.VirtualMachineScaleSet{} for _, vmo := range list { if _, hasTag := vmo.Tags[azure.MachineSetTagKey]; hasTag { filteredList = append(filteredList, vmo) @@ -314,7 +315,7 @@ func filterGardenerManagedVmos(list []compute.VirtualMachineScaleSet) []compute. return filteredList } -func generateVmoDependency(vmo *compute.VirtualMachineScaleSet, workerPoolName string) *azureapi.VmoDependency { +func generateVmoDependency(vmo *armcompute.VirtualMachineScaleSet, workerPoolName string) *azureapi.VmoDependency { return &azureapi.VmoDependency{ ID: *vmo.ID, Name: *vmo.Name, diff --git a/pkg/internal/auth.go b/pkg/internal/auth.go index 3045977d9..627247abc 100644 --- a/pkg/internal/auth.go +++ b/pkg/internal/auth.go @@ -18,6 +18,7 @@ import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" azureautorest "github.com/Azure/go-autorest/autorest" azureauth "github.com/Azure/go-autorest/autorest/azure/auth" extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller" @@ -31,13 +32,18 @@ import ( // ClientAuth represents a Azure Client Auth credentials. type ClientAuth struct { // SubscriptionID is the Azure subscription ID. - SubscriptionID string + SubscriptionID string `yaml:"subscriptionID"` // TenantID is the Azure tenant ID. - TenantID string + TenantID string `yaml:"tenantID"` // ClientID is the Azure client ID. - ClientID string + ClientID string `yaml:"clientID"` // ClientSecret is the Azure client secret. - ClientSecret string + ClientSecret string `yaml:"clientSecret"` +} + +// GetAzClientCredentials returns the credential struct consumed by the Azure client +func (clientAuth ClientAuth) GetAzClientCredentials() (*azidentity.ClientSecretCredential, error) { + return azidentity.NewClientSecretCredential(clientAuth.TenantID, clientAuth.ClientID, clientAuth.ClientSecret, nil) } // GetClientAuthData retrieves the client auth data specified by the secret reference. @@ -47,11 +53,11 @@ func GetClientAuthData(ctx context.Context, c client.Client, secretRef corev1.Se return nil, err } - return ReadClientAuthDataFromSecret(secret, allowDNSKeys) + return NewClientAuthDataFromSecret(secret, allowDNSKeys) } -// ReadClientAuthDataFromSecret reads the client auth details from the given secret. -func ReadClientAuthDataFromSecret(secret *corev1.Secret, allowDNSKeys bool) (*ClientAuth, error) { +// NewClientAuthDataFromSecret reads the client auth details from the given secret. +func NewClientAuthDataFromSecret(secret *corev1.Secret, allowDNSKeys bool) (*ClientAuth, error) { var altSubscriptionIDIDKey, altTenantIDKey, altClientIDKey, altClientSecretKey *string if allowDNSKeys { altSubscriptionIDIDKey = pointer.String(azure.DNSSubscriptionIDKey) @@ -88,15 +94,19 @@ func ReadClientAuthDataFromSecret(secret *corev1.Secret, allowDNSKeys bool) (*Cl }, nil } -// GetAuthorizerAndSubscriptionID retrieves the client auth data specified by the secret reference +// GetAuthorizerAndSubscriptionIDFromSecretRef retrieves the client auth data specified by the secret reference // to create and return an Azure Authorizer and a subscription id. -func GetAuthorizerAndSubscriptionID(ctx context.Context, c client.Client, secretRef corev1.SecretReference, allowDNSKeys bool) (azureautorest.Authorizer, string, error) { +func GetAuthorizerAndSubscriptionIDFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference, allowDNSKeys bool) (azureautorest.Authorizer, string, error) { clientAuth, err := GetClientAuthData(ctx, c, secretRef, allowDNSKeys) if err != nil { return nil, "", err } - clientCredentialsConfig := azureauth.NewClientCredentialsConfig(clientAuth.ClientID, clientAuth.ClientSecret, clientAuth.TenantID) + return GetAuthorizerAndSubscriptionID(clientAuth) +} +// GetAuthorizerAndSubscriptionID creates and returns an Azure Authorizer and a subscription id +func GetAuthorizerAndSubscriptionID(clientAuth *ClientAuth) (azureautorest.Authorizer, string, error) { + clientCredentialsConfig := azureauth.NewClientCredentialsConfig(clientAuth.ClientID, clientAuth.ClientSecret, clientAuth.TenantID) authorizer, err := clientCredentialsConfig.Authorizer() if err != nil { return nil, "", err diff --git a/pkg/internal/auth_test.go b/pkg/internal/auth_test.go index 5a176881f..db6e2e6d3 100644 --- a/pkg/internal/auth_test.go +++ b/pkg/internal/auth_test.go @@ -84,9 +84,9 @@ var _ = Describe("Azure Auth", func() { ctrl.Finish() }) - Describe("#ReadClientAuthDataFromSecret", func() { + Describe("#NewClientAuthDataFromSecret", func() { It("should read the client auth data from the secret", func() { - actual, err := ReadClientAuthDataFromSecret(secret, false) + actual, err := NewClientAuthDataFromSecret(secret, false) Expect(err).NotTo(HaveOccurred()) Expect(actual).To(Equal(clientAuth)) }) @@ -163,7 +163,7 @@ var _ = Describe("Azure Auth", func() { return nil }) - authorizer, subscription, err := GetAuthorizerAndSubscriptionID(ctx, c, secretRef, false) + authorizer, subscription, err := GetAuthorizerAndSubscriptionIDFromSecretRef(ctx, c, secretRef, false) Expect(err).NotTo(HaveOccurred()) Expect(subscription).To(ContainSubstring(subscriptionID)) diff --git a/pkg/internal/infrastructure/helper.go b/pkg/internal/infrastructure/helper.go index 9cea5264a..8e940a17c 100644 --- a/pkg/internal/infrastructure/helper.go +++ b/pkg/internal/infrastructure/helper.go @@ -16,22 +16,67 @@ package infrastructure import ( "context" + "encoding/json" "fmt" "strings" + "github.com/gardener/gardener/extensions/pkg/controller" + gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" api "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure" + apiv1alpha1 "github.com/gardener/gardener-extension-provider-azure/pkg/apis/azure/v1alpha1" azureclient "github.com/gardener/gardener-extension-provider-azure/pkg/azure/client" ) +// MakeCluster returns a cluster object used for testing. +func MakeCluster(pods, services string, region string, countFaultDomain, countUpdateDomain int32) *controller.Cluster { + var ( + shoot = gardencorev1beta1.Shoot{ + Spec: gardencorev1beta1.ShootSpec{ + Networking: gardencorev1beta1.Networking{ + Pods: &pods, + Services: &services, + }, + }, + } + cloudProfileConfig = apiv1alpha1.CloudProfileConfig{ + TypeMeta: metav1.TypeMeta{ + APIVersion: apiv1alpha1.SchemeGroupVersion.String(), + Kind: "CloudProfileConfig", + }, + CountFaultDomains: []apiv1alpha1.DomainCount{ + {Region: region, Count: countFaultDomain}, + }, + CountUpdateDomains: []apiv1alpha1.DomainCount{ + {Region: region, Count: countUpdateDomain}, + }, + } + cloudProfileConfigJSON, _ = json.Marshal(cloudProfileConfig) + cloudProfile = gardencorev1beta1.CloudProfile{ + Spec: gardencorev1beta1.CloudProfileSpec{ + ProviderConfig: &runtime.RawExtension{ + Raw: cloudProfileConfigJSON, + }, + }, + } + ) + + return &controller.Cluster{ + Shoot: &shoot, + CloudProfile: &cloudProfile, + } +} + // IsShootResourceGroupAvailable determines if the managed resource group exists on Azure. func IsShootResourceGroupAvailable(ctx context.Context, factory azureclient.Factory, infra *extensionsv1alpha1.Infrastructure, infraConfig *api.InfrastructureConfig) (bool, error) { if infraConfig.ResourceGroup != nil { return true, nil } - groupClient, err := factory.Group(ctx, infra.Spec.SecretRef) + groupClient, err := factory.Group() if err != nil { return false, err } @@ -54,7 +99,7 @@ func DeleteNodeSubnetIfExists(ctx context.Context, factory azureclient.Factory, return nil } - subnetClient, err := factory.Subnet(ctx, infra.Spec.SecretRef) + subnetClient, err := factory.Subnet() if err != nil { return err } diff --git a/pkg/internal/infrastructure/helper_test.go b/pkg/internal/infrastructure/helper_test.go index 2a35fd76e..44a88c1c8 100644 --- a/pkg/internal/infrastructure/helper_test.go +++ b/pkg/internal/infrastructure/helper_test.go @@ -18,8 +18,8 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo/v2" @@ -72,10 +72,10 @@ var _ = Describe("InfrastructureHelper", func() { }) Describe("#IsShootResourceGroupAvailable", func() { - var azureGroupClient *mockazureclient.MockGroup + var azureGroupClient *mockazureclient.MockResourceGroup BeforeEach(func() { - azureGroupClient = mockazureclient.NewMockGroup(ctrl) + azureGroupClient = mockazureclient.NewMockResourceGroup(ctrl) infraConfig.ResourceGroup = nil }) @@ -88,8 +88,8 @@ var _ = Describe("InfrastructureHelper", func() { }) It("should return true as resource group exists", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) - azureGroupClient.EXPECT().Get(ctx, clusterName).Return(&resources.Group{Name: &clusterName}, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) + azureGroupClient.EXPECT().Get(ctx, clusterName).Return(&armresources.ResourceGroup{Name: &clusterName}, nil) resourceGroupAvailable, err := IsShootResourceGroupAvailable(ctx, azureClientFactory, infra, infraConfig) @@ -98,7 +98,7 @@ var _ = Describe("InfrastructureHelper", func() { }) It("should return false as resource group does not exists", func() { - azureClientFactory.EXPECT().Group(ctx, infra.Spec.SecretRef).Return(azureGroupClient, nil) + azureClientFactory.EXPECT().Group().Return(azureGroupClient, nil) azureGroupClient.EXPECT().Get(ctx, clusterName).Return(nil, nil) resourceGroupAvailable, err := IsShootResourceGroupAvailable(ctx, azureClientFactory, infra, infraConfig) @@ -112,7 +112,7 @@ var _ = Describe("InfrastructureHelper", func() { var ( azureSubnetClient *mockazureclient.MockSubnet baseSubnetName string - subnetList []network.Subnet + subnetList []*armnetwork.Subnet vnetName string vnetResourceGroup string ) @@ -120,7 +120,7 @@ var _ = Describe("InfrastructureHelper", func() { BeforeEach(func() { azureSubnetClient = mockazureclient.NewMockSubnet(ctrl) baseSubnetName = fmt.Sprintf("%s-nodes", clusterName) - subnetList = []network.Subnet{} + subnetList = []*armnetwork.Subnet{} vnetName = "test-vnet" vnetResourceGroup = "test-vnet-rg" @@ -140,9 +140,9 @@ var _ = Describe("InfrastructureHelper", func() { }) It("should delete exact name matching subnet in foreign virtual network", func() { - subnetList = append(subnetList, network.Subnet{Name: &baseSubnetName}) + subnetList = append(subnetList, &armnetwork.Subnet{Name: &baseSubnetName}) - azureClientFactory.EXPECT().Subnet(ctx, infra.Spec.SecretRef).Return(azureSubnetClient, nil) + azureClientFactory.EXPECT().Subnet().Return(azureSubnetClient, nil) azureSubnetClient.EXPECT().List(ctx, vnetResourceGroup, vnetName).Return(subnetList, nil) azureSubnetClient.EXPECT().Delete(ctx, vnetResourceGroup, vnetName, baseSubnetName) @@ -152,9 +152,9 @@ var _ = Describe("InfrastructureHelper", func() { It("should delete name matching subnet in foreign virtual network", func() { subnetName := fmt.Sprintf("%s-z2", baseSubnetName) - subnetList = append(subnetList, network.Subnet{Name: &subnetName}) + subnetList = append(subnetList, &armnetwork.Subnet{Name: &subnetName}) - azureClientFactory.EXPECT().Subnet(ctx, infra.Spec.SecretRef).Return(azureSubnetClient, nil) + azureClientFactory.EXPECT().Subnet().Return(azureSubnetClient, nil) azureSubnetClient.EXPECT().List(ctx, vnetResourceGroup, vnetName).Return(subnetList, nil) azureSubnetClient.EXPECT().Delete(ctx, vnetResourceGroup, vnetName, subnetName) @@ -164,9 +164,9 @@ var _ = Describe("InfrastructureHelper", func() { It("should delete no subnet in foreign virtual network as none is name matching", func() { subnetName := "test-abc" - subnetList = append(subnetList, network.Subnet{Name: &subnetName}) + subnetList = append(subnetList, &armnetwork.Subnet{Name: &subnetName}) - azureClientFactory.EXPECT().Subnet(ctx, infra.Spec.SecretRef).Return(azureSubnetClient, nil) + azureClientFactory.EXPECT().Subnet().Return(azureSubnetClient, nil) azureSubnetClient.EXPECT().List(ctx, vnetResourceGroup, vnetName).Return(subnetList, nil) err := DeleteNodeSubnetIfExists(ctx, azureClientFactory, infra, infraConfig) diff --git a/pkg/internal/infrastructure/terraform.go b/pkg/internal/infrastructure/terraform.go index ac0c2936c..a3ebefa4c 100644 --- a/pkg/internal/infrastructure/terraform.go +++ b/pkg/internal/infrastructure/terraform.go @@ -509,8 +509,8 @@ func StatusFromTerraformState(config *api.InfrastructureConfig, tfState *Terrafo return &infraState } -// ComputeStatus computes the status based on the Terraformer and the given InfrastructureConfig. -func ComputeStatus(ctx context.Context, tf terraformer.Terraformer, infra *extensionsv1alpha1.Infrastructure, config *api.InfrastructureConfig, cluster *controller.Cluster) (*apiv1alpha1.InfrastructureStatus, error) { +// ComputeTerraformStatus computes the status based on the Terraformer and the given InfrastructureConfig. +func ComputeTerraformStatus(ctx context.Context, tf terraformer.Terraformer, infra *extensionsv1alpha1.Infrastructure, config *api.InfrastructureConfig, cluster *controller.Cluster) (*apiv1alpha1.InfrastructureStatus, error) { state, err := ExtractTerraformState(ctx, tf, infra, config, cluster) if err != nil { return nil, err diff --git a/pkg/internal/infrastructure/terraform_test.go b/pkg/internal/infrastructure/terraform_test.go index b9c75899e..5b5481091 100644 --- a/pkg/internal/infrastructure/terraform_test.go +++ b/pkg/internal/infrastructure/terraform_test.go @@ -18,7 +18,6 @@ import ( "encoding/json" "github.com/gardener/gardener/extensions/pkg/controller" - gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -32,44 +31,6 @@ import ( "github.com/gardener/gardener-extension-provider-azure/pkg/azure" ) -func makeCluster(pods, services string, region string, countFaultDomain, countUpdateDomain int32) *controller.Cluster { - var ( - shoot = gardencorev1beta1.Shoot{ - Spec: gardencorev1beta1.ShootSpec{ - Networking: gardencorev1beta1.Networking{ - Pods: &pods, - Services: &services, - }, - }, - } - cloudProfileConfig = apiv1alpha1.CloudProfileConfig{ - TypeMeta: metav1.TypeMeta{ - APIVersion: apiv1alpha1.SchemeGroupVersion.String(), - Kind: "CloudProfileConfig", - }, - CountFaultDomains: []apiv1alpha1.DomainCount{ - {Region: region, Count: countFaultDomain}, - }, - CountUpdateDomains: []apiv1alpha1.DomainCount{ - {Region: region, Count: countUpdateDomain}, - }, - } - cloudProfileConfigJSON, _ = json.Marshal(cloudProfileConfig) - cloudProfile = gardencorev1beta1.CloudProfile{ - Spec: gardencorev1beta1.CloudProfileSpec{ - ProviderConfig: &runtime.RawExtension{ - Raw: cloudProfileConfigJSON, - }, - }, - } - ) - - return &controller.Cluster{ - Shoot: &shoot, - CloudProfile: &cloudProfile, - } -} - var _ = Describe("Terraform", func() { var ( infra *extensionsv1alpha1.Infrastructure @@ -127,7 +88,7 @@ var _ = Describe("Terraform", func() { }, } - cluster = makeCluster("11.0.0.0/16", "12.0.0.0/16", infra.Spec.Region, countFaultDomain, countUpdateDomain) + cluster = MakeCluster("11.0.0.0/16", "12.0.0.0/16", infra.Spec.Region, countFaultDomain, countUpdateDomain) }) Describe("#ComputeTerraformerTemplateValues", func() { diff --git a/pkg/mock/vmss/mocks.go b/pkg/mock/vmss/mocks.go index 4b8e1ec62..4caad4e13 100644 --- a/pkg/mock/vmss/mocks.go +++ b/pkg/mock/vmss/mocks.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - compute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-03-01/compute" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" gomock "github.com/golang/mock/gomock" ) @@ -35,19 +35,19 @@ func (m *MockVmss) EXPECT() *MockVmssMockRecorder { return m.recorder } -// Create mocks base method. -func (m *MockVmss) Create(arg0 context.Context, arg1, arg2 string, arg3 *compute.VirtualMachineScaleSet) (*compute.VirtualMachineScaleSet, error) { +// CreateOrUpdate mocks base method. +func (m *MockVmss) CreateOrUpdate(arg0 context.Context, arg1, arg2 string, arg3 armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*compute.VirtualMachineScaleSet) + ret := m.ctrl.Call(m, "CreateOrUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSet) ret1, _ := ret[1].(error) return ret0, ret1 } -// Create indicates an expected call of Create. -func (mr *MockVmssMockRecorder) Create(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockVmssMockRecorder) CreateOrUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockVmss)(nil).Create), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockVmss)(nil).CreateOrUpdate), arg0, arg1, arg2, arg3) } // Delete mocks base method. @@ -65,10 +65,10 @@ func (mr *MockVmssMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomo } // Get mocks base method. -func (m *MockVmss) Get(arg0 context.Context, arg1, arg2 string, arg3 compute.ExpandTypesForGetVMScaleSets) (*compute.VirtualMachineScaleSet, error) { +func (m *MockVmss) Get(arg0 context.Context, arg1, arg2 string, arg3 *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*compute.VirtualMachineScaleSet) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSet) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -80,10 +80,10 @@ func (mr *MockVmssMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock. } // List mocks base method. -func (m *MockVmss) List(arg0 context.Context, arg1 string) ([]compute.VirtualMachineScaleSet, error) { +func (m *MockVmss) List(arg0 context.Context, arg1 string) ([]*armcompute.VirtualMachineScaleSet, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "List", arg0, arg1) - ret0, _ := ret[0].([]compute.VirtualMachineScaleSet) + ret0, _ := ret[0].([]*armcompute.VirtualMachineScaleSet) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/test/integration/bastion/bastion_test.go b/test/integration/bastion/bastion_test.go index 884a7fd72..4e08df4a5 100644 --- a/test/integration/bastion/bastion_test.go +++ b/test/integration/bastion/bastion_test.go @@ -674,6 +674,20 @@ func checkSecurityRuleDoesNotExist(ctx context.Context, az *azureClientSet, opti Expect(ignoreAzureNotFoundError(err)).To(Succeed()) } +// ruleExist is similar to bastionctrl.RuleExist but for the old network client +func ruleExist(ruleName *string, rules *[]network.SecurityRule) bool { + if ruleName == nil { + return false + } + + for _, rule := range *rules { + if rule.Name != nil && *rule.Name == *ruleName { + return true + } + } + return false +} + func verifyCreation(ctx context.Context, az *azureClientSet, options *bastionctrl.Options) { By("RuleExist") // does not have authorization to performsecurityRules get due to global rule. use security group to check it. @@ -681,9 +695,9 @@ func verifyCreation(ctx context.Context, az *azureClientSet, options *bastionctr Expect(err).NotTo(HaveOccurred()) // bastion NSG - Check Ingress / Egress firewalls created - bastionctrl.RuleExist(pointer.String(bastionctrl.NSGIngressAllowSSHResourceNameIPv4(options.BastionInstanceName)), sg.SecurityRules) - bastionctrl.RuleExist(pointer.String(bastionctrl.NSGEgressDenyAllResourceName(options.BastionInstanceName)), sg.SecurityRules) - bastionctrl.RuleExist(pointer.String(bastionctrl.NSGEgressAllowOnlyResourceName(options.BastionInstanceName)), sg.SecurityRules) + ruleExist(pointer.StringPtr(bastionctrl.NSGIngressAllowSSHResourceNameIPv4(options.BastionInstanceName)), sg.SecurityRules) + ruleExist(pointer.StringPtr(bastionctrl.NSGEgressDenyAllResourceName(options.BastionInstanceName)), sg.SecurityRules) + ruleExist(pointer.StringPtr(bastionctrl.NSGEgressAllowOnlyResourceName(options.BastionInstanceName)), sg.SecurityRules) By("checking bastion instance") // bastion instance diff --git a/test/integration/infrastructure/helper_test.go b/test/integration/infrastructure/helper_test.go new file mode 100644 index 000000000..54f8a9c9f --- /dev/null +++ b/test/integration/infrastructure/helper_test.go @@ -0,0 +1,100 @@ +// Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infrastructure_test + +import ( + "encoding/base64" + "flag" + "os" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "gopkg.in/yaml.v2" +) + +func setConfigVariablesFromFlags() { + flag.Parse() + if *secretYamlPath != "" { + auth := readAuthFromFile(*secretYamlPath) + clientId = &auth.ClientID + clientSecret = &auth.ClientSecret + subscriptionId = &auth.SubscriptionID + tenantId = &auth.TenantID + } else { + validateFlags() + } +} + +func validateFlags() { + if len(*clientId) == 0 { + panic("client-id flag is not specified") + } + if len(*clientSecret) == 0 { + panic("client-secret flag is not specified") + } + if len(*subscriptionId) == 0 { + panic("subscription-id flag is not specified") + } + if len(*tenantId) == 0 { + panic("tenant-id flag is not specified") + } + if len(*region) == 0 { + panic("region flag is not specified") + } +} + +// ClientAuth represents a Azure Client Auth credentials. +type ClientAuth struct { + // SubscriptionID is the Azure subscription ID. + SubscriptionID string `yaml:"subscriptionID"` + // TenantID is the Azure tenant ID. + TenantID string `yaml:"tenantID"` + // ClientID is the Azure client ID. + ClientID string `yaml:"clientID"` + // ClientSecret is the Azure client secret. + ClientSecret string `yaml:"clientSecret"` +} + +func (clientAuth ClientAuth) GetAzClientCredentials() (*azidentity.ClientSecretCredential, error) { + return azidentity.NewClientSecretCredential(clientAuth.TenantID, clientAuth.ClientID, clientAuth.ClientSecret, nil) +} + +type ProviderSecret struct { + Data ClientAuth `yaml:"data"` +} + +func readAuthFromFile(fileName string) ClientAuth { + secret := ProviderSecret{} + data, err := os.ReadFile(fileName) + if err != nil { + panic(err) + } + err = yaml.Unmarshal(data, &secret) + if err != nil { + panic(err) + } + secret.Data.ClientID = decodeString(secret.Data.ClientID) + secret.Data.ClientSecret = decodeString(secret.Data.ClientSecret) + secret.Data.SubscriptionID = decodeString(secret.Data.SubscriptionID) + secret.Data.TenantID = decodeString(secret.Data.TenantID) + return secret.Data +} + +func decodeString(s string) string { + res, err := base64.StdEncoding.DecodeString(s) + if err != nil { + panic(err) + } + return string(res) +} diff --git a/test/integration/infrastructure/infrastructure_test.go b/test/integration/infrastructure/infrastructure_test.go index 55ac7eca5..1ff0444bc 100644 --- a/test/integration/infrastructure/infrastructure_test.go +++ b/test/integration/infrastructure/infrastructure_test.go @@ -75,26 +75,10 @@ var ( subscriptionId = flag.String("subscription-id", "", "Azure subscription ID") tenantId = flag.String("tenant-id", "", "Azure tenant ID") region = flag.String("region", "", "Azure region") + secretYamlPath = flag.String("secret-path", "", "Yaml file with secret including Azure credentials") + useFlow = flag.Bool("use-flow", false, "Set annotation to use flow for reconcilation") ) -func validateFlags() { - if len(*clientId) == 0 { - panic("client-id flag is not specified") - } - if len(*clientSecret) == 0 { - panic("client-secret flag is not specified") - } - if len(*subscriptionId) == 0 { - panic("subscription-id flag is not specified") - } - if len(*tenantId) == 0 { - panic("tenant-id flag is not specified") - } - if len(*region) == 0 { - panic("region flag is not specified") - } -} - type azureClientSet struct { groups resources.GroupsClient vnet network.VirtualNetworksClient @@ -176,9 +160,7 @@ var ( ) var _ = BeforeSuite(func() { - flag.Parse() - validateFlags() - + setConfigVariablesFromFlags() internalChartsPath := azure.InternalChartsPath repoRoot := filepath.Join("..", "..", "..") azure.InternalChartsPath = filepath.Join(repoRoot, azure.InternalChartsPath) @@ -322,7 +304,6 @@ var _ = Describe("Infrastructure tests", func() { It("should successfully create and delete a zonal cluster with NatGateway using an existing vNet and identity", func() { foreignName, err := generateName() Expect(err).ToNot(HaveOccurred()) - var cleanupHandle framework.CleanupActionHandle cleanupHandle = framework.AddCleanupAction(func() { Expect(ignoreAzureNotFoundError(teardownResourceGroup(ctx, clientSet, foreignName))).To(Succeed()) @@ -575,6 +556,11 @@ func runTest( return err } + By("set flow annotation (based on config)") + if *useFlow { + metav1.SetMetaDataAnnotation(&infra.ObjectMeta, infrastructure.AnnotationKeyUseFlow, "true") + } + if err := c.Create(ctx, infra); err != nil { return err } @@ -1042,6 +1028,7 @@ func verifyDeletion( az *azureClientSet, identifier azureIdentifier, ) { + Expect(identifier.resourceGroup).To(Not(BeEmpty())) _, err := az.groups.Get(ctx, identifier.resourceGroup) Expect(err).To(HaveOccurred()) Expect(err).To(BeNotFoundError()) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md new file mode 100644 index 000000000..16e7423d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -0,0 +1,486 @@ +# Release History + +## 1.1.4 (2022-10-06) + +### Bugs Fixed +* Don't retry a request if the `Retry-After` delay is greater than the configured `RetryOptions.MaxRetryDelay`. +* `runtime.JoinPaths`: do not unconditionally add a forward slash before the query string + +### Other Changes +* Removed logging URL from retry policy as it's redundant. +* Retry policy logs when it exits due to a non-retriable status code. + +## 1.1.3 (2022-09-01) + +### Bugs Fixed +* Adjusted the initial retry delay to 800ms per the Azure SDK guidelines. + +## 1.1.2 (2022-08-09) + +### Other Changes +* Fixed various doc bugs. + +## 1.1.1 (2022-06-30) + +### Bugs Fixed +* Avoid polling when a RELO LRO synchronously terminates. + +## 1.1.0 (2022-06-03) + +### Other Changes +* The one-second floor for `Frequency` when calling `PollUntilDone()` has been removed when running tests. + +## 1.0.0 (2022-05-12) + +### Features Added +* Added interface `runtime.PollingHandler` to support custom poller implementations. + * Added field `PollingHandler` of this type to `runtime.NewPollerOptions[T]` and `runtime.NewPollerFromResumeTokenOptions[T]`. + +### Breaking Changes +* Renamed `cloud.Configuration.LoginEndpoint` to `.ActiveDirectoryAuthorityHost` +* Renamed `cloud.AzurePublicCloud` to `cloud.AzurePublic` +* Removed `AuxiliaryTenants` field from `arm/ClientOptions` and `arm/policy/BearerTokenOptions` +* Removed `TokenRequestOptions.TenantID` +* `Poller[T].PollUntilDone()` now takes an `options *PollUntilDoneOptions` param instead of `freq time.Duration` +* Removed `arm/runtime.Poller[T]`, `arm/runtime.NewPoller[T]()` and `arm/runtime.NewPollerFromResumeToken[T]()` +* Removed `arm/runtime.FinalStateVia` and related `const` values +* Renamed `runtime.PageProcessor` to `runtime.PagingHandler` +* The `arm/runtime.ProviderRepsonse` and `arm/runtime.Provider` types are no longer exported. +* Renamed `NewRequestIdPolicy()` to `NewRequestIDPolicy()` +* `TokenCredential.GetToken` now returns `AccessToken` by value. + +### Bugs Fixed +* When per-try timeouts are enabled, only cancel the context after the body has been read and closed. +* The `Operation-Location` poller now properly handles `final-state-via` values. +* Improvements in `runtime.Poller[T]` + * `Poll()` shouldn't cache errors, allowing for additional retries when in a non-terminal state. + * `Result()` will cache the terminal result or error but not transient errors, allowing for additional retries. + +### Other Changes +* Updated to latest `internal` module and absorbed breaking changes. + * Use `temporal.Resource` and deleted copy. +* The internal poller implementation has been refactored. + * The implementation in `internal/pollers/poller.go` has been merged into `runtime/poller.go` with some slight modification. + * The internal poller types had their methods updated to conform to the `runtime.PollingHandler` interface. + * The creation of resume tokens has been refactored so that implementers of `runtime.PollingHandler` don't need to know about it. +* `NewPipeline()` places policies from `ClientOptions` after policies from `PipelineOptions` +* Default User-Agent headers no longer include `azcore` version information + +## 0.23.1 (2022-04-14) + +### Bugs Fixed +* Include XML header when marshalling XML content. +* Handle XML namespaces when searching for error code. +* Handle `odata.error` when searching for error code. + +## 0.23.0 (2022-04-04) + +### Features Added +* Added `runtime.Pager[T any]` and `runtime.Poller[T any]` supporting types for central, generic, implementations. +* Added `cloud` package with a new API for cloud configuration +* Added `FinalStateVia` field to `runtime.NewPollerOptions[T any]` type. + +### Breaking Changes +* Removed the `Poller` type-alias to the internal poller implementation. +* Added `Ptr[T any]` and `SliceOfPtrs[T any]` in the `to` package and removed all non-generic implementations. +* `NullValue` and `IsNullValue` now take a generic type parameter instead of an interface func parameter. +* Replaced `arm.Endpoint` with `cloud` API + * Removed the `endpoint` parameter from `NewRPRegistrationPolicy()` + * `arm/runtime.NewPipeline()` and `.NewRPRegistrationPolicy()` now return an `error` +* Refactored `NewPoller` and `NewPollerFromResumeToken` funcs in `arm/runtime` and `runtime` packages. + * Removed the `pollerID` parameter as it's no longer required. + * Created optional parameter structs and moved optional parameters into them. +* Changed `FinalStateVia` field to a `const` type. + +### Other Changes +* Converted expiring resource and dependent types to use generics. + +## 0.22.0 (2022-03-03) + +### Features Added +* Added header `WWW-Authenticate` to the default allow-list of headers for logging. +* Added a pipeline policy that enables the retrieval of HTTP responses from API calls. + * Added `runtime.WithCaptureResponse` to enable the policy at the API level (off by default). + +### Breaking Changes +* Moved `WithHTTPHeader` and `WithRetryOptions` from the `policy` package to the `runtime` package. + +## 0.21.1 (2022-02-04) + +### Bugs Fixed +* Restore response body after reading in `Poller.FinalResponse()`. (#16911) +* Fixed bug in `NullValue` that could lead to incorrect comparisons for empty maps/slices (#16969) + +### Other Changes +* `BearerTokenPolicy` is more resilient to transient authentication failures. (#16789) + +## 0.21.0 (2022-01-11) + +### Features Added +* Added `AllowedHeaders` and `AllowedQueryParams` to `policy.LogOptions` to control which headers and query parameters are written to the logger. +* Added `azcore.ResponseError` type which is returned from APIs when a non-success HTTP status code is received. + +### Breaking Changes +* Moved `[]policy.Policy` parameters of `arm/runtime.NewPipeline` and `runtime.NewPipeline` into a new struct, `runtime.PipelineOptions` +* Renamed `arm/ClientOptions.Host` to `.Endpoint` +* Moved `Request.SkipBodyDownload` method to function `runtime.SkipBodyDownload` +* Removed `azcore.HTTPResponse` interface type +* `arm.NewPoller()` and `runtime.NewPoller()` no longer require an `eu` parameter +* `runtime.NewResponseError()` no longer requires an `error` parameter + +## 0.20.0 (2021-10-22) + +### Breaking Changes +* Removed `arm.Connection` +* Removed `azcore.Credential` and `.NewAnonymousCredential()` + * `NewRPRegistrationPolicy` now requires an `azcore.TokenCredential` +* `runtime.NewPipeline` has a new signature that simplifies implementing custom authentication +* `arm/runtime.RegistrationOptions` embeds `policy.ClientOptions` +* Contents in the `log` package have been slightly renamed. +* Removed `AuthenticationOptions` in favor of `policy.BearerTokenOptions` +* Changed parameters for `NewBearerTokenPolicy()` +* Moved policy config options out of `arm/runtime` and into `arm/policy` + +### Features Added +* Updating Documentation +* Added string typdef `arm.Endpoint` to provide a hint toward expected ARM client endpoints +* `azcore.ClientOptions` contains common pipeline configuration settings +* Added support for multi-tenant authorization in `arm/runtime` +* Require one second minimum when calling `PollUntilDone()` + +### Bug Fixes +* Fixed a potential panic when creating the default Transporter. +* Close LRO initial response body when creating a poller. +* Fixed a panic when recursively cloning structs that contain time.Time. + +## 0.19.0 (2021-08-25) + +### Breaking Changes +* Split content out of `azcore` into various packages. The intent is to separate content based on its usage (common, uncommon, SDK authors). + * `azcore` has all core functionality. + * `log` contains facilities for configuring in-box logging. + * `policy` is used for configuring pipeline options and creating custom pipeline policies. + * `runtime` contains various helpers used by SDK authors and generated content. + * `streaming` has helpers for streaming IO operations. +* `NewTelemetryPolicy()` now requires module and version parameters and the `Value` option has been removed. + * As a result, the `Request.Telemetry()` method has been removed. +* The telemetry policy now includes the SDK prefix `azsdk-go-` so callers no longer need to provide it. +* The `*http.Request` in `runtime.Request` is no longer anonymously embedded. Use the `Raw()` method to access it. +* The `UserAgent` and `Version` constants have been made internal, `Module` and `Version` respectively. + +### Bug Fixes +* Fixed an issue in the retry policy where the request body could be overwritten after a rewind. + +### Other Changes +* Moved modules `armcore` and `to` content into `arm` and `to` packages respectively. + * The `Pipeline()` method on `armcore.Connection` has been replaced by `NewPipeline()` in `arm.Connection`. It takes module and version parameters used by the telemetry policy. +* Poller logic has been consolidated across ARM and core implementations. + * This required some changes to the internal interfaces for core pollers. +* The core poller types have been improved, including more logging and test coverage. + +## 0.18.1 (2021-08-20) + +### Features Added +* Adds an `ETag` type for comparing etags and handling etags on requests +* Simplifies the `requestBodyProgess` and `responseBodyProgress` into a single `progress` object + +### Bugs Fixed +* `JoinPaths` will preserve query parameters encoded in the `root` url. + +### Other Changes +* Bumps dependency on `internal` module to the latest version (v0.7.0) + +## 0.18.0 (2021-07-29) +### Features Added +* Replaces methods from Logger type with two package methods for interacting with the logging functionality. +* `azcore.SetClassifications` replaces `azcore.Logger().SetClassifications` +* `azcore.SetListener` replaces `azcore.Logger().SetListener` + +### Breaking Changes +* Removes `Logger` type from `azcore` + + +## 0.17.0 (2021-07-27) +### Features Added +* Adding TenantID to TokenRequestOptions (https://github.com/Azure/azure-sdk-for-go/pull/14879) +* Adding AuxiliaryTenants to AuthenticationOptions (https://github.com/Azure/azure-sdk-for-go/pull/15123) + +### Breaking Changes +* Rename `AnonymousCredential` to `NewAnonymousCredential` (https://github.com/Azure/azure-sdk-for-go/pull/15104) +* rename `AuthenticationPolicyOptions` to `AuthenticationOptions` (https://github.com/Azure/azure-sdk-for-go/pull/15103) +* Make Header constants private (https://github.com/Azure/azure-sdk-for-go/pull/15038) + + +## 0.16.2 (2021-05-26) +### Features Added +* Improved support for byte arrays [#14715](https://github.com/Azure/azure-sdk-for-go/pull/14715) + + +## 0.16.1 (2021-05-19) +### Features Added +* Add license.txt to azcore module [#14682](https://github.com/Azure/azure-sdk-for-go/pull/14682) + + +## 0.16.0 (2021-05-07) +### Features Added +* Remove extra `*` in UnmarshalAsByteArray() [#14642](https://github.com/Azure/azure-sdk-for-go/pull/14642) + + +## 0.15.1 (2021-05-06) +### Features Added +* Cache the original request body on Request [#14634](https://github.com/Azure/azure-sdk-for-go/pull/14634) + + +## 0.15.0 (2021-05-05) +### Features Added +* Add support for null map and slice +* Export `Response.Payload` method + +### Breaking Changes +* remove `Response.UnmarshalError` as it's no longer required + + +## 0.14.5 (2021-04-23) +### Features Added +* Add `UnmarshalError()` on `azcore.Response` + + +## 0.14.4 (2021-04-22) +### Features Added +* Support for basic LRO polling +* Added type `LROPoller` and supporting types for basic polling on long running operations. +* rename poller param and added doc comment + +### Bugs Fixed +* Fixed content type detection bug in logging. + + +## 0.14.3 (2021-03-29) +### Features Added +* Add support for multi-part form data +* Added method `WriteMultipartFormData()` to Request. + + +## 0.14.2 (2021-03-17) +### Features Added +* Add support for encoding JSON null values +* Adds `NullValue()` and `IsNullValue()` functions for setting and detecting sentinel values used for encoding a JSON null. +* Documentation fixes + +### Bugs Fixed +* Fixed improper error wrapping + + +## 0.14.1 (2021-02-08) +### Features Added +* Add `Pager` and `Poller` interfaces to azcore + + +## 0.14.0 (2021-01-12) +### Features Added +* Accept zero-value options for default values +* Specify zero-value options structs to accept default values. +* Remove `DefaultXxxOptions()` methods. +* Do not silently change TryTimeout on negative values +* make per-try timeout opt-in + + +## 0.13.4 (2020-11-20) +### Features Added +* Include telemetry string in User Agent + + +## 0.13.3 (2020-11-20) +### Features Added +* Updating response body handling on `azcore.Response` + + +## 0.13.2 (2020-11-13) +### Features Added +* Remove implementation of stateless policies as first-class functions. + + +## 0.13.1 (2020-11-05) +### Features Added +* Add `Telemetry()` method to `azcore.Request()` + + +## 0.13.0 (2020-10-14) +### Features Added +* Rename `log` to `logger` to avoid name collision with the log package. +* Documentation improvements +* Simplified `DefaultHTTPClientTransport()` implementation + + +## 0.12.1 (2020-10-13) +### Features Added +* Update `internal` module dependence to `v0.5.0` + + +## 0.12.0 (2020-10-08) +### Features Added +* Removed storage specific content +* Removed internal content to prevent API clutter +* Refactored various policy options to conform with our options pattern + + +## 0.11.0 (2020-09-22) +### Features Added + +* Removed `LogError` and `LogSlowResponse`. +* Renamed `options` in `RequestLogOptions`. +* Updated `NewRequestLogPolicy()` to follow standard pattern for options. +* Refactored `requestLogPolicy.Do()` per above changes. +* Cleaned up/added logging in retry policy. +* Export `NewResponseError()` +* Fix `RequestLogOptions` comment + + +## 0.10.1 (2020-09-17) +### Features Added +* Add default console logger +* Default console logger writes to stderr. To enable it, set env var `AZURE_SDK_GO_LOGGING` to the value 'all'. +* Added `Logger.Writef()` to reduce the need for `ShouldLog()` checks. +* Add `LogLongRunningOperation` + + +## 0.10.0 (2020-09-10) +### Features Added +* The `request` and `transport` interfaces have been refactored to align with the patterns in the standard library. +* `NewRequest()` now uses `http.NewRequestWithContext()` and performs additional validation, it also requires a context parameter. +* The `Policy` and `Transport` interfaces have had their context parameter removed as the context is associated with the underlying `http.Request`. +* `Pipeline.Do()` will validate the HTTP request before sending it through the pipeline, avoiding retries on a malformed request. +* The `Retrier` interface has been replaced with the `NonRetriableError` interface, and the retry policy updated to test for this. +* `Request.SetBody()` now requires a content type parameter for setting the request's MIME type. +* moved path concatenation into `JoinPaths()` func + + +## 0.9.6 (2020-08-18) +### Features Added +* Improvements to body download policy +* Always download the response body for error responses, i.e. HTTP status codes >= 400. +* Simplify variable declarations + + +## 0.9.5 (2020-08-11) +### Features Added +* Set the Content-Length header in `Request.SetBody` + + +## 0.9.4 (2020-08-03) +### Features Added +* Fix cancellation of per try timeout +* Per try timeout is used to ensure that an HTTP operation doesn't take too long, e.g. that a GET on some URL doesn't take an inordinant amount of time. +* Once the HTTP request returns, the per try timeout should be cancelled, not when the response has been read to completion. +* Do not drain response body if there are no more retries +* Do not retry non-idempotent operations when body download fails + + +## 0.9.3 (2020-07-28) +### Features Added +* Add support for custom HTTP request headers +* Inserts an internal policy into the pipeline that can extract HTTP header values from the caller's context, adding them to the request. +* Use `azcore.WithHTTPHeader` to add HTTP headers to a context. +* Remove method specific to Go 1.14 + + +## 0.9.2 (2020-07-28) +### Features Added +* Omit read-only content from request payloads +* If any field in a payload's object graph contains `azure:"ro"`, make a clone of the object graph, omitting all fields with this annotation. +* Verify no fields were dropped +* Handle embedded struct types +* Added test for cloning by value +* Add messages to failures + + +## 0.9.1 (2020-07-22) +### Features Added +* Updated dependency on internal module to fix race condition. + + +## 0.9.0 (2020-07-09) +### Features Added +* Add `HTTPResponse` interface to be used by callers to access the raw HTTP response from an error in the event of an API call failure. +* Updated `sdk/internal` dependency to latest version. +* Rename package alias + + +## 0.8.2 (2020-06-29) +### Features Added +* Added missing documentation comments + +### Bugs Fixed +* Fixed a bug in body download policy. + + +## 0.8.1 (2020-06-26) +### Features Added +* Miscellaneous clean-up reported by linters + + +## 0.8.0 (2020-06-01) +### Features Added +* Differentiate between standard and URL encoding. + + +## 0.7.1 (2020-05-27) +### Features Added +* Add support for for base64 encoding and decoding of payloads. + + +## 0.7.0 (2020-05-12) +### Features Added +* Change `RetryAfter()` to a function. + + +## 0.6.0 (2020-04-29) +### Features Added +* Updating `RetryAfter` to only return the detaion in the RetryAfter header + + +## 0.5.0 (2020-03-23) +### Features Added +* Export `TransportFunc` + +### Breaking Changes +* Removed `IterationDone` + + +## 0.4.1 (2020-02-25) +### Features Added +* Ensure per-try timeout is properly cancelled +* Explicitly call cancel the per-try timeout when the response body has been read/closed by the body download policy. +* When the response body is returned to the caller for reading/closing, wrap it in a `responseBodyReader` that will cancel the timeout when the body is closed. +* `Logger.Should()` will return false if no listener is set. + + +## 0.4.0 (2020-02-18) +### Features Added +* Enable custom `RetryOptions` to be specified per API call +* Added `WithRetryOptions()` that adds a custom `RetryOptions` to the provided context, allowing custom settings per API call. +* Remove 429 from the list of default HTTP status codes for retry. +* Change StatusCodesForRetry to a slice so consumers can append to it. +* Added support for retry-after in HTTP-date format. +* Cleaned up some comments specific to storage. +* Remove `Request.SetQueryParam()` +* Renamed `MaxTries` to `MaxRetries` + +## 0.3.0 (2020-01-16) +### Features Added +* Added `DefaultRetryOptions` to create initialized default options. + +### Breaking Changes +* Removed `Response.CheckStatusCode()` + + +## 0.2.0 (2020-01-15) +### Features Added +* Add support for marshalling and unmarshalling JSON +* Removed `Response.Payload` field +* Exit early when unmarsahlling if there is no payload + + +## 0.1.0 (2020-01-10) +### Features Added +* Initial release diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/LICENSE.txt new file mode 100644 index 000000000..48ea6616b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/README.md new file mode 100644 index 000000000..35a74e18d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/README.md @@ -0,0 +1,39 @@ +# Azure Core Client Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/azcore)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore) +[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/go/go%20-%20azcore%20-%20ci?branchName=main)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=1843&branchName=main) +[![Code Coverage](https://img.shields.io/azure-devops/coverage/azure-sdk/public/1843/main)](https://img.shields.io/azure-devops/coverage/azure-sdk/public/1843/main) + +The `azcore` module provides a set of common interfaces and types for Go SDK client modules. +These modules follow the [Azure SDK Design Guidelines for Go](https://azure.github.io/azure-sdk/golang_introduction.html). + +## Getting started + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Typically, you will not need to explicitly install `azcore` as it will be installed as a client module dependency. +To add the latest version to your `go.mod` file, execute the following command. + +```bash +go get github.com/Azure/azure-sdk-for-go/sdk/azcore +``` + +General documentation and examples can be found on [pkg.go.dev](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +## Contributing +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/arm.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/arm.go new file mode 100644 index 000000000..3a0cb6442 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/arm.go @@ -0,0 +1,24 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package arm + +import "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + +func init() { + cloud.AzureChina.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + Audience: "https://management.core.chinacloudapi.cn", + Endpoint: "https://management.chinacloudapi.cn", + } + cloud.AzureGovernment.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + Audience: "https://management.core.usgovcloudapi.net", + Endpoint: "https://management.usgovcloudapi.net", + } + cloud.AzurePublic.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + Audience: "https://management.core.windows.net/", + Endpoint: "https://management.azure.com", + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client_options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client_options.go new file mode 100644 index 000000000..3e0f22e57 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/client_options.go @@ -0,0 +1,17 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package arm + +import "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + +// ClientOptions contains configuration settings for a client's pipeline. +type ClientOptions struct { + policy.ClientOptions + + // DisableRPRegistration disables the auto-RP registration policy. Defaults to false. + DisableRPRegistration bool +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/doc.go new file mode 100644 index 000000000..1bdd16a3d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/doc.go @@ -0,0 +1,9 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package arm contains functionality specific to Azure Resource Manager clients. +package arm diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy/policy.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy/policy.go new file mode 100644 index 000000000..ddf347093 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy/policy.go @@ -0,0 +1,41 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package policy + +import ( + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// BearerTokenOptions configures the bearer token policy's behavior. +type BearerTokenOptions struct { + // Scopes contains the list of permission scopes required for the token. + Scopes []string +} + +// RegistrationOptions configures the registration policy's behavior. +// All zero-value fields will be initialized with their default values. +type RegistrationOptions struct { + policy.ClientOptions + + // MaxAttempts is the total number of times to attempt automatic registration + // in the event that an attempt fails. + // The default value is 3. + // Set to a value less than zero to disable the policy. + MaxAttempts int + + // PollingDelay is the amount of time to sleep between polling intervals. + // The default value is 15 seconds. + // A value less than zero means no delay between polling intervals (not recommended). + PollingDelay time.Duration + + // PollingDuration is the amount of time to wait before abandoning polling. + // The default valule is 5 minutes. + // NOTE: Setting this to a small value might cause the policy to prematurely fail. + PollingDuration time.Duration +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_identifier.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_identifier.go new file mode 100644 index 000000000..6e2efed8b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_identifier.go @@ -0,0 +1,224 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package arm + +import ( + "fmt" + "strings" +) + +const ( + providersKey = "providers" + subscriptionsKey = "subscriptions" + resourceGroupsLowerKey = "resourcegroups" + locationsKey = "locations" + builtInResourceNamespace = "Microsoft.Resources" +) + +// RootResourceID defines the tenant as the root parent of all other ResourceID. +var RootResourceID = &ResourceID{ + Parent: nil, + ResourceType: TenantResourceType, + Name: "", +} + +// ResourceID represents a resource ID such as `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg`. +// Don't create this type directly, use ParseResourceID instead. +type ResourceID struct { + // Parent is the parent ResourceID of this instance. + // Can be nil if there is no parent. + Parent *ResourceID + + // SubscriptionID is the subscription ID in this resource ID. + // The value can be empty if the resource ID does not contain a subscription ID. + SubscriptionID string + + // ResourceGroupName is the resource group name in this resource ID. + // The value can be empty if the resource ID does not contain a resource group name. + ResourceGroupName string + + // Provider represents the provider name in this resource ID. + // This is only valid when the resource ID represents a resource provider. + // Example: `/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights` + Provider string + + // Location is the location in this resource ID. + // The value can be empty if the resource ID does not contain a location name. + Location string + + // ResourceType represents the type of this resource ID. + ResourceType ResourceType + + // Name is the resource name of this resource ID. + Name string + + isChild bool + stringValue string +} + +// ParseResourceID parses a string to an instance of ResourceID +func ParseResourceID(id string) (*ResourceID, error) { + if len(id) == 0 { + return nil, fmt.Errorf("invalid resource ID: id cannot be empty") + } + + if !strings.HasPrefix(id, "/") { + return nil, fmt.Errorf("invalid resource ID: resource id '%s' must start with '/'", id) + } + + parts := splitStringAndOmitEmpty(id, "/") + + if len(parts) < 2 { + return nil, fmt.Errorf("invalid resource ID: %s", id) + } + + if !strings.EqualFold(parts[0], subscriptionsKey) && !strings.EqualFold(parts[0], providersKey) { + return nil, fmt.Errorf("invalid resource ID: %s", id) + } + + return appendNext(RootResourceID, parts, id) +} + +// String returns the string of the ResourceID +func (id *ResourceID) String() string { + if len(id.stringValue) > 0 { + return id.stringValue + } + + if id.Parent == nil { + return "" + } + + builder := strings.Builder{} + builder.WriteString(id.Parent.String()) + + if id.isChild { + builder.WriteString(fmt.Sprintf("/%s", id.ResourceType.lastType())) + if len(id.Name) > 0 { + builder.WriteString(fmt.Sprintf("/%s", id.Name)) + } + } else { + builder.WriteString(fmt.Sprintf("/providers/%s/%s/%s", id.ResourceType.Namespace, id.ResourceType.Type, id.Name)) + } + + id.stringValue = builder.String() + + return id.stringValue +} + +func newResourceID(parent *ResourceID, resourceTypeName string, resourceName string) *ResourceID { + id := &ResourceID{} + id.init(parent, chooseResourceType(resourceTypeName, parent), resourceName, true) + return id +} + +func newResourceIDWithResourceType(parent *ResourceID, resourceType ResourceType, resourceName string) *ResourceID { + id := &ResourceID{} + id.init(parent, resourceType, resourceName, true) + return id +} + +func newResourceIDWithProvider(parent *ResourceID, providerNamespace, resourceTypeName, resourceName string) *ResourceID { + id := &ResourceID{} + id.init(parent, NewResourceType(providerNamespace, resourceTypeName), resourceName, false) + return id +} + +func chooseResourceType(resourceTypeName string, parent *ResourceID) ResourceType { + if strings.EqualFold(resourceTypeName, resourceGroupsLowerKey) { + return ResourceGroupResourceType + } else if strings.EqualFold(resourceTypeName, subscriptionsKey) && parent != nil && parent.ResourceType.String() == TenantResourceType.String() { + return SubscriptionResourceType + } + + return parent.ResourceType.AppendChild(resourceTypeName) +} + +func (id *ResourceID) init(parent *ResourceID, resourceType ResourceType, name string, isChild bool) { + if parent != nil { + id.Provider = parent.Provider + id.SubscriptionID = parent.SubscriptionID + id.ResourceGroupName = parent.ResourceGroupName + id.Location = parent.Location + } + + if resourceType.String() == SubscriptionResourceType.String() { + id.SubscriptionID = name + } + + if resourceType.lastType() == locationsKey { + id.Location = name + } + + if resourceType.String() == ResourceGroupResourceType.String() { + id.ResourceGroupName = name + } + + if resourceType.String() == ProviderResourceType.String() { + id.Provider = name + } + + if parent == nil { + id.Parent = RootResourceID + } else { + id.Parent = parent + } + id.isChild = isChild + id.ResourceType = resourceType + id.Name = name +} + +func appendNext(parent *ResourceID, parts []string, id string) (*ResourceID, error) { + if len(parts) == 0 { + return parent, nil + } + + if len(parts) == 1 { + // subscriptions and resourceGroups are not valid ids without their names + if strings.EqualFold(parts[0], subscriptionsKey) || strings.EqualFold(parts[0], resourceGroupsLowerKey) { + return nil, fmt.Errorf("invalid resource ID: %s", id) + } + + // resourceGroup must contain either child or provider resource type + if parent.ResourceType.String() == ResourceGroupResourceType.String() { + return nil, fmt.Errorf("invalid resource ID: %s", id) + } + + return newResourceID(parent, parts[0], ""), nil + } + + if strings.EqualFold(parts[0], providersKey) && (len(parts) == 2 || strings.EqualFold(parts[2], providersKey)) { + //provider resource can only be on a tenant or a subscription parent + if parent.ResourceType.String() != SubscriptionResourceType.String() && parent.ResourceType.String() != TenantResourceType.String() { + return nil, fmt.Errorf("invalid resource ID: %s", id) + } + + return appendNext(newResourceIDWithResourceType(parent, ProviderResourceType, parts[1]), parts[2:], id) + } + + if len(parts) > 3 && strings.EqualFold(parts[0], providersKey) { + return appendNext(newResourceIDWithProvider(parent, parts[1], parts[2], parts[3]), parts[4:], id) + } + + if len(parts) > 1 && !strings.EqualFold(parts[0], providersKey) { + return appendNext(newResourceID(parent, parts[0], parts[1]), parts[2:], id) + } + + return nil, fmt.Errorf("invalid resource ID: %s", id) +} + +func splitStringAndOmitEmpty(v, sep string) []string { + r := make([]string, 0) + for _, s := range strings.Split(v, sep) { + if len(s) == 0 { + continue + } + r = append(r, s) + } + + return r +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_type.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_type.go new file mode 100644 index 000000000..6e9dbec8d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/resource_type.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package arm + +import ( + "fmt" + "strings" +) + +// SubscriptionResourceType is the ResourceType of a subscription +var SubscriptionResourceType = NewResourceType(builtInResourceNamespace, "subscriptions") + +// ResourceGroupResourceType is the ResourceType of a resource group +var ResourceGroupResourceType = NewResourceType(builtInResourceNamespace, "resourceGroups") + +// TenantResourceType is the ResourceType of a tenant +var TenantResourceType = NewResourceType(builtInResourceNamespace, "tenants") + +// ProviderResourceType is the ResourceType of a provider +var ProviderResourceType = NewResourceType(builtInResourceNamespace, "providers") + +// ResourceType represents an Azure resource type, e.g. "Microsoft.Network/virtualNetworks/subnets". +// Don't create this type directly, use ParseResourceType or NewResourceType instead. +type ResourceType struct { + // Namespace is the namespace of the resource type. + // e.g. "Microsoft.Network" in resource type "Microsoft.Network/virtualNetworks/subnets" + Namespace string + + // Type is the full type name of the resource type. + // e.g. "virtualNetworks/subnets" in resource type "Microsoft.Network/virtualNetworks/subnets" + Type string + + // Types is the slice of all the sub-types of this resource type. + // e.g. ["virtualNetworks", "subnets"] in resource type "Microsoft.Network/virtualNetworks/subnets" + Types []string + + stringValue string +} + +// String returns the string of the ResourceType +func (t ResourceType) String() string { + return t.stringValue +} + +// IsParentOf returns true when the receiver is the parent resource type of the child. +func (t ResourceType) IsParentOf(child ResourceType) bool { + if !strings.EqualFold(t.Namespace, child.Namespace) { + return false + } + if len(t.Types) >= len(child.Types) { + return false + } + for i := range t.Types { + if !strings.EqualFold(t.Types[i], child.Types[i]) { + return false + } + } + + return true +} + +// AppendChild creates an instance of ResourceType using the receiver as the parent with childType appended to it. +func (t ResourceType) AppendChild(childType string) ResourceType { + return NewResourceType(t.Namespace, fmt.Sprintf("%s/%s", t.Type, childType)) +} + +// NewResourceType creates an instance of ResourceType using a provider namespace +// such as "Microsoft.Network" and type such as "virtualNetworks/subnets". +func NewResourceType(providerNamespace, typeName string) ResourceType { + return ResourceType{ + Namespace: providerNamespace, + Type: typeName, + Types: splitStringAndOmitEmpty(typeName, "/"), + stringValue: fmt.Sprintf("%s/%s", providerNamespace, typeName), + } +} + +// ParseResourceType parses the ResourceType from a resource type string (e.g. Microsoft.Network/virtualNetworks/subsets) +// or a resource identifier string. +// e.g. /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/mySubnet) +func ParseResourceType(resourceIDOrType string) (ResourceType, error) { + // split the path into segments + parts := splitStringAndOmitEmpty(resourceIDOrType, "/") + + // There must be at least a namespace and type name + if len(parts) < 1 { + return ResourceType{}, fmt.Errorf("invalid resource ID or type: %s", resourceIDOrType) + } + + // if the type is just subscriptions, it is a built-in type in the Microsoft.Resources namespace + if len(parts) == 1 { + // Simple resource type + return NewResourceType(builtInResourceNamespace, parts[0]), nil + } else if strings.Contains(parts[0], ".") { + // Handle resource types (Microsoft.Compute/virtualMachines, Microsoft.Network/virtualNetworks/subnets) + // it is a full type name + return NewResourceType(parts[0], strings.Join(parts[1:], "/")), nil + } else { + // Check if ResourceID + id, err := ParseResourceID(resourceIDOrType) + if err != nil { + return ResourceType{}, err + } + return NewResourceType(id.ResourceType.Namespace, id.ResourceType.Type), nil + } +} + +func (t ResourceType) lastType() string { + return t.Types[len(t.Types)-1] +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go new file mode 100644 index 000000000..f72aa4301 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/pipeline.go @@ -0,0 +1,59 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "errors" + "reflect" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + azpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + azruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// NewPipeline creates a pipeline from connection options. Policies from ClientOptions are +// placed after policies from PipelineOptions. The telemetry policy, when enabled, will +// use the specified module and version info. +func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azruntime.PipelineOptions, options *arm.ClientOptions) (azruntime.Pipeline, error) { + if options == nil { + options = &arm.ClientOptions{} + } + conf, err := getConfiguration(&options.ClientOptions) + if err != nil { + return azruntime.Pipeline{}, err + } + authPolicy := NewBearerTokenPolicy(cred, &armpolicy.BearerTokenOptions{Scopes: []string{conf.Audience + "/.default"}}) + perRetry := make([]azpolicy.Policy, 0, len(plOpts.PerRetry)+1) + copy(perRetry, plOpts.PerRetry) + plOpts.PerRetry = append(perRetry, authPolicy) + if !options.DisableRPRegistration { + regRPOpts := armpolicy.RegistrationOptions{ClientOptions: options.ClientOptions} + regPolicy, err := NewRPRegistrationPolicy(cred, ®RPOpts) + if err != nil { + return azruntime.Pipeline{}, err + } + perCall := make([]azpolicy.Policy, 0, len(plOpts.PerCall)+1) + copy(perCall, plOpts.PerCall) + plOpts.PerCall = append(perCall, regPolicy) + } + return azruntime.NewPipeline(module, version, plOpts, &options.ClientOptions), nil +} + +func getConfiguration(o *azpolicy.ClientOptions) (cloud.ServiceConfiguration, error) { + c := cloud.AzurePublic + if !reflect.ValueOf(o.Cloud).IsZero() { + c = o.Cloud + } + if conf, ok := c.Services[cloud.ResourceManager]; ok && conf.Endpoint != "" && conf.Audience != "" { + return conf, nil + } else { + return conf, errors.New("provided Cloud field is missing Azure Resource Manager configuration") + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_bearer_token.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_bearer_token.go new file mode 100644 index 000000000..10a3606e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_bearer_token.go @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "fmt" + "net/http" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + azpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/temporal" +) + +type acquiringResourceState struct { + ctx context.Context + p *BearerTokenPolicy + tenant string +} + +// acquire acquires or updates the resource; only one +// thread/goroutine at a time ever calls this function +func acquire(state acquiringResourceState) (newResource azcore.AccessToken, newExpiration time.Time, err error) { + tk, err := state.p.cred.GetToken(state.ctx, azpolicy.TokenRequestOptions{Scopes: state.p.options.Scopes}) + if err != nil { + return azcore.AccessToken{}, time.Time{}, err + } + return tk, tk.ExpiresOn, nil +} + +// BearerTokenPolicy authorizes requests with bearer tokens acquired from a TokenCredential. +type BearerTokenPolicy struct { + // mainResource is the resource to be retreived using the tenant specified in the credential + mainResource *temporal.Resource[azcore.AccessToken, acquiringResourceState] + // auxResources are additional resources that are required for cross-tenant applications + auxResources map[string]*temporal.Resource[azcore.AccessToken, acquiringResourceState] + // the following fields are read-only + cred azcore.TokenCredential + options armpolicy.BearerTokenOptions +} + +// NewBearerTokenPolicy creates a policy object that authorizes requests with bearer tokens. +// cred: an azcore.TokenCredential implementation such as a credential object from azidentity +// opts: optional settings. Pass nil to accept default values; this is the same as passing a zero-value options. +func NewBearerTokenPolicy(cred azcore.TokenCredential, opts *armpolicy.BearerTokenOptions) *BearerTokenPolicy { + if opts == nil { + opts = &armpolicy.BearerTokenOptions{} + } + p := &BearerTokenPolicy{ + cred: cred, + options: *opts, + mainResource: temporal.NewResource(acquire), + } + return p +} + +// Do authorizes a request with a bearer token +func (b *BearerTokenPolicy) Do(req *azpolicy.Request) (*http.Response, error) { + as := acquiringResourceState{ + ctx: req.Raw().Context(), + p: b, + } + tk, err := b.mainResource.Get(as) + if err != nil { + return nil, err + } + req.Raw().Header.Set(shared.HeaderAuthorization, shared.BearerTokenPrefix+tk.Token) + auxTokens := []string{} + for tenant, er := range b.auxResources { + as.tenant = tenant + auxTk, err := er.Get(as) + if err != nil { + return nil, err + } + auxTokens = append(auxTokens, fmt.Sprintf("%s%s", shared.BearerTokenPrefix, auxTk.Token)) + } + if len(auxTokens) > 0 { + req.Raw().Header.Set(shared.HeaderAuxiliaryAuthorization, strings.Join(auxTokens, ", ")) + } + return req.Next() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go new file mode 100644 index 000000000..4590d39be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime/policy_register_rp.go @@ -0,0 +1,328 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + armpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + azpolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +const ( + // LogRPRegistration entries contain information specific to the automatic registration of an RP. + // Entries of this classification are written IFF the policy needs to take any action. + LogRPRegistration log.Event = "RPRegistration" +) + +// init sets any default values +func setDefaults(r *armpolicy.RegistrationOptions) { + if r.MaxAttempts == 0 { + r.MaxAttempts = 3 + } else if r.MaxAttempts < 0 { + r.MaxAttempts = 0 + } + if r.PollingDelay == 0 { + r.PollingDelay = 15 * time.Second + } else if r.PollingDelay < 0 { + r.PollingDelay = 0 + } + if r.PollingDuration == 0 { + r.PollingDuration = 5 * time.Minute + } +} + +// NewRPRegistrationPolicy creates a policy object configured using the specified options. +// The policy controls whether an unregistered resource provider should automatically be +// registered. See https://aka.ms/rps-not-found for more information. +func NewRPRegistrationPolicy(cred azcore.TokenCredential, o *armpolicy.RegistrationOptions) (azpolicy.Policy, error) { + if o == nil { + o = &armpolicy.RegistrationOptions{} + } + conf, err := getConfiguration(&o.ClientOptions) + if err != nil { + return nil, err + } + authPolicy := NewBearerTokenPolicy(cred, &armpolicy.BearerTokenOptions{Scopes: []string{conf.Audience + "/.default"}}) + p := &rpRegistrationPolicy{ + endpoint: conf.Endpoint, + pipeline: runtime.NewPipeline(shared.Module, shared.Version, runtime.PipelineOptions{PerRetry: []azpolicy.Policy{authPolicy}}, &o.ClientOptions), + options: *o, + } + // init the copy + setDefaults(&p.options) + return p, nil +} + +type rpRegistrationPolicy struct { + endpoint string + pipeline runtime.Pipeline + options armpolicy.RegistrationOptions +} + +func (r *rpRegistrationPolicy) Do(req *azpolicy.Request) (*http.Response, error) { + if r.options.MaxAttempts == 0 { + // policy is disabled + return req.Next() + } + const unregisteredRPCode = "MissingSubscriptionRegistration" + const registeredState = "Registered" + var rp string + var resp *http.Response + for attempts := 0; attempts < r.options.MaxAttempts; attempts++ { + var err error + // make the original request + resp, err = req.Next() + // getting a 409 is the first indication that the RP might need to be registered, check error response + if err != nil || resp.StatusCode != http.StatusConflict { + return resp, err + } + var reqErr requestError + if err = runtime.UnmarshalAsJSON(resp, &reqErr); err != nil { + return resp, err + } + if reqErr.ServiceError == nil { + return resp, errors.New("missing error information") + } + if !strings.EqualFold(reqErr.ServiceError.Code, unregisteredRPCode) { + // not a 409 due to unregistered RP + return resp, err + } + // RP needs to be registered. start by getting the subscription ID from the original request + subID, err := getSubscription(req.Raw().URL.Path) + if err != nil { + return resp, err + } + // now get the RP from the error + rp, err = getProvider(reqErr) + if err != nil { + return resp, err + } + logRegistrationExit := func(v interface{}) { + log.Writef(LogRPRegistration, "END registration for %s: %v", rp, v) + } + log.Writef(LogRPRegistration, "BEGIN registration for %s", rp) + // create client and make the registration request + // we use the scheme and host from the original request + rpOps := &providersOperations{ + p: r.pipeline, + u: r.endpoint, + subID: subID, + } + if _, err = rpOps.Register(req.Raw().Context(), rp); err != nil { + logRegistrationExit(err) + return resp, err + } + // RP was registered, however we need to wait for the registration to complete + pollCtx, pollCancel := context.WithTimeout(req.Raw().Context(), r.options.PollingDuration) + var lastRegState string + for { + // get the current registration state + getResp, err := rpOps.Get(pollCtx, rp) + if err != nil { + pollCancel() + logRegistrationExit(err) + return resp, err + } + if getResp.Provider.RegistrationState != nil && !strings.EqualFold(*getResp.Provider.RegistrationState, lastRegState) { + // registration state has changed, or was updated for the first time + lastRegState = *getResp.Provider.RegistrationState + log.Writef(LogRPRegistration, "registration state is %s", lastRegState) + } + if strings.EqualFold(lastRegState, registeredState) { + // registration complete + pollCancel() + logRegistrationExit(lastRegState) + break + } + // wait before trying again + select { + case <-time.After(r.options.PollingDelay): + // continue polling + case <-pollCtx.Done(): + pollCancel() + logRegistrationExit(pollCtx.Err()) + return resp, pollCtx.Err() + } + } + // RP was successfully registered, retry the original request + err = req.RewindBody() + if err != nil { + return resp, err + } + } + // if we get here it means we exceeded the number of attempts + return resp, fmt.Errorf("exceeded attempts to register %s", rp) +} + +func getSubscription(path string) (string, error) { + parts := strings.Split(path, "/") + for i, v := range parts { + if v == "subscriptions" && (i+1) < len(parts) { + return parts[i+1], nil + } + } + return "", fmt.Errorf("failed to obtain subscription ID from %s", path) +} + +func getProvider(re requestError) (string, error) { + if len(re.ServiceError.Details) > 0 { + return re.ServiceError.Details[0].Target, nil + } + return "", errors.New("unexpected empty Details") +} + +// minimal error definitions to simplify detection +type requestError struct { + ServiceError *serviceError `json:"error"` +} + +type serviceError struct { + Code string `json:"code"` + Details []serviceErrorDetails `json:"details"` +} + +type serviceErrorDetails struct { + Code string `json:"code"` + Target string `json:"target"` +} + +/////////////////////////////////////////////////////////////////////////////////////////////// +// the following code was copied from module armresources, providers.go and models.go +// only the minimum amount of code was copied to get this working and some edits were made. +/////////////////////////////////////////////////////////////////////////////////////////////// + +type providersOperations struct { + p runtime.Pipeline + u string + subID string +} + +// Get - Gets the specified resource provider. +func (client *providersOperations) Get(ctx context.Context, resourceProviderNamespace string) (providerResponse, error) { + req, err := client.getCreateRequest(ctx, resourceProviderNamespace) + if err != nil { + return providerResponse{}, err + } + resp, err := client.p.Do(req) + if err != nil { + return providerResponse{}, err + } + result, err := client.getHandleResponse(resp) + if err != nil { + return providerResponse{}, err + } + return result, nil +} + +// getCreateRequest creates the Get request. +func (client *providersOperations) getCreateRequest(ctx context.Context, resourceProviderNamespace string) (*azpolicy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}" + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.u, urlPath)) + if err != nil { + return nil, err + } + query := req.Raw().URL.Query() + query.Set("api-version", "2019-05-01") + req.Raw().URL.RawQuery = query.Encode() + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *providersOperations) getHandleResponse(resp *http.Response) (providerResponse, error) { + if !runtime.HasStatusCode(resp, http.StatusOK) { + return providerResponse{}, exported.NewResponseError(resp) + } + result := providerResponse{RawResponse: resp} + err := runtime.UnmarshalAsJSON(resp, &result.Provider) + if err != nil { + return providerResponse{}, err + } + return result, err +} + +// Register - Registers a subscription with a resource provider. +func (client *providersOperations) Register(ctx context.Context, resourceProviderNamespace string) (providerResponse, error) { + req, err := client.registerCreateRequest(ctx, resourceProviderNamespace) + if err != nil { + return providerResponse{}, err + } + resp, err := client.p.Do(req) + if err != nil { + return providerResponse{}, err + } + result, err := client.registerHandleResponse(resp) + if err != nil { + return providerResponse{}, err + } + return result, nil +} + +// registerCreateRequest creates the Register request. +func (client *providersOperations) registerCreateRequest(ctx context.Context, resourceProviderNamespace string) (*azpolicy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register" + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.u, urlPath)) + if err != nil { + return nil, err + } + query := req.Raw().URL.Query() + query.Set("api-version", "2019-05-01") + req.Raw().URL.RawQuery = query.Encode() + return req, nil +} + +// registerHandleResponse handles the Register response. +func (client *providersOperations) registerHandleResponse(resp *http.Response) (providerResponse, error) { + if !runtime.HasStatusCode(resp, http.StatusOK) { + return providerResponse{}, exported.NewResponseError(resp) + } + result := providerResponse{RawResponse: resp} + err := runtime.UnmarshalAsJSON(resp, &result.Provider) + if err != nil { + return providerResponse{}, err + } + return result, err +} + +// ProviderResponse is the response envelope for operations that return a Provider type. +type providerResponse struct { + // Resource provider information. + Provider *provider + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// Provider - Resource provider information. +type provider struct { + // The provider ID. + ID *string `json:"id,omitempty"` + + // The namespace of the resource provider. + Namespace *string `json:"namespace,omitempty"` + + // The registration policy of the resource provider. + RegistrationPolicy *string `json:"registrationPolicy,omitempty"` + + // The registration state of the resource provider. + RegistrationState *string `json:"registrationState,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/ci.yml new file mode 100644 index 000000000..aab921853 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azcore/ + - eng/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azcore/ + - eng/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: azcore diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/cloud.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/cloud.go new file mode 100644 index 000000000..9d077a3e1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/cloud.go @@ -0,0 +1,44 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package cloud + +var ( + // AzureChina contains configuration for Azure China. + AzureChina = Configuration{ + ActiveDirectoryAuthorityHost: "https://login.chinacloudapi.cn/", Services: map[ServiceName]ServiceConfiguration{}, + } + // AzureGovernment contains configuration for Azure Government. + AzureGovernment = Configuration{ + ActiveDirectoryAuthorityHost: "https://login.microsoftonline.us/", Services: map[ServiceName]ServiceConfiguration{}, + } + // AzurePublic contains configuration for Azure Public Cloud. + AzurePublic = Configuration{ + ActiveDirectoryAuthorityHost: "https://login.microsoftonline.com/", Services: map[ServiceName]ServiceConfiguration{}, + } +) + +// ServiceName identifies a cloud service. +type ServiceName string + +// ResourceManager is a global constant identifying Azure Resource Manager. +const ResourceManager ServiceName = "resourceManager" + +// ServiceConfiguration configures a specific cloud service such as Azure Resource Manager. +type ServiceConfiguration struct { + // Audience is the audience the client will request for its access tokens. + Audience string + // Endpoint is the service's base URL. + Endpoint string +} + +// Configuration configures a cloud. +type Configuration struct { + // ActiveDirectoryAuthorityHost is the base URL of the cloud's Azure Active Directory. + ActiveDirectoryAuthorityHost string + // Services contains configuration for the cloud's services. + Services map[ServiceName]ServiceConfiguration +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/doc.go new file mode 100644 index 000000000..985b1bde2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud/doc.go @@ -0,0 +1,53 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/* +Package cloud implements a configuration API for applications deployed to sovereign or private Azure clouds. + +Azure SDK client configuration defaults are appropriate for Azure Public Cloud (sometimes referred to as +"Azure Commercial" or simply "Microsoft Azure"). This package enables applications deployed to other +Azure Clouds to configure clients appropriately. + +This package contains predefined configuration for well-known sovereign clouds such as Azure Government and +Azure China. Azure SDK clients accept this configuration via the Cloud field of azcore.ClientOptions. For +example, configuring a credential and ARM client for Azure Government: + + opts := azcore.ClientOptions{Cloud: cloud.AzureGovernment} + cred, err := azidentity.NewDefaultAzureCredential( + &azidentity.DefaultAzureCredentialOptions{ClientOptions: opts}, + ) + handle(err) + + client, err := armsubscription.NewClient( + cred, &arm.ClientOptions{ClientOptions: opts}, + ) + handle(err) + +Applications deployed to a private cloud such as Azure Stack create a Configuration object with +appropriate values: + + c := cloud.Configuration{ + ActiveDirectoryAuthorityHost: "https://...", + Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ + cloud.ResourceManager: { + Audience: "...", + Endpoint: "https://...", + }, + }, + } + opts := azcore.ClientOptions{Cloud: c} + + cred, err := azidentity.NewDefaultAzureCredential( + &azidentity.DefaultAzureCredentialOptions{ClientOptions: opts}, + ) + handle(err) + + client, err := armsubscription.NewClient( + cred, &arm.ClientOptions{ClientOptions: opts}, + ) + handle(err) +*/ +package cloud diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go new file mode 100644 index 000000000..f9fb23422 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/core.go @@ -0,0 +1,75 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azcore + +import ( + "context" + "reflect" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// AccessToken represents an Azure service bearer access token with expiry information. +type AccessToken struct { + Token string + ExpiresOn time.Time +} + +// TokenCredential represents a credential capable of providing an OAuth token. +type TokenCredential interface { + // GetToken requests an access token for the specified set of scopes. + GetToken(ctx context.Context, options policy.TokenRequestOptions) (AccessToken, error) +} + +// holds sentinel values used to send nulls +var nullables map[reflect.Type]interface{} = map[reflect.Type]interface{}{} + +// NullValue is used to send an explicit 'null' within a request. +// This is typically used in JSON-MERGE-PATCH operations to delete a value. +func NullValue[T any]() T { + t := shared.TypeOfT[T]() + v, found := nullables[t] + if !found { + var o reflect.Value + if k := t.Kind(); k == reflect.Map { + o = reflect.MakeMap(t) + } else if k == reflect.Slice { + // empty slices appear to all point to the same data block + // which causes comparisons to become ambiguous. so we create + // a slice with len/cap of one which ensures a unique address. + o = reflect.MakeSlice(t, 1, 1) + } else { + o = reflect.New(t.Elem()) + } + v = o.Interface() + nullables[t] = v + } + // return the sentinel object + return v.(T) +} + +// IsNullValue returns true if the field contains a null sentinel value. +// This is used by custom marshallers to properly encode a null value. +func IsNullValue[T any](v T) bool { + // see if our map has a sentinel object for this *T + t := reflect.TypeOf(v) + if o, found := nullables[t]; found { + o1 := reflect.ValueOf(o) + v1 := reflect.ValueOf(v) + // we found it; return true if v points to the sentinel object. + // NOTE: maps and slices can only be compared to nil, else you get + // a runtime panic. so we compare addresses instead. + return o1.Pointer() == v1.Pointer() + } + // no sentinel object for this *t + return false +} + +// ClientOptions contains configuration settings for a client's pipeline. +type ClientOptions = policy.ClientOptions diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go new file mode 100644 index 000000000..28c64678c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/doc.go @@ -0,0 +1,257 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +/* +Package azcore implements an HTTP request/response middleware pipeline used by Azure SDK clients. + +The middleware consists of three components. + + - One or more Policy instances. + - A Transporter instance. + - A Pipeline instance that combines the Policy and Transporter instances. + +# Implementing the Policy Interface + +A Policy can be implemented in two ways; as a first-class function for a stateless Policy, or as +a method on a type for a stateful Policy. Note that HTTP requests made via the same pipeline share +the same Policy instances, so if a Policy mutates its state it MUST be properly synchronized to +avoid race conditions. + +A Policy's Do method is called when an HTTP request wants to be sent over the network. The Do method can +perform any operation(s) it desires. For example, it can log the outgoing request, mutate the URL, headers, +and/or query parameters, inject a failure, etc. Once the Policy has successfully completed its request +work, it must call the Next() method on the *policy.Request instance in order to pass the request to the +next Policy in the chain. + +When an HTTP response comes back, the Policy then gets a chance to process the response/error. The Policy instance +can log the response, retry the operation if it failed due to a transient error or timeout, unmarshal the response +body, etc. Once the Policy has successfully completed its response work, it must return the *http.Response +and error instances to its caller. + +Template for implementing a stateless Policy: + + type policyFunc func(*policy.Request) (*http.Response, error) + + // Do implements the Policy interface on policyFunc. + func (pf policyFunc) Do(req *policy.Request) (*http.Response, error) { + return pf(req) + } + + func NewMyStatelessPolicy() policy.Policy { + return policyFunc(func(req *policy.Request) (*http.Response, error) { + // TODO: mutate/process Request here + + // forward Request to next Policy & get Response/error + resp, err := req.Next() + + // TODO: mutate/process Response/error here + + // return Response/error to previous Policy + return resp, err + }) + } + +Template for implementing a stateful Policy: + + type MyStatefulPolicy struct { + // TODO: add configuration/setting fields here + } + + // TODO: add initialization args to NewMyStatefulPolicy() + func NewMyStatefulPolicy() policy.Policy { + return &MyStatefulPolicy{ + // TODO: initialize configuration/setting fields here + } + } + + func (p *MyStatefulPolicy) Do(req *policy.Request) (resp *http.Response, err error) { + // TODO: mutate/process Request here + + // forward Request to next Policy & get Response/error + resp, err := req.Next() + + // TODO: mutate/process Response/error here + + // return Response/error to previous Policy + return resp, err + } + +# Implementing the Transporter Interface + +The Transporter interface is responsible for sending the HTTP request and returning the corresponding +HTTP response or error. The Transporter is invoked by the last Policy in the chain. The default Transporter +implementation uses a shared http.Client from the standard library. + +The same stateful/stateless rules for Policy implementations apply to Transporter implementations. + +# Using Policy and Transporter Instances Via a Pipeline + +To use the Policy and Transporter instances, an application passes them to the runtime.NewPipeline function. + + func NewPipeline(transport Transporter, policies ...Policy) Pipeline + +The specified Policy instances form a chain and are invoked in the order provided to NewPipeline +followed by the Transporter. + +Once the Pipeline has been created, create a runtime.Request instance and pass it to Pipeline's Do method. + + func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error) + + func (p Pipeline) Do(req *Request) (*http.Request, error) + +The Pipeline.Do method sends the specified Request through the chain of Policy and Transporter +instances. The response/error is then sent through the same chain of Policy instances in reverse +order. For example, assuming there are Policy types PolicyA, PolicyB, and PolicyC along with +TransportA. + + pipeline := NewPipeline(TransportA, PolicyA, PolicyB, PolicyC) + +The flow of Request and Response looks like the following: + + policy.Request -> PolicyA -> PolicyB -> PolicyC -> TransportA -----+ + | + HTTP(S) endpoint + | + caller <--------- PolicyA <- PolicyB <- PolicyC <- http.Response-+ + +# Creating a Request Instance + +The Request instance passed to Pipeline's Do method is a wrapper around an *http.Request. It also +contains some internal state and provides various convenience methods. You create a Request instance +by calling the runtime.NewRequest function: + + func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error) + +If the Request should contain a body, call the SetBody method. + + func (req *Request) SetBody(body ReadSeekCloser, contentType string) error + +A seekable stream is required so that upon retry, the retry Policy instance can seek the stream +back to the beginning before retrying the network request and re-uploading the body. + +# Sending an Explicit Null + +Operations like JSON-MERGE-PATCH send a JSON null to indicate a value should be deleted. + + { + "delete-me": null + } + +This requirement conflicts with the SDK's default marshalling that specifies "omitempty" as +a means to resolve the ambiguity between a field to be excluded and its zero-value. + + type Widget struct { + Name *string `json:",omitempty"` + Count *int `json:",omitempty"` + } + +In the above example, Name and Count are defined as pointer-to-type to disambiguate between +a missing value (nil) and a zero-value (0) which might have semantic differences. + +In a PATCH operation, any fields left as nil are to have their values preserved. When updating +a Widget's count, one simply specifies the new value for Count, leaving Name nil. + +To fulfill the requirement for sending a JSON null, the NullValue() function can be used. + + w := Widget{ + Count: azcore.NullValue[*int](), + } + +This sends an explict "null" for Count, indicating that any current value for Count should be deleted. + +# Processing the Response + +When the HTTP response is received, the *http.Response is returned directly. Each Policy instance +can inspect/mutate the *http.Response. + +# Built-in Logging + +To enable logging, set environment variable AZURE_SDK_GO_LOGGING to "all" before executing your program. + +By default the logger writes to stderr. This can be customized by calling log.SetListener, providing +a callback that writes to the desired location. Any custom logging implementation MUST provide its +own synchronization to handle concurrent invocations. + +See the docs for the log package for further details. + +# Pageable Operations + +Pageable operations return potentially large data sets spread over multiple GET requests. The result of +each GET is a "page" of data consisting of a slice of items. + +Pageable operations can be identified by their New*Pager naming convention and return type of *runtime.Pager[T]. + + func (c *WidgetClient) NewListWidgetsPager(o *Options) *runtime.Pager[PageResponse] + +The call to WidgetClient.NewListWidgetsPager() returns an instance of *runtime.Pager[T] for fetching pages +and determining if there are more pages to fetch. No IO calls are made until the NextPage() method is invoked. + + pager := widgetClient.NewListWidgetsPager(nil) + for pager.More() { + page, err := pager.NextPage(context.TODO()) + // handle err + for _, widget := range page.Values { + // process widget + } + } + +# Long-Running Operations + +Long-running operations (LROs) are operations consisting of an initial request to start the operation followed +by polling to determine when the operation has reached a terminal state. An LRO's terminal state is one +of the following values. + + - Succeeded - the LRO completed successfully + - Failed - the LRO failed to complete + - Canceled - the LRO was canceled + +LROs can be identified by their Begin* prefix and their return type of *runtime.Poller[T]. + + func (c *WidgetClient) BeginCreateOrUpdate(ctx context.Context, w Widget, o *Options) (*runtime.Poller[Response], error) + +When a call to WidgetClient.BeginCreateOrUpdate() returns a nil error, it means that the LRO has started. +It does _not_ mean that the widget has been created or updated (or failed to be created/updated). + +The *runtime.Poller[T] provides APIs for determining the state of the LRO. To wait for the LRO to complete, +call the PollUntilDone() method. + + poller, err := widgetClient.BeginCreateOrUpdate(context.TODO(), Widget{}, nil) + // handle err + result, err := poller.PollUntilDone(context.TODO(), nil) + // handle err + // use result + +The call to PollUntilDone() will block the current goroutine until the LRO has reached a terminal state or the +context is canceled/timed out. + +Note that LROs can take anywhere from several seconds to several minutes. The duration is operation-dependent. Due to +this variant behavior, pollers do _not_ have a preconfigured time-out. Use a context with the appropriate cancellation +mechanism as required. + +# Resume Tokens + +Pollers provide the ability to serialize their state into a "resume token" which can be used by another process to +recreate the poller. This is achieved via the runtime.Poller[T].ResumeToken() method. + + token, err := poller.ResumeToken() + // handle error + +Note that a token can only be obtained for a poller that's in a non-terminal state. Also note that any subsequent calls +to poller.Poll() might change the poller's state. In this case, a new token should be created. + +After the token has been obtained, it can be used to recreate an instance of the originating poller. + + poller, err := widgetClient.BeginCreateOrUpdate(nil, Widget{}, &Options{ + ResumeToken: token, + }) + +When resuming a poller, no IO is performed, and zero-value arguments can be used for everything but the Options.ResumeToken. + +Resume tokens are unique per service client and operation. Attempting to resume a poller for LRO BeginB() with a token from LRO +BeginA() will result in an error. +*/ +package azcore diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/errors.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/errors.go new file mode 100644 index 000000000..17bd50c67 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/errors.go @@ -0,0 +1,14 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azcore + +import "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + +// ResponseError is returned when a request is made to a service and +// the service returns a non-success HTTP status code. +// Use errors.As() to access this type in the error chain. +type ResponseError = exported.ResponseError diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/etag.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/etag.go new file mode 100644 index 000000000..23ea7e7c8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/etag.go @@ -0,0 +1,48 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azcore + +import ( + "strings" +) + +// ETag is a property used for optimistic concurrency during updates +// ETag is a validator based on https://tools.ietf.org/html/rfc7232#section-2.3.2 +// An ETag can be empty (""). +type ETag string + +// ETagAny is an ETag that represents everything, the value is "*" +const ETagAny ETag = "*" + +// Equals does a strong comparison of two ETags. Equals returns true when both +// ETags are not weak and the values of the underlying strings are equal. +func (e ETag) Equals(other ETag) bool { + return !e.IsWeak() && !other.IsWeak() && e == other +} + +// WeakEquals does a weak comparison of two ETags. Two ETags are equivalent if their opaque-tags match +// character-by-character, regardless of either or both being tagged as "weak". +func (e ETag) WeakEquals(other ETag) bool { + getStart := func(e1 ETag) int { + if e1.IsWeak() { + return 2 + } + return 0 + } + aStart := getStart(e) + bStart := getStart(other) + + aVal := e[aStart:] + bVal := other[bStart:] + + return aVal == bVal +} + +// IsWeak specifies whether the ETag is strong or weak. +func (e ETag) IsWeak() bool { + return len(e) >= 4 && strings.HasPrefix(string(e), "W/\"") && strings.HasSuffix(string(e), "\"") +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go new file mode 100644 index 000000000..6e029d493 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/exported.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package exported + +import ( + "io" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +type nopCloser struct { + io.ReadSeeker +} + +func (n nopCloser) Close() error { + return nil +} + +// NopCloser returns a ReadSeekCloser with a no-op close method wrapping the provided io.ReadSeeker. +// Exported as streaming.NopCloser(). +func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser { + return nopCloser{rs} +} + +// HasStatusCode returns true if the Response's status code is one of the specified values. +// Exported as runtime.HasStatusCode(). +func HasStatusCode(resp *http.Response, statusCodes ...int) bool { + if resp == nil { + return false + } + for _, sc := range statusCodes { + if resp.StatusCode == sc { + return true + } + } + return false +} + +// Payload reads and returns the response body or an error. +// On a successful read, the response body is cached. +// Subsequent reads will access the cached value. +// Exported as runtime.Payload(). +func Payload(resp *http.Response) ([]byte, error) { + // r.Body won't be a nopClosingBytesReader if downloading was skipped + if buf, ok := resp.Body.(*shared.NopClosingBytesReader); ok { + return buf.Bytes(), nil + } + bytesBody, err := io.ReadAll(resp.Body) + resp.Body.Close() + if err != nil { + return nil, err + } + resp.Body = shared.NewNopClosingBytesReader(bytesBody) + return bytesBody, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go new file mode 100644 index 000000000..c44efd6ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/pipeline.go @@ -0,0 +1,97 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package exported + +import ( + "errors" + "fmt" + "net/http" + + "golang.org/x/net/http/httpguts" +) + +// Policy represents an extensibility point for the Pipeline that can mutate the specified +// Request and react to the received Response. +// Exported as policy.Policy. +type Policy interface { + // Do applies the policy to the specified Request. When implementing a Policy, mutate the + // request before calling req.Next() to move on to the next policy, and respond to the result + // before returning to the caller. + Do(req *Request) (*http.Response, error) +} + +// Pipeline represents a primitive for sending HTTP requests and receiving responses. +// Its behavior can be extended by specifying policies during construction. +// Exported as runtime.Pipeline. +type Pipeline struct { + policies []Policy +} + +// Transporter represents an HTTP pipeline transport used to send HTTP requests and receive responses. +// Exported as policy.Transporter. +type Transporter interface { + // Do sends the HTTP request and returns the HTTP response or error. + Do(req *http.Request) (*http.Response, error) +} + +// used to adapt a TransportPolicy to a Policy +type transportPolicy struct { + trans Transporter +} + +func (tp transportPolicy) Do(req *Request) (*http.Response, error) { + if tp.trans == nil { + return nil, errors.New("missing transporter") + } + resp, err := tp.trans.Do(req.Raw()) + if err != nil { + return nil, err + } else if resp == nil { + // there was no response and no error (rare but can happen) + // this ensures the retry policy will retry the request + return nil, errors.New("received nil response") + } + return resp, nil +} + +// NewPipeline creates a new Pipeline object from the specified Policies. +// Not directly exported, but used as part of runtime.NewPipeline(). +func NewPipeline(transport Transporter, policies ...Policy) Pipeline { + // transport policy must always be the last in the slice + policies = append(policies, transportPolicy{trans: transport}) + return Pipeline{ + policies: policies, + } +} + +// Do is called for each and every HTTP request. It passes the request through all +// the Policy objects (which can transform the Request's URL/query parameters/headers) +// and ultimately sends the transformed HTTP request over the network. +func (p Pipeline) Do(req *Request) (*http.Response, error) { + if req == nil { + return nil, errors.New("request cannot be nil") + } + // check copied from Transport.roundTrip() + for k, vv := range req.Raw().Header { + if !httpguts.ValidHeaderFieldName(k) { + if req.Raw().Body != nil { + req.Raw().Body.Close() + } + return nil, fmt.Errorf("invalid header field name %q", k) + } + for _, v := range vv { + if !httpguts.ValidHeaderFieldValue(v) { + if req.Raw().Body != nil { + req.Raw().Body.Close() + } + return nil, fmt.Errorf("invalid header field value %q for key %v", v, k) + } + } + } + req.policies = p.policies + return req.Next() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go new file mode 100644 index 000000000..4aeec1589 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/request.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package exported + +import ( + "context" + "errors" + "fmt" + "io" + "net/http" + "reflect" + "strconv" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// Request is an abstraction over the creation of an HTTP request as it passes through the pipeline. +// Don't use this type directly, use NewRequest() instead. +// Exported as policy.Request. +type Request struct { + req *http.Request + body io.ReadSeekCloser + policies []Policy + values opValues +} + +type opValues map[reflect.Type]interface{} + +// Set adds/changes a value +func (ov opValues) set(value interface{}) { + ov[reflect.TypeOf(value)] = value +} + +// Get looks for a value set by SetValue first +func (ov opValues) get(value interface{}) bool { + v, ok := ov[reflect.ValueOf(value).Elem().Type()] + if ok { + reflect.ValueOf(value).Elem().Set(reflect.ValueOf(v)) + } + return ok +} + +// NewRequest creates a new Request with the specified input. +// Exported as runtime.NewRequest(). +func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*Request, error) { + req, err := http.NewRequestWithContext(ctx, httpMethod, endpoint, nil) + if err != nil { + return nil, err + } + if req.URL.Host == "" { + return nil, errors.New("no Host in request URL") + } + if !(req.URL.Scheme == "http" || req.URL.Scheme == "https") { + return nil, fmt.Errorf("unsupported protocol scheme %s", req.URL.Scheme) + } + return &Request{req: req}, nil +} + +// Body returns the original body specified when the Request was created. +func (req *Request) Body() io.ReadSeekCloser { + return req.body +} + +// Raw returns the underlying HTTP request. +func (req *Request) Raw() *http.Request { + return req.req +} + +// Next calls the next policy in the pipeline. +// If there are no more policies, nil and an error are returned. +// This method is intended to be called from pipeline policies. +// To send a request through a pipeline call Pipeline.Do(). +func (req *Request) Next() (*http.Response, error) { + if len(req.policies) == 0 { + return nil, errors.New("no more policies") + } + nextPolicy := req.policies[0] + nextReq := *req + nextReq.policies = nextReq.policies[1:] + return nextPolicy.Do(&nextReq) +} + +// SetOperationValue adds/changes a mutable key/value associated with a single operation. +func (req *Request) SetOperationValue(value interface{}) { + if req.values == nil { + req.values = opValues{} + } + req.values.set(value) +} + +// OperationValue looks for a value set by SetOperationValue(). +func (req *Request) OperationValue(value interface{}) bool { + if req.values == nil { + return false + } + return req.values.get(value) +} + +// SetBody sets the specified ReadSeekCloser as the HTTP request body. +func (req *Request) SetBody(body io.ReadSeekCloser, contentType string) error { + // Set the body and content length. + size, err := body.Seek(0, io.SeekEnd) // Seek to the end to get the stream's size + if err != nil { + return err + } + if size == 0 { + body.Close() + return nil + } + _, err = body.Seek(0, io.SeekStart) + if err != nil { + return err + } + req.Raw().GetBody = func() (io.ReadCloser, error) { + _, err := body.Seek(0, io.SeekStart) // Seek back to the beginning of the stream + return body, err + } + // keep a copy of the original body. this is to handle cases + // where req.Body is replaced, e.g. httputil.DumpRequest and friends. + req.body = body + req.req.Body = body + req.req.ContentLength = size + req.req.Header.Set(shared.HeaderContentType, contentType) + req.req.Header.Set(shared.HeaderContentLength, strconv.FormatInt(size, 10)) + return nil +} + +// RewindBody seeks the request's Body stream back to the beginning so it can be resent when retrying an operation. +func (req *Request) RewindBody() error { + if req.body != nil { + // Reset the stream back to the beginning and restore the body + _, err := req.body.Seek(0, io.SeekStart) + req.req.Body = req.body + return err + } + return nil +} + +// Close closes the request body. +func (req *Request) Close() error { + if req.body == nil { + return nil + } + return req.body.Close() +} + +// Clone returns a deep copy of the request with its context changed to ctx. +func (req *Request) Clone(ctx context.Context) *Request { + r2 := *req + r2.req = req.req.Clone(ctx) + return &r2 +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go new file mode 100644 index 000000000..3db6acc83 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package exported + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + "regexp" +) + +// NewResponseError creates a new *ResponseError from the provided HTTP response. +// Exported as runtime.NewResponseError(). +func NewResponseError(resp *http.Response) error { + respErr := &ResponseError{ + StatusCode: resp.StatusCode, + RawResponse: resp, + } + + // prefer the error code in the response header + if ec := resp.Header.Get("x-ms-error-code"); ec != "" { + respErr.ErrorCode = ec + return respErr + } + + // if we didn't get x-ms-error-code, check in the response body + body, err := Payload(resp) + if err != nil { + return err + } + + if len(body) > 0 { + if code := extractErrorCodeJSON(body); code != "" { + respErr.ErrorCode = code + } else if code := extractErrorCodeXML(body); code != "" { + respErr.ErrorCode = code + } + } + + return respErr +} + +func extractErrorCodeJSON(body []byte) string { + var rawObj map[string]interface{} + if err := json.Unmarshal(body, &rawObj); err != nil { + // not a JSON object + return "" + } + + // check if this is a wrapped error, i.e. { "error": { ... } } + // if so then unwrap it + if wrapped, ok := rawObj["error"]; ok { + unwrapped, ok := wrapped.(map[string]interface{}) + if !ok { + return "" + } + rawObj = unwrapped + } else if wrapped, ok := rawObj["odata.error"]; ok { + // check if this a wrapped odata error, i.e. { "odata.error": { ... } } + unwrapped, ok := wrapped.(map[string]any) + if !ok { + return "" + } + rawObj = unwrapped + } + + // now check for the error code + code, ok := rawObj["code"] + if !ok { + return "" + } + codeStr, ok := code.(string) + if !ok { + return "" + } + return codeStr +} + +func extractErrorCodeXML(body []byte) string { + // regular expression is much easier than dealing with the XML parser + rx := regexp.MustCompile(`<(?:\w+:)?[c|C]ode>\s*(\w+)\s*<\/(?:\w+:)?[c|C]ode>`) + res := rx.FindStringSubmatch(string(body)) + if len(res) != 2 { + return "" + } + // first submatch is the entire thing, second one is the captured error code + return res[1] +} + +// ResponseError is returned when a request is made to a service and +// the service returns a non-success HTTP status code. +// Use errors.As() to access this type in the error chain. +// Exported as azcore.ResponseError. +type ResponseError struct { + // ErrorCode is the error code returned by the resource provider if available. + ErrorCode string + + // StatusCode is the HTTP status code as defined in https://pkg.go.dev/net/http#pkg-constants. + StatusCode int + + // RawResponse is the underlying HTTP response. + RawResponse *http.Response +} + +// Error implements the error interface for type ResponseError. +// Note that the message contents are not contractual and can change over time. +func (e *ResponseError) Error() string { + // write the request method and URL with response status code + msg := &bytes.Buffer{} + fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.Path) + fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + fmt.Fprintf(msg, "RESPONSE %d: %s\n", e.RawResponse.StatusCode, e.RawResponse.Status) + if e.ErrorCode != "" { + fmt.Fprintf(msg, "ERROR CODE: %s\n", e.ErrorCode) + } else { + fmt.Fprintln(msg, "ERROR CODE UNAVAILABLE") + } + fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + body, err := Payload(e.RawResponse) + if err != nil { + // this really shouldn't fail at this point as the response + // body is already cached (it was read in NewResponseError) + fmt.Fprintf(msg, "Error reading response body: %v", err) + } else if len(body) > 0 { + if err := json.Indent(msg, body, "", " "); err != nil { + // failed to pretty-print so just dump it verbatim + fmt.Fprint(msg, string(body)) + } + // the standard library doesn't have a pretty-printer for XML + fmt.Fprintln(msg) + } else { + fmt.Fprintln(msg, "Response contained no body") + } + fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + + return msg.String() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log/log.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log/log.go new file mode 100644 index 000000000..0684cb317 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log/log.go @@ -0,0 +1,38 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// This is an internal helper package to combine the complete logging APIs. +package log + +import ( + azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +type Event = log.Event + +const ( + EventRequest = azlog.EventRequest + EventResponse = azlog.EventResponse + EventRetryPolicy = azlog.EventRetryPolicy + EventLRO = azlog.EventLRO +) + +func Write(cls log.Event, msg string) { + log.Write(cls, msg) +} + +func Writef(cls log.Event, format string, a ...interface{}) { + log.Writef(cls, format, a...) +} + +func SetListener(lst func(Event, string)) { + log.SetListener(lst) +} + +func Should(cls log.Event) bool { + return log.Should(cls) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async/async.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async/async.go new file mode 100644 index 000000000..4f0441dc1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async/async.go @@ -0,0 +1,154 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package async + +import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md + +// Applicable returns true if the LRO is using Azure-AsyncOperation. +func Applicable(resp *http.Response) bool { + return resp.Header.Get(shared.HeaderAzureAsync) != "" +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + _, ok := token["asyncURL"] + return ok +} + +// Poller is an LRO poller that uses the Azure-AsyncOperation pattern. +type Poller[T any] struct { + pl exported.Pipeline + + resp *http.Response + + // The URL from Azure-AsyncOperation header. + AsyncURL string `json:"asyncURL"` + + // The URL from Location header. + LocURL string `json:"locURL"` + + // The URL from the initial LRO request. + OrigURL string `json:"origURL"` + + // The HTTP method from the initial LRO request. + Method string `json:"method"` + + // The value of final-state-via from swagger, can be the empty string. + FinalState pollers.FinalStateVia `json:"finalState"` + + // The LRO's current state. + CurState string `json:"state"` +} + +// New creates a new Poller from the provided initial response and final-state type. +// Pass nil for response to create an empty Poller for rehydration. +func New[T any](pl exported.Pipeline, resp *http.Response, finalState pollers.FinalStateVia) (*Poller[T], error) { + if resp == nil { + log.Write(log.EventLRO, "Resuming Azure-AsyncOperation poller.") + return &Poller[T]{pl: pl}, nil + } + log.Write(log.EventLRO, "Using Azure-AsyncOperation poller.") + asyncURL := resp.Header.Get(shared.HeaderAzureAsync) + if asyncURL == "" { + return nil, errors.New("response is missing Azure-AsyncOperation header") + } + if !pollers.IsValidURL(asyncURL) { + return nil, fmt.Errorf("invalid polling URL %s", asyncURL) + } + // check for provisioning state. if the operation is a RELO + // and terminates synchronously this will prevent extra polling. + // it's ok if there's no provisioning state. + state, _ := pollers.GetProvisioningState(resp) + if state == "" { + state = pollers.StatusInProgress + } + p := &Poller[T]{ + pl: pl, + resp: resp, + AsyncURL: asyncURL, + LocURL: resp.Header.Get(shared.HeaderLocation), + OrigURL: resp.Request.URL.String(), + Method: resp.Request.Method, + FinalState: finalState, + CurState: state, + } + return p, nil +} + +// Done returns true if the LRO is in a terminal state. +func (p *Poller[T]) Done() bool { + return pollers.IsTerminalState(p.CurState) +} + +// Poll retrieves the current state of the LRO. +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + err := pollers.PollHelper(ctx, p.AsyncURL, p.pl, func(resp *http.Response) (string, error) { + state, err := pollers.GetStatus(resp) + if err != nil { + return "", err + } else if state == "" { + return "", errors.New("the response did not contain a status") + } + p.resp = resp + p.CurState = state + return p.CurState, nil + }) + if err != nil { + return nil, err + } + return p.resp, nil +} + +func (p *Poller[T]) Result(ctx context.Context, out *T) error { + if p.resp.StatusCode == http.StatusNoContent { + return nil + } else if pollers.Failed(p.CurState) { + return exported.NewResponseError(p.resp) + } + var req *exported.Request + var err error + if p.Method == http.MethodPatch || p.Method == http.MethodPut { + // for PATCH and PUT, the final GET is on the original resource URL + req, err = exported.NewRequest(ctx, http.MethodGet, p.OrigURL) + } else if p.Method == http.MethodPost { + if p.FinalState == pollers.FinalStateViaAzureAsyncOp { + // no final GET required + } else if p.FinalState == pollers.FinalStateViaOriginalURI { + req, err = exported.NewRequest(ctx, http.MethodGet, p.OrigURL) + } else if p.LocURL != "" { + // ideally FinalState would be set to "location" but it isn't always. + // must check last due to more permissive condition. + req, err = exported.NewRequest(ctx, http.MethodGet, p.LocURL) + } + } + if err != nil { + return err + } + + // if a final GET request has been created, execute it + if req != nil { + resp, err := p.pl.Do(req) + if err != nil { + return err + } + p.resp = resp + } + + return pollers.ResultHelper(p.resp, pollers.Failed(p.CurState), out) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body/body.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body/body.go new file mode 100644 index 000000000..99e9f2f8d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body/body.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package body + +import ( + "context" + "errors" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" +) + +// Kind is the identifier of this type in a resume token. +const kind = "body" + +// Applicable returns true if the LRO is using no headers, just provisioning state. +// This is only applicable to PATCH and PUT methods and assumes no polling headers. +func Applicable(resp *http.Response) bool { + // we can't check for absense of headers due to some misbehaving services + // like redis that return a Location header but don't actually use that protocol + return resp.Request.Method == http.MethodPatch || resp.Request.Method == http.MethodPut +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + t, ok := token["type"] + if !ok { + return false + } + tt, ok := t.(string) + if !ok { + return false + } + return tt == kind +} + +// Poller is an LRO poller that uses the Body pattern. +type Poller[T any] struct { + pl exported.Pipeline + + resp *http.Response + + // The poller's type, used for resume token processing. + Type string `json:"type"` + + // The URL for polling. + PollURL string `json:"pollURL"` + + // The LRO's current state. + CurState string `json:"state"` +} + +// New creates a new Poller from the provided initial response. +// Pass nil for response to create an empty Poller for rehydration. +func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error) { + if resp == nil { + log.Write(log.EventLRO, "Resuming Body poller.") + return &Poller[T]{pl: pl}, nil + } + log.Write(log.EventLRO, "Using Body poller.") + p := &Poller[T]{ + pl: pl, + resp: resp, + Type: kind, + PollURL: resp.Request.URL.String(), + } + // default initial state to InProgress. depending on the HTTP + // status code and provisioning state, we might change the value. + curState := pollers.StatusInProgress + provState, err := pollers.GetProvisioningState(resp) + if err != nil && !errors.Is(err, pollers.ErrNoBody) { + return nil, err + } + if resp.StatusCode == http.StatusCreated && provState != "" { + // absense of provisioning state is ok for a 201, means the operation is in progress + curState = provState + } else if resp.StatusCode == http.StatusOK { + if provState != "" { + curState = provState + } else if provState == "" { + // for a 200, absense of provisioning state indicates success + curState = pollers.StatusSucceeded + } + } else if resp.StatusCode == http.StatusNoContent { + curState = pollers.StatusSucceeded + } + p.CurState = curState + return p, nil +} + +func (p *Poller[T]) Done() bool { + return pollers.IsTerminalState(p.CurState) +} + +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + err := pollers.PollHelper(ctx, p.PollURL, p.pl, func(resp *http.Response) (string, error) { + if resp.StatusCode == http.StatusNoContent { + p.resp = resp + p.CurState = pollers.StatusSucceeded + return p.CurState, nil + } + state, err := pollers.GetProvisioningState(resp) + if errors.Is(err, pollers.ErrNoBody) { + // a missing response body in non-204 case is an error + return "", err + } else if state == "" { + // a response body without provisioning state is considered terminal success + state = pollers.StatusSucceeded + } else if err != nil { + return "", err + } + p.resp = resp + p.CurState = state + return p.CurState, nil + }) + if err != nil { + return nil, err + } + return p.resp, nil +} + +func (p *Poller[T]) Result(ctx context.Context, out *T) error { + return pollers.ResultHelper(p.resp, pollers.Failed(p.CurState), out) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc/loc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc/loc.go new file mode 100644 index 000000000..276685da4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc/loc.go @@ -0,0 +1,118 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package loc + +import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// Kind is the identifier of this type in a resume token. +const kind = "loc" + +// Applicable returns true if the LRO is using Location. +func Applicable(resp *http.Response) bool { + return resp.Header.Get(shared.HeaderLocation) != "" +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + t, ok := token["type"] + if !ok { + return false + } + tt, ok := t.(string) + if !ok { + return false + } + return tt == kind +} + +// Poller is an LRO poller that uses the Location pattern. +type Poller[T any] struct { + pl exported.Pipeline + resp *http.Response + + Type string `json:"type"` + PollURL string `json:"pollURL"` + CurState string `json:"state"` +} + +// New creates a new Poller from the provided initial response. +// Pass nil for response to create an empty Poller for rehydration. +func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error) { + if resp == nil { + log.Write(log.EventLRO, "Resuming Location poller.") + return &Poller[T]{pl: pl}, nil + } + log.Write(log.EventLRO, "Using Location poller.") + locURL := resp.Header.Get(shared.HeaderLocation) + if locURL == "" { + return nil, errors.New("response is missing Location header") + } + if !pollers.IsValidURL(locURL) { + return nil, fmt.Errorf("invalid polling URL %s", locURL) + } + // check for provisioning state. if the operation is a RELO + // and terminates synchronously this will prevent extra polling. + // it's ok if there's no provisioning state. + state, _ := pollers.GetProvisioningState(resp) + if state == "" { + state = pollers.StatusInProgress + } + return &Poller[T]{ + pl: pl, + resp: resp, + Type: kind, + PollURL: locURL, + CurState: state, + }, nil +} + +func (p *Poller[T]) Done() bool { + return pollers.IsTerminalState(p.CurState) +} + +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + err := pollers.PollHelper(ctx, p.PollURL, p.pl, func(resp *http.Response) (string, error) { + // location polling can return an updated polling URL + if h := resp.Header.Get(shared.HeaderLocation); h != "" { + p.PollURL = h + } + // if provisioning state is available, use that. this is only + // for some ARM LRO scenarios (e.g. DELETE with a Location header) + // so if it's missing then use HTTP status code. + provState, _ := pollers.GetProvisioningState(resp) + p.resp = resp + if provState != "" { + p.CurState = provState + } else if resp.StatusCode == http.StatusAccepted { + p.CurState = pollers.StatusInProgress + } else if resp.StatusCode > 199 && resp.StatusCode < 300 { + // any 2xx other than a 202 indicates success + p.CurState = pollers.StatusSucceeded + } else { + p.CurState = pollers.StatusFailed + } + return p.CurState, nil + }) + if err != nil { + return nil, err + } + return p.resp, nil +} + +func (p *Poller[T]) Result(ctx context.Context, out *T) error { + return pollers.ResultHelper(p.resp, pollers.Failed(p.CurState), out) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op/op.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op/op.go new file mode 100644 index 000000000..dd714e768 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op/op.go @@ -0,0 +1,140 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package op + +import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// Applicable returns true if the LRO is using Operation-Location. +func Applicable(resp *http.Response) bool { + return resp.Header.Get(shared.HeaderOperationLocation) != "" +} + +// CanResume returns true if the token can rehydrate this poller type. +func CanResume(token map[string]interface{}) bool { + _, ok := token["oplocURL"] + return ok +} + +// Poller is an LRO poller that uses the Operation-Location pattern. +type Poller[T any] struct { + pl exported.Pipeline + resp *http.Response + + OpLocURL string `json:"oplocURL"` + LocURL string `json:"locURL"` + OrigURL string `json:"origURL"` + Method string `json:"method"` + FinalState pollers.FinalStateVia `json:"finalState"` + CurState string `json:"state"` +} + +// New creates a new Poller from the provided initial response. +// Pass nil for response to create an empty Poller for rehydration. +func New[T any](pl exported.Pipeline, resp *http.Response, finalState pollers.FinalStateVia) (*Poller[T], error) { + if resp == nil { + log.Write(log.EventLRO, "Resuming Operation-Location poller.") + return &Poller[T]{pl: pl}, nil + } + log.Write(log.EventLRO, "Using Operation-Location poller.") + opURL := resp.Header.Get(shared.HeaderOperationLocation) + if opURL == "" { + return nil, errors.New("response is missing Operation-Location header") + } + if !pollers.IsValidURL(opURL) { + return nil, fmt.Errorf("invalid Operation-Location URL %s", opURL) + } + locURL := resp.Header.Get(shared.HeaderLocation) + // Location header is optional + if locURL != "" && !pollers.IsValidURL(locURL) { + return nil, fmt.Errorf("invalid Location URL %s", locURL) + } + // default initial state to InProgress. if the + // service sent us a status then use that instead. + curState := pollers.StatusInProgress + status, err := pollers.GetStatus(resp) + if err != nil && !errors.Is(err, pollers.ErrNoBody) { + return nil, err + } + if status != "" { + curState = status + } + + return &Poller[T]{ + pl: pl, + resp: resp, + OpLocURL: opURL, + LocURL: locURL, + OrigURL: resp.Request.URL.String(), + Method: resp.Request.Method, + FinalState: finalState, + CurState: curState, + }, nil +} + +func (p *Poller[T]) Done() bool { + return pollers.IsTerminalState(p.CurState) +} + +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + err := pollers.PollHelper(ctx, p.OpLocURL, p.pl, func(resp *http.Response) (string, error) { + state, err := pollers.GetStatus(resp) + if err != nil { + return "", err + } else if state == "" { + return "", errors.New("the response did not contain a status") + } + p.resp = resp + p.CurState = state + return p.CurState, nil + }) + if err != nil { + return nil, err + } + return p.resp, nil +} + +func (p *Poller[T]) Result(ctx context.Context, out *T) error { + var req *exported.Request + var err error + if p.FinalState == pollers.FinalStateViaLocation && p.LocURL != "" { + req, err = exported.NewRequest(ctx, http.MethodGet, p.LocURL) + } else if p.FinalState == pollers.FinalStateViaOpLocation && p.Method == http.MethodPost { + // no final GET required, terminal response should have it + } else if rl, rlErr := pollers.GetResourceLocation(p.resp); rlErr != nil && !errors.Is(rlErr, pollers.ErrNoBody) { + return rlErr + } else if rl != "" { + req, err = exported.NewRequest(ctx, http.MethodGet, rl) + } else if p.Method == http.MethodPatch || p.Method == http.MethodPut { + req, err = exported.NewRequest(ctx, http.MethodGet, p.OrigURL) + } else if p.Method == http.MethodPost && p.LocURL != "" { + req, err = exported.NewRequest(ctx, http.MethodGet, p.LocURL) + } + if err != nil { + return err + } + + // if a final GET request has been created, execute it + if req != nil { + resp, err := p.pl.Do(req) + if err != nil { + return err + } + p.resp = resp + } + + return pollers.ResultHelper(p.resp, pollers.Failed(p.CurState), out) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/poller.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/poller.go new file mode 100644 index 000000000..37ed647f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/poller.go @@ -0,0 +1,24 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package pollers + +// FinalStateVia is the enumerated type for the possible final-state-via values. +type FinalStateVia string + +const ( + // FinalStateViaAzureAsyncOp indicates the final payload comes from the Azure-AsyncOperation URL. + FinalStateViaAzureAsyncOp FinalStateVia = "azure-async-operation" + + // FinalStateViaLocation indicates the final payload comes from the Location URL. + FinalStateViaLocation FinalStateVia = "location" + + // FinalStateViaOriginalURI indicates the final payload comes from the original URL. + FinalStateViaOriginalURI FinalStateVia = "original-uri" + + // FinalStateViaOpLocation indicates the final payload comes from the Operation-Location URL. + FinalStateViaOpLocation FinalStateVia = "operation-location" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/util.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/util.go new file mode 100644 index 000000000..17ab7dadc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/util.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package pollers + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net/http" + "net/url" + "reflect" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// the well-known set of LRO status/provisioning state values. +const ( + StatusSucceeded = "Succeeded" + StatusCanceled = "Canceled" + StatusFailed = "Failed" + StatusInProgress = "InProgress" +) + +// IsTerminalState returns true if the LRO's state is terminal. +func IsTerminalState(s string) bool { + return strings.EqualFold(s, StatusSucceeded) || strings.EqualFold(s, StatusFailed) || strings.EqualFold(s, StatusCanceled) +} + +// Failed returns true if the LRO's state is terminal failure. +func Failed(s string) bool { + return strings.EqualFold(s, StatusFailed) || strings.EqualFold(s, StatusCanceled) +} + +// Succeeded returns true if the LRO's state is terminal success. +func Succeeded(s string) bool { + return strings.EqualFold(s, StatusSucceeded) +} + +// returns true if the LRO response contains a valid HTTP status code +func StatusCodeValid(resp *http.Response) bool { + return exported.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusCreated, http.StatusNoContent) +} + +// IsValidURL verifies that the URL is valid and absolute. +func IsValidURL(s string) bool { + u, err := url.Parse(s) + return err == nil && u.IsAbs() +} + +// getTokenTypeName creates a type name from the type parameter T. +func getTokenTypeName[T any]() (string, error) { + tt := shared.TypeOfT[T]() + var n string + if tt.Kind() == reflect.Pointer { + n = "*" + tt = tt.Elem() + } + n += tt.Name() + if n == "" { + return "", errors.New("nameless types are not allowed") + } + return n, nil +} + +type resumeTokenWrapper[T any] struct { + Type string `json:"type"` + Token T `json:"token"` +} + +// NewResumeToken creates a resume token from the specified type. +// An error is returned if the generic type has no name (e.g. struct{}). +func NewResumeToken[TResult, TSource any](from TSource) (string, error) { + n, err := getTokenTypeName[TResult]() + if err != nil { + return "", err + } + b, err := json.Marshal(resumeTokenWrapper[TSource]{ + Type: n, + Token: from, + }) + if err != nil { + return "", err + } + return string(b), nil +} + +// ExtractToken returns the poller-specific token information from the provided token value. +func ExtractToken(token string) ([]byte, error) { + raw := map[string]json.RawMessage{} + if err := json.Unmarshal([]byte(token), &raw); err != nil { + return nil, err + } + // this is dependent on the type resumeTokenWrapper[T] + tk, ok := raw["token"] + if !ok { + return nil, errors.New("missing token value") + } + return tk, nil +} + +// IsTokenValid returns an error if the specified token isn't applicable for generic type T. +func IsTokenValid[T any](token string) error { + raw := map[string]interface{}{} + if err := json.Unmarshal([]byte(token), &raw); err != nil { + return err + } + t, ok := raw["type"] + if !ok { + return errors.New("missing type value") + } + tt, ok := t.(string) + if !ok { + return fmt.Errorf("invalid type format %T", t) + } + n, err := getTokenTypeName[T]() + if err != nil { + return err + } + if tt != n { + return fmt.Errorf("cannot resume from this poller token. token is for type %s, not %s", tt, n) + } + return nil +} + +// ErrNoBody is returned if the response didn't contain a body. +var ErrNoBody = errors.New("the response did not contain a body") + +// GetJSON reads the response body into a raw JSON object. +// It returns ErrNoBody if there was no content. +func GetJSON(resp *http.Response) (map[string]interface{}, error) { + body, err := exported.Payload(resp) + if err != nil { + return nil, err + } + if len(body) == 0 { + return nil, ErrNoBody + } + // unmarshall the body to get the value + var jsonBody map[string]interface{} + if err = json.Unmarshal(body, &jsonBody); err != nil { + return nil, err + } + return jsonBody, nil +} + +// provisioningState returns the provisioning state from the response or the empty string. +func provisioningState(jsonBody map[string]interface{}) string { + jsonProps, ok := jsonBody["properties"] + if !ok { + return "" + } + props, ok := jsonProps.(map[string]interface{}) + if !ok { + return "" + } + rawPs, ok := props["provisioningState"] + if !ok { + return "" + } + ps, ok := rawPs.(string) + if !ok { + return "" + } + return ps +} + +// status returns the status from the response or the empty string. +func status(jsonBody map[string]interface{}) string { + rawStatus, ok := jsonBody["status"] + if !ok { + return "" + } + status, ok := rawStatus.(string) + if !ok { + return "" + } + return status +} + +// GetStatus returns the LRO's status from the response body. +// Typically used for Azure-AsyncOperation flows. +// If there is no status in the response body the empty string is returned. +func GetStatus(resp *http.Response) (string, error) { + jsonBody, err := GetJSON(resp) + if err != nil { + return "", err + } + return status(jsonBody), nil +} + +// GetProvisioningState returns the LRO's state from the response body. +// If there is no state in the response body the empty string is returned. +func GetProvisioningState(resp *http.Response) (string, error) { + jsonBody, err := GetJSON(resp) + if err != nil { + return "", err + } + return provisioningState(jsonBody), nil +} + +// GetResourceLocation returns the LRO's resourceLocation value from the response body. +// Typically used for Operation-Location flows. +// If there is no resourceLocation in the response body the empty string is returned. +func GetResourceLocation(resp *http.Response) (string, error) { + jsonBody, err := GetJSON(resp) + if err != nil { + return "", err + } + v, ok := jsonBody["resourceLocation"] + if !ok { + // it might be ok if the field doesn't exist, the caller must make that determination + return "", nil + } + vv, ok := v.(string) + if !ok { + return "", fmt.Errorf("the resourceLocation value %v was not in string format", v) + } + return vv, nil +} + +// used if the operation synchronously completed +type NopPoller[T any] struct { + resp *http.Response + result T +} + +// NewNopPoller creates a NopPoller from the provided response. +// It unmarshals the response body into an instance of T. +func NewNopPoller[T any](resp *http.Response) (*NopPoller[T], error) { + np := &NopPoller[T]{resp: resp} + if resp.StatusCode == http.StatusNoContent { + return np, nil + } + payload, err := exported.Payload(resp) + if err != nil { + return nil, err + } + if len(payload) == 0 { + return np, nil + } + if err = json.Unmarshal(payload, &np.result); err != nil { + return nil, err + } + return np, nil +} + +func (*NopPoller[T]) Done() bool { + return true +} + +func (p *NopPoller[T]) Poll(context.Context) (*http.Response, error) { + return p.resp, nil +} + +func (p *NopPoller[T]) Result(ctx context.Context, out *T) error { + *out = p.result + return nil +} + +// PollHelper creates and executes the request, calling update() with the response. +// If the request fails, the update func is not called. +// The update func returns the state of the operation for logging purposes or an error +// if it fails to extract the required state from the response. +func PollHelper(ctx context.Context, endpoint string, pl exported.Pipeline, update func(resp *http.Response) (string, error)) error { + req, err := exported.NewRequest(ctx, http.MethodGet, endpoint) + if err != nil { + return err + } + resp, err := pl.Do(req) + if err != nil { + return err + } + state, err := update(resp) + if err != nil { + return err + } + log.Writef(log.EventLRO, "State %s", state) + return nil +} + +// ResultHelper processes the response as success or failure. +// In the success case, it unmarshals the payload into either a new instance of T or out. +// In the failure case, it creates an *azcore.Response error from the response. +func ResultHelper[T any](resp *http.Response, failed bool, out *T) error { + // short-circuit the simple success case with no response body to unmarshal + if resp.StatusCode == http.StatusNoContent { + return nil + } + + defer resp.Body.Close() + if !StatusCodeValid(resp) || failed { + // the LRO failed. unmarshall the error and update state + return exported.NewResponseError(resp) + } + + // success case + payload, err := exported.Payload(resp) + if err != nil { + return err + } + if len(payload) == 0 { + return nil + } + + if err = json.Unmarshal(payload, out); err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go new file mode 100644 index 000000000..2868e061d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -0,0 +1,34 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package shared + +const ( + ContentTypeAppJSON = "application/json" + ContentTypeAppXML = "application/xml" +) + +const ( + HeaderAuthorization = "Authorization" + HeaderAuxiliaryAuthorization = "x-ms-authorization-auxiliary" + HeaderAzureAsync = "Azure-AsyncOperation" + HeaderContentLength = "Content-Length" + HeaderContentType = "Content-Type" + HeaderLocation = "Location" + HeaderOperationLocation = "Operation-Location" + HeaderRetryAfter = "Retry-After" + HeaderUserAgent = "User-Agent" +) + +const BearerTokenPrefix = "Bearer " + +const ( + // Module is the name of the calling module used in telemetry data. + Module = "azcore" + + // Version is the semantic version (see http://semver.org) of this module. + Version = "v1.1.4" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go new file mode 100644 index 000000000..96eef2956 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/shared.go @@ -0,0 +1,135 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package shared + +import ( + "context" + "errors" + "io" + "net/http" + "reflect" + "strconv" + "time" +) + +// CtxWithHTTPHeaderKey is used as a context key for adding/retrieving http.Header. +type CtxWithHTTPHeaderKey struct{} + +// CtxWithRetryOptionsKey is used as a context key for adding/retrieving RetryOptions. +type CtxWithRetryOptionsKey struct{} + +// CtxIncludeResponseKey is used as a context key for retrieving the raw response. +type CtxIncludeResponseKey struct{} + +// Delay waits for the duration to elapse or the context to be cancelled. +func Delay(ctx context.Context, delay time.Duration) error { + select { + case <-time.After(delay): + return nil + case <-ctx.Done(): + return ctx.Err() + } +} + +// RetryAfter returns non-zero if the response contains a Retry-After header value. +func RetryAfter(resp *http.Response) time.Duration { + if resp == nil { + return 0 + } + ra := resp.Header.Get(HeaderRetryAfter) + if ra == "" { + return 0 + } + // retry-after values are expressed in either number of + // seconds or an HTTP-date indicating when to try again + if retryAfter, _ := strconv.Atoi(ra); retryAfter > 0 { + return time.Duration(retryAfter) * time.Second + } else if t, err := time.Parse(time.RFC1123, ra); err == nil { + return time.Until(t) + } + return 0 +} + +// TypeOfT returns the type of the generic type param. +func TypeOfT[T any]() reflect.Type { + // you can't, at present, obtain the type of + // a type parameter, so this is the trick + return reflect.TypeOf((*T)(nil)).Elem() +} + +// BytesSetter abstracts replacing a byte slice on some type. +type BytesSetter interface { + Set(b []byte) +} + +// NewNopClosingBytesReader creates a new *NopClosingBytesReader for the specified slice. +func NewNopClosingBytesReader(data []byte) *NopClosingBytesReader { + return &NopClosingBytesReader{s: data} +} + +// NopClosingBytesReader is an io.ReadSeekCloser around a byte slice. +// It also provides direct access to the byte slice to avoid rereading. +type NopClosingBytesReader struct { + s []byte + i int64 +} + +// Bytes returns the underlying byte slice. +func (r *NopClosingBytesReader) Bytes() []byte { + return r.s +} + +// Close implements the io.Closer interface. +func (*NopClosingBytesReader) Close() error { + return nil +} + +// Read implements the io.Reader interface. +func (r *NopClosingBytesReader) Read(b []byte) (n int, err error) { + if r.i >= int64(len(r.s)) { + return 0, io.EOF + } + n = copy(b, r.s[r.i:]) + r.i += int64(n) + return +} + +// Set replaces the existing byte slice with the specified byte slice and resets the reader. +func (r *NopClosingBytesReader) Set(b []byte) { + r.s = b + r.i = 0 +} + +// Seek implements the io.Seeker interface. +func (r *NopClosingBytesReader) Seek(offset int64, whence int) (int64, error) { + var i int64 + switch whence { + case io.SeekStart: + i = offset + case io.SeekCurrent: + i = r.i + offset + case io.SeekEnd: + i = int64(len(r.s)) + offset + default: + return 0, errors.New("nopClosingBytesReader: invalid whence") + } + if i < 0 { + return 0, errors.New("nopClosingBytesReader: negative position") + } + r.i = i + return i, nil +} + +var _ BytesSetter = (*NopClosingBytesReader)(nil) + +// TransportFunc is a helper to use a first-class func to satisfy the Transporter interface. +type TransportFunc func(*http.Request) (*http.Response, error) + +// Do implements the Transporter interface for the TransportFunc type. +func (pf TransportFunc) Do(req *http.Request) (*http.Response, error) { + return pf(req) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/doc.go new file mode 100644 index 000000000..2f3901bff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/doc.go @@ -0,0 +1,10 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package log contains functionality for configuring logging behavior. +// Default logging to stderr can be enabled by setting environment variable AZURE_SDK_GO_LOGGING to "all". +package log diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/log.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/log.go new file mode 100644 index 000000000..7bde29d0a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/log/log.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// Package log provides functionality for configuring logging facilities. +package log + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +// Event is used to group entries. Each group can be toggled on or off. +type Event = log.Event + +const ( + // EventRequest entries contain information about HTTP requests. + // This includes information like the URL, query parameters, and headers. + EventRequest Event = "Request" + + // EventResponse entries contain information about HTTP responses. + // This includes information like the HTTP status code, headers, and request URL. + EventResponse Event = "Response" + + // EventRetryPolicy entries contain information specific to the retry policy in use. + EventRetryPolicy Event = "Retry" + + // EventLRO entries contain information specific to long-running operations. + // This includes information like polling location, operation state, and sleep intervals. + EventLRO Event = "LongRunningOperation" +) + +// SetEvents is used to control which events are written to +// the log. By default all log events are writen. +// NOTE: this is not goroutine safe and should be called before using SDK clients. +func SetEvents(cls ...Event) { + log.SetEvents(cls...) +} + +// SetListener will set the Logger to write to the specified Listener. +// NOTE: this is not goroutine safe and should be called before using SDK clients. +func SetListener(lst func(Event, string)) { + log.SetListener(lst) +} + +// for testing purposes +func resetEvents() { + log.TestResetEvents() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/doc.go new file mode 100644 index 000000000..fad2579ed --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/doc.go @@ -0,0 +1,10 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package policy contains the definitions needed for configuring in-box pipeline policies +// and creating custom policies. +package policy diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go new file mode 100644 index 000000000..1ba320aef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/policy/policy.go @@ -0,0 +1,128 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package policy + +import ( + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" +) + +// Policy represents an extensibility point for the Pipeline that can mutate the specified +// Request and react to the received Response. +type Policy = exported.Policy + +// Transporter represents an HTTP pipeline transport used to send HTTP requests and receive responses. +type Transporter = exported.Transporter + +// Request is an abstraction over the creation of an HTTP request as it passes through the pipeline. +// Don't use this type directly, use runtime.NewRequest() instead. +type Request = exported.Request + +// ClientOptions contains optional settings for a client's pipeline. +// All zero-value fields will be initialized with default values. +type ClientOptions struct { + // Cloud specifies a cloud for the client. The default is Azure Public Cloud. + Cloud cloud.Configuration + + // Logging configures the built-in logging policy. + Logging LogOptions + + // Retry configures the built-in retry policy. + Retry RetryOptions + + // Telemetry configures the built-in telemetry policy. + Telemetry TelemetryOptions + + // Transport sets the transport for HTTP requests. + Transport Transporter + + // PerCallPolicies contains custom policies to inject into the pipeline. + // Each policy is executed once per request. + PerCallPolicies []Policy + + // PerRetryPolicies contains custom policies to inject into the pipeline. + // Each policy is executed once per request, and for each retry of that request. + PerRetryPolicies []Policy +} + +// LogOptions configures the logging policy's behavior. +type LogOptions struct { + // IncludeBody indicates if request and response bodies should be included in logging. + // The default value is false. + // NOTE: enabling this can lead to disclosure of sensitive information, use with care. + IncludeBody bool + + // AllowedHeaders is the slice of headers to log with their values intact. + // All headers not in the slice will have their values REDACTED. + // Applies to request and response headers. + AllowedHeaders []string + + // AllowedQueryParams is the slice of query parameters to log with their values intact. + // All query parameters not in the slice will have their values REDACTED. + AllowedQueryParams []string +} + +// RetryOptions configures the retry policy's behavior. +// Zero-value fields will have their specified default values applied during use. +// This allows for modification of a subset of fields. +type RetryOptions struct { + // MaxRetries specifies the maximum number of attempts a failed operation will be retried + // before producing an error. + // The default value is three. A value less than zero means one try and no retries. + MaxRetries int32 + + // TryTimeout indicates the maximum time allowed for any single try of an HTTP request. + // This is disabled by default. Specify a value greater than zero to enable. + // NOTE: Setting this to a small value might cause premature HTTP request time-outs. + TryTimeout time.Duration + + // RetryDelay specifies the initial amount of delay to use before retrying an operation. + // The value is used only if the HTTP response does not contain a Retry-After header. + // The delay increases exponentially with each retry up to the maximum specified by MaxRetryDelay. + // The default value is four seconds. A value less than zero means no delay between retries. + RetryDelay time.Duration + + // MaxRetryDelay specifies the maximum delay allowed before retrying an operation. + // Typically the value is greater than or equal to the value specified in RetryDelay. + // The default Value is 120 seconds. A value less than zero means there is no cap. + MaxRetryDelay time.Duration + + // StatusCodes specifies the HTTP status codes that indicate the operation should be retried. + // A nil slice will use the following values. + // http.StatusRequestTimeout 408 + // http.StatusTooManyRequests 429 + // http.StatusInternalServerError 500 + // http.StatusBadGateway 502 + // http.StatusServiceUnavailable 503 + // http.StatusGatewayTimeout 504 + // Specifying values will replace the default values. + // Specifying an empty slice will disable retries for HTTP status codes. + StatusCodes []int +} + +// TelemetryOptions configures the telemetry policy's behavior. +type TelemetryOptions struct { + // ApplicationID is an application-specific identification string to add to the User-Agent. + // It has a maximum length of 24 characters and must not contain any spaces. + ApplicationID string + + // Disabled will prevent the addition of any telemetry data to the User-Agent. + Disabled bool +} + +// TokenRequestOptions contain specific parameter that may be used by credentials types when attempting to get a token. +type TokenRequestOptions struct { + // Scopes contains the list of permission scopes required for the token. + Scopes []string +} + +// BearerTokenOptions configures the bearer token policy's behavior. +type BearerTokenOptions struct { + // placeholder for future options +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/doc.go new file mode 100644 index 000000000..c9cfa438c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/doc.go @@ -0,0 +1,10 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package runtime contains various facilities for creating requests and handling responses. +// The content is intended for SDK authors. +package runtime diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/errors.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/errors.go new file mode 100644 index 000000000..6d03b291e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/errors.go @@ -0,0 +1,19 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" +) + +// NewResponseError creates an *azcore.ResponseError from the provided HTTP response. +// Call this when a service request returns a non-successful status code. +func NewResponseError(resp *http.Response) error { + return exported.NewResponseError(resp) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go new file mode 100644 index 000000000..5507665d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pager.go @@ -0,0 +1,77 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "encoding/json" + "errors" +) + +// PagingHandler contains the required data for constructing a Pager. +type PagingHandler[T any] struct { + // More returns a boolean indicating if there are more pages to fetch. + // It uses the provided page to make the determination. + More func(T) bool + + // Fetcher fetches the first and subsequent pages. + Fetcher func(context.Context, *T) (T, error) +} + +// Pager provides operations for iterating over paged responses. +type Pager[T any] struct { + current *T + handler PagingHandler[T] + firstPage bool +} + +// NewPager creates an instance of Pager using the specified PagingHandler. +// Pass a non-nil T for firstPage if the first page has already been retrieved. +func NewPager[T any](handler PagingHandler[T]) *Pager[T] { + return &Pager[T]{ + handler: handler, + firstPage: true, + } +} + +// More returns true if there are more pages to retrieve. +func (p *Pager[T]) More() bool { + if p.current != nil { + return p.handler.More(*p.current) + } + return true +} + +// NextPage advances the pager to the next page. +func (p *Pager[T]) NextPage(ctx context.Context) (T, error) { + var resp T + var err error + if p.current != nil { + if p.firstPage { + // we get here if it's an LRO-pager, we already have the first page + p.firstPage = false + return *p.current, nil + } else if !p.handler.More(*p.current) { + return *new(T), errors.New("no more pages") + } + resp, err = p.handler.Fetcher(ctx, p.current) + } else { + // non-LRO case, first page + p.firstPage = false + resp, err = p.handler.Fetcher(ctx, nil) + } + if err != nil { + return *new(T), err + } + p.current = &resp + return *p.current, nil +} + +// UnmarshalJSON implements the json.Unmarshaler interface for Pager[T]. +func (p *Pager[T]) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &p.current) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go new file mode 100644 index 000000000..ad75ae2ab --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/pipeline.go @@ -0,0 +1,73 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// PipelineOptions contains Pipeline options for SDK developers +type PipelineOptions struct { + AllowedHeaders, AllowedQueryParameters []string + PerCall, PerRetry []policy.Policy +} + +// Pipeline represents a primitive for sending HTTP requests and receiving responses. +// Its behavior can be extended by specifying policies during construction. +type Pipeline = exported.Pipeline + +// NewPipeline creates a pipeline from connection options, with any additional policies as specified. +// Policies from ClientOptions are placed after policies from PipelineOptions. +// The module and version parameters are used by the telemetry policy, when enabled. +func NewPipeline(module, version string, plOpts PipelineOptions, options *policy.ClientOptions) Pipeline { + cp := policy.ClientOptions{} + if options != nil { + cp = *options + } + if len(plOpts.AllowedHeaders) > 0 { + headers := make([]string, 0, len(plOpts.AllowedHeaders)+len(cp.Logging.AllowedHeaders)) + copy(headers, plOpts.AllowedHeaders) + headers = append(headers, cp.Logging.AllowedHeaders...) + cp.Logging.AllowedHeaders = headers + } + if len(plOpts.AllowedQueryParameters) > 0 { + qp := make([]string, 0, len(plOpts.AllowedQueryParameters)+len(cp.Logging.AllowedQueryParams)) + copy(qp, plOpts.AllowedQueryParameters) + qp = append(qp, cp.Logging.AllowedQueryParams...) + cp.Logging.AllowedQueryParams = qp + } + // we put the includeResponsePolicy at the very beginning so that the raw response + // is populated with the final response (some policies might mutate the response) + policies := []policy.Policy{policyFunc(includeResponsePolicy)} + if !cp.Telemetry.Disabled { + policies = append(policies, NewTelemetryPolicy(module, version, &cp.Telemetry)) + } + policies = append(policies, plOpts.PerCall...) + policies = append(policies, cp.PerCallPolicies...) + policies = append(policies, NewRetryPolicy(&cp.Retry)) + policies = append(policies, plOpts.PerRetry...) + policies = append(policies, cp.PerRetryPolicies...) + policies = append(policies, NewLogPolicy(&cp.Logging)) + policies = append(policies, policyFunc(httpHeaderPolicy), policyFunc(bodyDownloadPolicy)) + transport := cp.Transport + if transport == nil { + transport = defaultHTTPClient + } + return exported.NewPipeline(transport, policies...) +} + +// policyFunc is a type that implements the Policy interface. +// Use this type when implementing a stateless policy as a first-class function. +type policyFunc func(*policy.Request) (*http.Response, error) + +// Do implements the Policy interface on policyFunc. +func (pf policyFunc) Do(req *policy.Request) (*http.Response, error) { + return pf(req) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go new file mode 100644 index 000000000..71e3062be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "net/http" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/temporal" +) + +// BearerTokenPolicy authorizes requests with bearer tokens acquired from a TokenCredential. +type BearerTokenPolicy struct { + // mainResource is the resource to be retreived using the tenant specified in the credential + mainResource *temporal.Resource[azcore.AccessToken, acquiringResourceState] + // the following fields are read-only + cred azcore.TokenCredential + scopes []string +} + +type acquiringResourceState struct { + req *policy.Request + p *BearerTokenPolicy +} + +// acquire acquires or updates the resource; only one +// thread/goroutine at a time ever calls this function +func acquire(state acquiringResourceState) (newResource azcore.AccessToken, newExpiration time.Time, err error) { + tk, err := state.p.cred.GetToken(state.req.Raw().Context(), policy.TokenRequestOptions{Scopes: state.p.scopes}) + if err != nil { + return azcore.AccessToken{}, time.Time{}, err + } + return tk, tk.ExpiresOn, nil +} + +// NewBearerTokenPolicy creates a policy object that authorizes requests with bearer tokens. +// cred: an azcore.TokenCredential implementation such as a credential object from azidentity +// scopes: the list of permission scopes required for the token. +// opts: optional settings. Pass nil to accept default values; this is the same as passing a zero-value options. +func NewBearerTokenPolicy(cred azcore.TokenCredential, scopes []string, opts *policy.BearerTokenOptions) *BearerTokenPolicy { + return &BearerTokenPolicy{ + cred: cred, + scopes: scopes, + mainResource: temporal.NewResource(acquire), + } +} + +// Do authorizes a request with a bearer token +func (b *BearerTokenPolicy) Do(req *policy.Request) (*http.Response, error) { + as := acquiringResourceState{ + p: b, + req: req, + } + tk, err := b.mainResource.Get(as) + if err != nil { + return nil, err + } + req.Raw().Header.Set(shared.HeaderAuthorization, shared.BearerTokenPrefix+tk.Token) + return req.Next() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_body_download.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_body_download.go new file mode 100644 index 000000000..02d621ee8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_body_download.go @@ -0,0 +1,73 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "fmt" + "net/http" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" +) + +// bodyDownloadPolicy creates a policy object that downloads the response's body to a []byte. +func bodyDownloadPolicy(req *policy.Request) (*http.Response, error) { + resp, err := req.Next() + if err != nil { + return resp, err + } + var opValues bodyDownloadPolicyOpValues + // don't skip downloading error response bodies + if req.OperationValue(&opValues); opValues.Skip && resp.StatusCode < 400 { + return resp, err + } + // Either bodyDownloadPolicyOpValues was not specified (so skip is false) + // or it was specified and skip is false: don't skip downloading the body + _, err = exported.Payload(resp) + if err != nil { + return resp, newBodyDownloadError(err, req) + } + return resp, err +} + +// bodyDownloadPolicyOpValues is the struct containing the per-operation values +type bodyDownloadPolicyOpValues struct { + Skip bool +} + +type bodyDownloadError struct { + err error +} + +func newBodyDownloadError(err error, req *policy.Request) error { + // on failure, only retry the request for idempotent operations. + // we currently identify them as DELETE, GET, and PUT requests. + if m := strings.ToUpper(req.Raw().Method); m == http.MethodDelete || m == http.MethodGet || m == http.MethodPut { + // error is safe for retry + return err + } + // wrap error to avoid retries + return &bodyDownloadError{ + err: err, + } +} + +func (b *bodyDownloadError) Error() string { + return fmt.Sprintf("body download policy: %s", b.err.Error()) +} + +func (b *bodyDownloadError) NonRetriable() { + // marker method +} + +func (b *bodyDownloadError) Unwrap() error { + return b.err +} + +var _ errorinfo.NonRetriable = (*bodyDownloadError)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_header.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_header.go new file mode 100644 index 000000000..770e0a2b6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_header.go @@ -0,0 +1,39 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// newHTTPHeaderPolicy creates a policy object that adds custom HTTP headers to a request +func httpHeaderPolicy(req *policy.Request) (*http.Response, error) { + // check if any custom HTTP headers have been specified + if header := req.Raw().Context().Value(shared.CtxWithHTTPHeaderKey{}); header != nil { + for k, v := range header.(http.Header) { + // use Set to replace any existing value + // it also canonicalizes the header key + req.Raw().Header.Set(k, v[0]) + // add any remaining values + for i := 1; i < len(v); i++ { + req.Raw().Header.Add(k, v[i]) + } + } + } + return req.Next() +} + +// WithHTTPHeader adds the specified http.Header to the parent context. +// Use this to specify custom HTTP headers at the API-call level. +// Any overlapping headers will have their values replaced with the values specified here. +func WithHTTPHeader(parent context.Context, header http.Header) context.Context { + return context.WithValue(parent, shared.CtxWithHTTPHeaderKey{}, header) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_include_response.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_include_response.go new file mode 100644 index 000000000..4714baa30 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_include_response.go @@ -0,0 +1,34 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// includeResponsePolicy creates a policy that retrieves the raw HTTP response upon request +func includeResponsePolicy(req *policy.Request) (*http.Response, error) { + resp, err := req.Next() + if resp == nil { + return resp, err + } + if httpOutRaw := req.Raw().Context().Value(shared.CtxIncludeResponseKey{}); httpOutRaw != nil { + httpOut := httpOutRaw.(**http.Response) + *httpOut = resp + } + return resp, err +} + +// WithCaptureResponse applies the HTTP response retrieval annotation to the parent context. +// The resp parameter will contain the HTTP response after the request has completed. +func WithCaptureResponse(parent context.Context, resp **http.Response) context.Context { + return context.WithValue(parent, shared.CtxIncludeResponseKey{}, resp) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go new file mode 100644 index 000000000..30a02a7a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go @@ -0,0 +1,251 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "bytes" + "fmt" + "io" + "net/http" + "sort" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/diag" +) + +type logPolicy struct { + includeBody bool + allowedHeaders map[string]struct{} + allowedQP map[string]struct{} +} + +// NewLogPolicy creates a request/response logging policy object configured using the specified options. +// Pass nil to accept the default values; this is the same as passing a zero-value options. +func NewLogPolicy(o *policy.LogOptions) policy.Policy { + if o == nil { + o = &policy.LogOptions{} + } + // construct default hash set of allowed headers + allowedHeaders := map[string]struct{}{ + "accept": {}, + "cache-control": {}, + "connection": {}, + "content-length": {}, + "content-type": {}, + "date": {}, + "etag": {}, + "expires": {}, + "if-match": {}, + "if-modified-since": {}, + "if-none-match": {}, + "if-unmodified-since": {}, + "last-modified": {}, + "ms-cv": {}, + "pragma": {}, + "request-id": {}, + "retry-after": {}, + "server": {}, + "traceparent": {}, + "transfer-encoding": {}, + "user-agent": {}, + "www-authenticate": {}, + "x-ms-request-id": {}, + "x-ms-client-request-id": {}, + "x-ms-return-client-request-id": {}, + } + // add any caller-specified allowed headers to the set + for _, ah := range o.AllowedHeaders { + allowedHeaders[strings.ToLower(ah)] = struct{}{} + } + // now do the same thing for query params + allowedQP := map[string]struct{}{ + "api-version": {}, + } + for _, qp := range o.AllowedQueryParams { + allowedQP[strings.ToLower(qp)] = struct{}{} + } + return &logPolicy{ + includeBody: o.IncludeBody, + allowedHeaders: allowedHeaders, + allowedQP: allowedQP, + } +} + +// logPolicyOpValues is the struct containing the per-operation values +type logPolicyOpValues struct { + try int32 + start time.Time +} + +func (p *logPolicy) Do(req *policy.Request) (*http.Response, error) { + // Get the per-operation values. These are saved in the Message's map so that they persist across each retry calling into this policy object. + var opValues logPolicyOpValues + if req.OperationValue(&opValues); opValues.start.IsZero() { + opValues.start = time.Now() // If this is the 1st try, record this operation's start time + } + opValues.try++ // The first try is #1 (not #0) + req.SetOperationValue(opValues) + + // Log the outgoing request as informational + if log.Should(log.EventRequest) { + b := &bytes.Buffer{} + fmt.Fprintf(b, "==> OUTGOING REQUEST (Try=%d)\n", opValues.try) + p.writeRequestWithResponse(b, req, nil, nil) + var err error + if p.includeBody { + err = writeReqBody(req, b) + } + log.Write(log.EventRequest, b.String()) + if err != nil { + return nil, err + } + } + + // Set the time for this particular retry operation and then Do the operation. + tryStart := time.Now() + response, err := req.Next() // Make the request + tryEnd := time.Now() + tryDuration := tryEnd.Sub(tryStart) + opDuration := tryEnd.Sub(opValues.start) + + if log.Should(log.EventResponse) { + // We're going to log this; build the string to log + b := &bytes.Buffer{} + fmt.Fprintf(b, "==> REQUEST/RESPONSE (Try=%d/%v, OpTime=%v) -- ", opValues.try, tryDuration, opDuration) + if err != nil { // This HTTP request did not get a response from the service + fmt.Fprint(b, "REQUEST ERROR\n") + } else { + fmt.Fprint(b, "RESPONSE RECEIVED\n") + } + + p.writeRequestWithResponse(b, req, response, err) + if err != nil { + // skip frames runtime.Callers() and runtime.StackTrace() + b.WriteString(diag.StackTrace(2, 32)) + } else if p.includeBody { + err = writeRespBody(response, b) + } + log.Write(log.EventResponse, b.String()) + } + return response, err +} + +const redactedValue = "REDACTED" + +// writeRequestWithResponse appends a formatted HTTP request into a Buffer. If request and/or err are +// not nil, then these are also written into the Buffer. +func (p *logPolicy) writeRequestWithResponse(b *bytes.Buffer, req *policy.Request, resp *http.Response, err error) { + // redact applicable query params + cpURL := *req.Raw().URL + qp := cpURL.Query() + for k := range qp { + if _, ok := p.allowedQP[strings.ToLower(k)]; !ok { + qp.Set(k, redactedValue) + } + } + cpURL.RawQuery = qp.Encode() + // Write the request into the buffer. + fmt.Fprint(b, " "+req.Raw().Method+" "+cpURL.String()+"\n") + p.writeHeader(b, req.Raw().Header) + if resp != nil { + fmt.Fprintln(b, " --------------------------------------------------------------------------------") + fmt.Fprint(b, " RESPONSE Status: "+resp.Status+"\n") + p.writeHeader(b, resp.Header) + } + if err != nil { + fmt.Fprintln(b, " --------------------------------------------------------------------------------") + fmt.Fprint(b, " ERROR:\n"+err.Error()+"\n") + } +} + +// formatHeaders appends an HTTP request's or response's header into a Buffer. +func (p *logPolicy) writeHeader(b *bytes.Buffer, header http.Header) { + if len(header) == 0 { + b.WriteString(" (no headers)\n") + return + } + keys := make([]string, 0, len(header)) + // Alphabetize the headers + for k := range header { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + value := header.Get(k) + // redact all header values not in the allow-list + if _, ok := p.allowedHeaders[strings.ToLower(k)]; !ok { + value = redactedValue + } + fmt.Fprintf(b, " %s: %+v\n", k, value) + } +} + +// returns true if the request/response body should be logged. +// this is determined by looking at the content-type header value. +func shouldLogBody(b *bytes.Buffer, contentType string) bool { + contentType = strings.ToLower(contentType) + if strings.HasPrefix(contentType, "text") || + strings.Contains(contentType, "json") || + strings.Contains(contentType, "xml") { + return true + } + fmt.Fprintf(b, " Skip logging body for %s\n", contentType) + return false +} + +// writes to a buffer, used for logging purposes +func writeReqBody(req *policy.Request, b *bytes.Buffer) error { + if req.Raw().Body == nil { + fmt.Fprint(b, " Request contained no body\n") + return nil + } + if ct := req.Raw().Header.Get(shared.HeaderContentType); !shouldLogBody(b, ct) { + return nil + } + body, err := io.ReadAll(req.Raw().Body) + if err != nil { + fmt.Fprintf(b, " Failed to read request body: %s\n", err.Error()) + return err + } + if err := req.RewindBody(); err != nil { + return err + } + logBody(b, body) + return nil +} + +// writes to a buffer, used for logging purposes +func writeRespBody(resp *http.Response, b *bytes.Buffer) error { + ct := resp.Header.Get(shared.HeaderContentType) + if ct == "" { + fmt.Fprint(b, " Response contained no body\n") + return nil + } else if !shouldLogBody(b, ct) { + return nil + } + body, err := Payload(resp) + if err != nil { + fmt.Fprintf(b, " Failed to read response body: %s\n", err.Error()) + return err + } + if len(body) > 0 { + logBody(b, body) + } else { + fmt.Fprint(b, " Response contained no body\n") + } + return nil +} + +func logBody(b *bytes.Buffer, body []byte) { + fmt.Fprintln(b, " --------------------------------------------------------------------------------") + fmt.Fprintln(b, string(body)) + fmt.Fprintln(b, " --------------------------------------------------------------------------------") +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_request_id.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_request_id.go new file mode 100644 index 000000000..db70955b2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_request_id.go @@ -0,0 +1,34 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/uuid" +) + +type requestIDPolicy struct{} + +// NewRequestIDPolicy returns a policy that add the x-ms-client-request-id header +func NewRequestIDPolicy() policy.Policy { + return &requestIDPolicy{} +} + +func (r *requestIDPolicy) Do(req *policy.Request) (*http.Response, error) { + const requestIdHeader = "x-ms-client-request-id" + if req.Raw().Header.Get(requestIdHeader) == "" { + id, err := uuid.New() + if err != nil { + return nil, err + } + req.Raw().Header.Set(requestIdHeader, id.String()) + } + + return req.Next() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go new file mode 100644 index 000000000..7f9e8386b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go @@ -0,0 +1,249 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "errors" + "io" + "math" + "math/rand" + "net/http" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" +) + +const ( + defaultMaxRetries = 3 +) + +func setDefaults(o *policy.RetryOptions) { + if o.MaxRetries == 0 { + o.MaxRetries = defaultMaxRetries + } else if o.MaxRetries < 0 { + o.MaxRetries = 0 + } + if o.MaxRetryDelay == 0 { + o.MaxRetryDelay = 120 * time.Second + } else if o.MaxRetryDelay < 0 { + // not really an unlimited cap, but sufficiently large enough to be considered as such + o.MaxRetryDelay = math.MaxInt64 + } + if o.RetryDelay == 0 { + o.RetryDelay = 800 * time.Millisecond + } else if o.RetryDelay < 0 { + o.RetryDelay = 0 + } + if o.StatusCodes == nil { + // NOTE: if you change this list, you MUST update the docs in policy/policy.go + o.StatusCodes = []int{ + http.StatusRequestTimeout, // 408 + http.StatusTooManyRequests, // 429 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } + } +} + +func calcDelay(o policy.RetryOptions, try int32) time.Duration { // try is >=1; never 0 + pow := func(number int64, exponent int32) int64 { // pow is nested helper function + var result int64 = 1 + for n := int32(0); n < exponent; n++ { + result *= number + } + return result + } + + delay := time.Duration(pow(2, try)-1) * o.RetryDelay + + // Introduce some jitter: [0.0, 1.0) / 2 = [0.0, 0.5) + 0.8 = [0.8, 1.3) + delay = time.Duration(delay.Seconds() * (rand.Float64()/2 + 0.8) * float64(time.Second)) // NOTE: We want math/rand; not crypto/rand + if delay > o.MaxRetryDelay { + delay = o.MaxRetryDelay + } + return delay +} + +// NewRetryPolicy creates a policy object configured using the specified options. +// Pass nil to accept the default values; this is the same as passing a zero-value options. +func NewRetryPolicy(o *policy.RetryOptions) policy.Policy { + if o == nil { + o = &policy.RetryOptions{} + } + p := &retryPolicy{options: *o} + return p +} + +type retryPolicy struct { + options policy.RetryOptions +} + +func (p *retryPolicy) Do(req *policy.Request) (resp *http.Response, err error) { + options := p.options + // check if the retry options have been overridden for this call + if override := req.Raw().Context().Value(shared.CtxWithRetryOptionsKey{}); override != nil { + options = override.(policy.RetryOptions) + } + setDefaults(&options) + // Exponential retry algorithm: ((2 ^ attempt) - 1) * delay * random(0.8, 1.2) + // When to retry: connection failure or temporary/timeout. + var rwbody *retryableRequestBody + if req.Body() != nil { + // wrap the body so we control when it's actually closed. + // do this outside the for loop so defers don't accumulate. + rwbody = &retryableRequestBody{body: req.Body()} + defer rwbody.realClose() + } + try := int32(1) + for { + resp = nil // reset + log.Writef(log.EventRetryPolicy, "=====> Try=%d", try) + + // For each try, seek to the beginning of the Body stream. We do this even for the 1st try because + // the stream may not be at offset 0 when we first get it and we want the same behavior for the + // 1st try as for additional tries. + err = req.RewindBody() + if err != nil { + return + } + // RewindBody() restores Raw().Body to its original state, so set our rewindable after + if rwbody != nil { + req.Raw().Body = rwbody + } + + if options.TryTimeout == 0 { + resp, err = req.Next() + } else { + // Set the per-try time for this particular retry operation and then Do the operation. + tryCtx, tryCancel := context.WithTimeout(req.Raw().Context(), options.TryTimeout) + clone := req.Clone(tryCtx) + resp, err = clone.Next() // Make the request + // if the body was already downloaded or there was an error it's safe to cancel the context now + if err != nil { + tryCancel() + } else if _, ok := resp.Body.(*shared.NopClosingBytesReader); ok { + tryCancel() + } else { + // must cancel the context after the body has been read and closed + resp.Body = &contextCancelReadCloser{cf: tryCancel, body: resp.Body} + } + } + if err == nil { + log.Writef(log.EventRetryPolicy, "response %d", resp.StatusCode) + } else { + log.Writef(log.EventRetryPolicy, "error %v", err) + } + + if err == nil && !HasStatusCode(resp, options.StatusCodes...) { + // if there is no error and the response code isn't in the list of retry codes then we're done. + log.Write(log.EventRetryPolicy, "exit due to non-retriable status code") + return + } else if ctxErr := req.Raw().Context().Err(); ctxErr != nil { + // don't retry if the parent context has been cancelled or its deadline exceeded + err = ctxErr + log.Writef(log.EventRetryPolicy, "abort due to %v", err) + return + } + + // check if the error is not retriable + var nre errorinfo.NonRetriable + if errors.As(err, &nre) { + // the error says it's not retriable so don't retry + log.Writef(log.EventRetryPolicy, "non-retriable error %T", nre) + return + } + + if try == options.MaxRetries+1 { + // max number of tries has been reached, don't sleep again + log.Writef(log.EventRetryPolicy, "MaxRetries %d exceeded", options.MaxRetries) + return + } + + // use the delay from retry-after if available + delay := shared.RetryAfter(resp) + if delay <= 0 { + delay = calcDelay(options, try) + } else if delay > options.MaxRetryDelay { + // the retry-after delay exceeds the the cap so don't retry + log.Writef(log.EventRetryPolicy, "Retry-After delay %s exceeds MaxRetryDelay of %s", delay, options.MaxRetryDelay) + return + } + + // drain before retrying so nothing is leaked + Drain(resp) + + log.Writef(log.EventRetryPolicy, "End Try #%d, Delay=%v", try, delay) + select { + case <-time.After(delay): + try++ + case <-req.Raw().Context().Done(): + err = req.Raw().Context().Err() + log.Writef(log.EventRetryPolicy, "abort due to %v", err) + return + } + } +} + +// WithRetryOptions adds the specified RetryOptions to the parent context. +// Use this to specify custom RetryOptions at the API-call level. +func WithRetryOptions(parent context.Context, options policy.RetryOptions) context.Context { + return context.WithValue(parent, shared.CtxWithRetryOptionsKey{}, options) +} + +// ********** The following type/methods implement the retryableRequestBody (a ReadSeekCloser) + +// This struct is used when sending a body to the network +type retryableRequestBody struct { + body io.ReadSeeker // Seeking is required to support retries +} + +// Read reads a block of data from an inner stream and reports progress +func (b *retryableRequestBody) Read(p []byte) (n int, err error) { + return b.body.Read(p) +} + +func (b *retryableRequestBody) Seek(offset int64, whence int) (offsetFromStart int64, err error) { + return b.body.Seek(offset, whence) +} + +func (b *retryableRequestBody) Close() error { + // We don't want the underlying transport to close the request body on transient failures so this is a nop. + // The retry policy closes the request body upon success. + return nil +} + +func (b *retryableRequestBody) realClose() error { + if c, ok := b.body.(io.Closer); ok { + return c.Close() + } + return nil +} + +// ********** The following type/methods implement the contextCancelReadCloser + +// contextCancelReadCloser combines an io.ReadCloser with a cancel func. +// it ensures the cancel func is invoked once the body has been read and closed. +type contextCancelReadCloser struct { + cf context.CancelFunc + body io.ReadCloser +} + +func (rc *contextCancelReadCloser) Read(p []byte) (n int, err error) { + return rc.body.Read(p) +} + +func (rc *contextCancelReadCloser) Close() error { + err := rc.body.Close() + rc.cf() + return err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_telemetry.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_telemetry.go new file mode 100644 index 000000000..2abcdc576 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_telemetry.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "bytes" + "fmt" + "net/http" + "os" + "runtime" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +type telemetryPolicy struct { + telemetryValue string +} + +// NewTelemetryPolicy creates a telemetry policy object that adds telemetry information to outgoing HTTP requests. +// The format is [ ]azsdk-go-/ . +// Pass nil to accept the default values; this is the same as passing a zero-value options. +func NewTelemetryPolicy(mod, ver string, o *policy.TelemetryOptions) policy.Policy { + if o == nil { + o = &policy.TelemetryOptions{} + } + tp := telemetryPolicy{} + if o.Disabled { + return &tp + } + b := &bytes.Buffer{} + // normalize ApplicationID + if o.ApplicationID != "" { + o.ApplicationID = strings.ReplaceAll(o.ApplicationID, " ", "/") + if len(o.ApplicationID) > 24 { + o.ApplicationID = o.ApplicationID[:24] + } + b.WriteString(o.ApplicationID) + b.WriteRune(' ') + } + b.WriteString(formatTelemetry(mod, ver)) + b.WriteRune(' ') + b.WriteString(platformInfo) + tp.telemetryValue = b.String() + return &tp +} + +func formatTelemetry(comp, ver string) string { + return fmt.Sprintf("azsdk-go-%s/%s", comp, ver) +} + +func (p telemetryPolicy) Do(req *policy.Request) (*http.Response, error) { + if p.telemetryValue == "" { + return req.Next() + } + // preserve the existing User-Agent string + if ua := req.Raw().Header.Get(shared.HeaderUserAgent); ua != "" { + p.telemetryValue = fmt.Sprintf("%s %s", p.telemetryValue, ua) + } + req.Raw().Header.Set(shared.HeaderUserAgent, p.telemetryValue) + return req.Next() +} + +// NOTE: the ONLY function that should write to this variable is this func +var platformInfo = func() string { + operatingSystem := runtime.GOOS // Default OS string + switch operatingSystem { + case "windows": + operatingSystem = os.Getenv("OS") // Get more specific OS information + case "linux": // accept default OS info + case "freebsd": // accept default OS info + } + return fmt.Sprintf("(%s; %s)", runtime.Version(), operatingSystem) +}() diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go new file mode 100644 index 000000000..14c90fecf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/poller.go @@ -0,0 +1,326 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "context" + "encoding/json" + "errors" + "flag" + "fmt" + "net/http" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// FinalStateVia is the enumerated type for the possible final-state-via values. +type FinalStateVia = pollers.FinalStateVia + +const ( + // FinalStateViaAzureAsyncOp indicates the final payload comes from the Azure-AsyncOperation URL. + FinalStateViaAzureAsyncOp = pollers.FinalStateViaAzureAsyncOp + + // FinalStateViaLocation indicates the final payload comes from the Location URL. + FinalStateViaLocation = pollers.FinalStateViaLocation + + // FinalStateViaOriginalURI indicates the final payload comes from the original URL. + FinalStateViaOriginalURI = pollers.FinalStateViaOriginalURI + + // FinalStateViaOpLocation indicates the final payload comes from the Operation-Location URL. + FinalStateViaOpLocation = pollers.FinalStateViaOpLocation +) + +// NewPollerOptions contains the optional parameters for NewPoller. +type NewPollerOptions[T any] struct { + // FinalStateVia contains the final-state-via value for the LRO. + FinalStateVia FinalStateVia + + // Response contains a preconstructed response type. + // The final payload will be unmarshaled into it and returned. + Response *T + + // Handler[T] contains a custom polling implementation. + Handler PollingHandler[T] +} + +// NewPoller creates a Poller based on the provided initial response. +func NewPoller[T any](resp *http.Response, pl exported.Pipeline, options *NewPollerOptions[T]) (*Poller[T], error) { + if options == nil { + options = &NewPollerOptions[T]{} + } + result := options.Response + if result == nil { + result = new(T) + } + if options.Handler != nil { + return &Poller[T]{ + op: options.Handler, + resp: resp, + result: result, + }, nil + } + + defer resp.Body.Close() + // this is a back-stop in case the swagger is incorrect (i.e. missing one or more status codes for success). + // ideally the codegen should return an error if the initial response failed and not even create a poller. + if !pollers.StatusCodeValid(resp) { + return nil, errors.New("the operation failed or was cancelled") + } + + // determine the polling method + var opr PollingHandler[T] + var err error + if async.Applicable(resp) { + // async poller must be checked first as it can also have a location header + opr, err = async.New[T](pl, resp, options.FinalStateVia) + } else if op.Applicable(resp) { + // op poller must be checked before loc as it can also have a location header + opr, err = op.New[T](pl, resp, options.FinalStateVia) + } else if loc.Applicable(resp) { + opr, err = loc.New[T](pl, resp) + } else if body.Applicable(resp) { + // must test body poller last as it's a subset of the other pollers. + // TODO: this is ambiguous for PATCH/PUT if it returns a 200 with no polling headers (sync completion) + opr, err = body.New[T](pl, resp) + } else if m := resp.Request.Method; resp.StatusCode == http.StatusAccepted && (m == http.MethodDelete || m == http.MethodPost) { + // if we get here it means we have a 202 with no polling headers. + // for DELETE and POST this is a hard error per ARM RPC spec. + return nil, errors.New("response is missing polling URL") + } else { + opr, err = pollers.NewNopPoller[T](resp) + } + + if err != nil { + return nil, err + } + return &Poller[T]{ + op: opr, + resp: resp, + result: result, + }, nil +} + +// NewPollerFromResumeTokenOptions contains the optional parameters for NewPollerFromResumeToken. +type NewPollerFromResumeTokenOptions[T any] struct { + // Response contains a preconstructed response type. + // The final payload will be unmarshaled into it and returned. + Response *T + + // Handler[T] contains a custom polling implementation. + Handler PollingHandler[T] +} + +// NewPollerFromResumeToken creates a Poller from a resume token string. +func NewPollerFromResumeToken[T any](token string, pl exported.Pipeline, options *NewPollerFromResumeTokenOptions[T]) (*Poller[T], error) { + if options == nil { + options = &NewPollerFromResumeTokenOptions[T]{} + } + result := options.Response + if result == nil { + result = new(T) + } + + if err := pollers.IsTokenValid[T](token); err != nil { + return nil, err + } + raw, err := pollers.ExtractToken(token) + if err != nil { + return nil, err + } + var asJSON map[string]interface{} + if err := json.Unmarshal(raw, &asJSON); err != nil { + return nil, err + } + + opr := options.Handler + // now rehydrate the poller based on the encoded poller type + if async.CanResume(asJSON) { + opr, _ = async.New[T](pl, nil, "") + } else if body.CanResume(asJSON) { + opr, _ = body.New[T](pl, nil) + } else if loc.CanResume(asJSON) { + opr, _ = loc.New[T](pl, nil) + } else if op.CanResume(asJSON) { + opr, _ = op.New[T](pl, nil, "") + } else if opr != nil { + log.Writef(log.EventLRO, "Resuming custom poller %T.", opr) + } else { + return nil, fmt.Errorf("unhandled poller token %s", string(raw)) + } + if err := json.Unmarshal(raw, &opr); err != nil { + return nil, err + } + return &Poller[T]{ + op: opr, + result: result, + }, nil +} + +// PollingHandler[T] abstracts the differences among poller implementations. +type PollingHandler[T any] interface { + // Done returns true if the LRO has reached a terminal state. + Done() bool + + // Poll fetches the latest state of the LRO. + Poll(context.Context) (*http.Response, error) + + // Result is called once the LRO has reached a terminal state. It populates the out parameter + // with the result of the operation. + Result(ctx context.Context, out *T) error +} + +// Poller encapsulates a long-running operation, providing polling facilities until the operation reaches a terminal state. +type Poller[T any] struct { + op PollingHandler[T] + resp *http.Response + err error + result *T + done bool +} + +// PollUntilDoneOptions contains the optional values for the Poller[T].PollUntilDone() method. +type PollUntilDoneOptions struct { + // Frequency is the time to wait between polling intervals in absence of a Retry-After header. Allowed minimum is one second. + // Pass zero to accept the default value (30s). + Frequency time.Duration +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached, an error is received, or the context expires. +// It internally uses Poll(), Done(), and Result() in its polling loop, sleeping for the specified duration between intervals. +// options: pass nil to accept the default values. +// NOTE: the default polling frequency is 30 seconds which works well for most operations. However, some operations might +// benefit from a shorter or longer duration. +func (p *Poller[T]) PollUntilDone(ctx context.Context, options *PollUntilDoneOptions) (T, error) { + if options == nil { + options = &PollUntilDoneOptions{} + } + cp := *options + if cp.Frequency == 0 { + cp.Frequency = 30 * time.Second + } + + // skip the floor check when executing tests so they don't take so long + if isTest := flag.Lookup("test.v"); isTest == nil && cp.Frequency < time.Second { + return *new(T), errors.New("polling frequency minimum is one second") + } + + start := time.Now() + logPollUntilDoneExit := func(v interface{}) { + log.Writef(log.EventLRO, "END PollUntilDone() for %T: %v, total time: %s", p.op, v, time.Since(start)) + } + log.Writef(log.EventLRO, "BEGIN PollUntilDone() for %T", p.op) + if p.resp != nil { + // initial check for a retry-after header existing on the initial response + if retryAfter := shared.RetryAfter(p.resp); retryAfter > 0 { + log.Writef(log.EventLRO, "initial Retry-After delay for %s", retryAfter.String()) + if err := shared.Delay(ctx, retryAfter); err != nil { + logPollUntilDoneExit(err) + return *new(T), err + } + } + } + // begin polling the endpoint until a terminal state is reached + for { + resp, err := p.Poll(ctx) + if err != nil { + logPollUntilDoneExit(err) + return *new(T), err + } + if p.Done() { + logPollUntilDoneExit("succeeded") + return p.Result(ctx) + } + d := cp.Frequency + if retryAfter := shared.RetryAfter(resp); retryAfter > 0 { + log.Writef(log.EventLRO, "Retry-After delay for %s", retryAfter.String()) + d = retryAfter + } else { + log.Writef(log.EventLRO, "delay for %s", d.String()) + } + if err = shared.Delay(ctx, d); err != nil { + logPollUntilDoneExit(err) + return *new(T), err + } + } +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If Poll succeeds, the poller's state is updated and the HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the last HTTP response. +func (p *Poller[T]) Poll(ctx context.Context) (*http.Response, error) { + if p.Done() { + // the LRO has reached a terminal state, don't poll again + return p.resp, nil + } + resp, err := p.op.Poll(ctx) + if err != nil { + return nil, err + } + p.resp = resp + return p.resp, nil +} + +// Done returns true if the LRO has reached a terminal state. +// Once a terminal state is reached, call Result(). +func (p *Poller[T]) Done() bool { + return p.op.Done() +} + +// Result returns the result of the LRO and is meant to be used in conjunction with Poll and Done. +// If the LRO completed successfully, a populated instance of T is returned. +// If the LRO failed or was canceled, an *azcore.ResponseError error is returned. +// Calling this on an LRO in a non-terminal state will return an error. +func (p *Poller[T]) Result(ctx context.Context) (T, error) { + if !p.Done() { + return *new(T), errors.New("poller is in a non-terminal state") + } + if p.done { + // the result has already been retrieved, return the cached value + if p.err != nil { + return *new(T), p.err + } + return *p.result, nil + } + err := p.op.Result(ctx, p.result) + var respErr *exported.ResponseError + if errors.As(err, &respErr) { + // the LRO failed. record the error + p.err = err + } else if err != nil { + // the call to Result failed, don't cache anything in this case + return *new(T), err + } + p.done = true + if p.err != nil { + return *new(T), p.err + } + return *p.result, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +// The token's format should be considered opaque and is subject to change. +// Calling this on an LRO in a terminal state will return an error. +func (p *Poller[T]) ResumeToken() (string, error) { + if p.Done() { + return "", errors.New("poller is in a terminal state") + } + tk, err := pollers.NewResumeToken[T](p.op) + if err != nil { + return "", err + } + return tk, err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go new file mode 100644 index 000000000..7b00c7613 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go @@ -0,0 +1,231 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "mime/multipart" + "path" + "reflect" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +// Base64Encoding is usesd to specify which base-64 encoder/decoder to use when +// encoding/decoding a slice of bytes to/from a string. +type Base64Encoding int + +const ( + // Base64StdFormat uses base64.StdEncoding for encoding and decoding payloads. + Base64StdFormat Base64Encoding = 0 + + // Base64URLFormat uses base64.RawURLEncoding for encoding and decoding payloads. + Base64URLFormat Base64Encoding = 1 +) + +// NewRequest creates a new policy.Request with the specified input. +// The endpoint MUST be properly encoded before calling this function. +func NewRequest(ctx context.Context, httpMethod string, endpoint string) (*policy.Request, error) { + return exported.NewRequest(ctx, httpMethod, endpoint) +} + +// JoinPaths concatenates multiple URL path segments into one path, +// inserting path separation characters as required. JoinPaths will preserve +// query parameters in the root path +func JoinPaths(root string, paths ...string) string { + if len(paths) == 0 { + return root + } + + qps := "" + if strings.Contains(root, "?") { + splitPath := strings.Split(root, "?") + root, qps = splitPath[0], splitPath[1] + } + + p := path.Join(paths...) + // path.Join will remove any trailing slashes. + // if one was provided, preserve it. + if strings.HasSuffix(paths[len(paths)-1], "/") && !strings.HasSuffix(p, "/") { + p += "/" + } + + if qps != "" { + p = p + "?" + qps + } + + if strings.HasSuffix(root, "/") && strings.HasPrefix(p, "/") { + root = root[:len(root)-1] + } else if !strings.HasSuffix(root, "/") && !strings.HasPrefix(p, "/") { + p = "/" + p + } + return root + p +} + +// EncodeByteArray will base-64 encode the byte slice v. +func EncodeByteArray(v []byte, format Base64Encoding) string { + if format == Base64URLFormat { + return base64.RawURLEncoding.EncodeToString(v) + } + return base64.StdEncoding.EncodeToString(v) +} + +// MarshalAsByteArray will base-64 encode the byte slice v, then calls SetBody. +// The encoded value is treated as a JSON string. +func MarshalAsByteArray(req *policy.Request, v []byte, format Base64Encoding) error { + // send as a JSON string + encode := fmt.Sprintf("\"%s\"", EncodeByteArray(v, format)) + return req.SetBody(exported.NopCloser(strings.NewReader(encode)), shared.ContentTypeAppJSON) +} + +// MarshalAsJSON calls json.Marshal() to get the JSON encoding of v then calls SetBody. +func MarshalAsJSON(req *policy.Request, v interface{}) error { + v = cloneWithoutReadOnlyFields(v) + b, err := json.Marshal(v) + if err != nil { + return fmt.Errorf("error marshalling type %T: %s", v, err) + } + return req.SetBody(exported.NopCloser(bytes.NewReader(b)), shared.ContentTypeAppJSON) +} + +// MarshalAsXML calls xml.Marshal() to get the XML encoding of v then calls SetBody. +func MarshalAsXML(req *policy.Request, v interface{}) error { + b, err := xml.Marshal(v) + if err != nil { + return fmt.Errorf("error marshalling type %T: %s", v, err) + } + // inclue the XML header as some services require it + b = []byte(xml.Header + string(b)) + return req.SetBody(exported.NopCloser(bytes.NewReader(b)), shared.ContentTypeAppXML) +} + +// SetMultipartFormData writes the specified keys/values as multi-part form +// fields with the specified value. File content must be specified as a ReadSeekCloser. +// All other values are treated as string values. +func SetMultipartFormData(req *policy.Request, formData map[string]interface{}) error { + body := bytes.Buffer{} + writer := multipart.NewWriter(&body) + for k, v := range formData { + if rsc, ok := v.(io.ReadSeekCloser); ok { + // this is the body to upload, the key is its file name + fd, err := writer.CreateFormFile(k, k) + if err != nil { + return err + } + // copy the data to the form file + if _, err = io.Copy(fd, rsc); err != nil { + return err + } + continue + } + // ensure the value is in string format + s, ok := v.(string) + if !ok { + s = fmt.Sprintf("%v", v) + } + if err := writer.WriteField(k, s); err != nil { + return err + } + } + if err := writer.Close(); err != nil { + return err + } + return req.SetBody(exported.NopCloser(bytes.NewReader(body.Bytes())), writer.FormDataContentType()) +} + +// SkipBodyDownload will disable automatic downloading of the response body. +func SkipBodyDownload(req *policy.Request) { + req.SetOperationValue(bodyDownloadPolicyOpValues{Skip: true}) +} + +// returns a clone of the object graph pointed to by v, omitting values of all read-only +// fields. if there are no read-only fields in the object graph, no clone is created. +func cloneWithoutReadOnlyFields(v interface{}) interface{} { + val := reflect.Indirect(reflect.ValueOf(v)) + if val.Kind() != reflect.Struct { + // not a struct, skip + return v + } + // first walk the graph to find any R/O fields. + // if there aren't any, skip cloning the graph. + if !recursiveFindReadOnlyField(val) { + return v + } + return recursiveCloneWithoutReadOnlyFields(val) +} + +// returns true if any field in the object graph of val contains the `azure:"ro"` tag value +func recursiveFindReadOnlyField(val reflect.Value) bool { + t := val.Type() + // iterate over the fields, looking for the "azure" tag. + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + aztag := field.Tag.Get("azure") + if azureTagIsReadOnly(aztag) { + return true + } else if reflect.Indirect(val.Field(i)).Kind() == reflect.Struct && recursiveFindReadOnlyField(reflect.Indirect(val.Field(i))) { + return true + } + } + return false +} + +// clones the object graph of val. all non-R/O properties are copied to the clone +func recursiveCloneWithoutReadOnlyFields(val reflect.Value) interface{} { + t := val.Type() + clone := reflect.New(t) + // iterate over the fields, looking for the "azure" tag. + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + aztag := field.Tag.Get("azure") + if azureTagIsReadOnly(aztag) { + // omit from payload + continue + } + // clone field will receive the same value as the source field... + value := val.Field(i) + v := reflect.Indirect(value) + if v.IsValid() && v.Type() != reflect.TypeOf(time.Time{}) && v.Kind() == reflect.Struct { + // ...unless the source value is a struct, in which case we recurse to clone that struct. + // (We can't recursively clone time.Time because it contains unexported fields.) + c := recursiveCloneWithoutReadOnlyFields(v) + if field.Anonymous { + // NOTE: this does not handle the case of embedded fields of unexported struct types. + // this should be ok as we don't generate any code like this at present + value = reflect.Indirect(reflect.ValueOf(c)) + } else { + value = reflect.ValueOf(c) + } + } + reflect.Indirect(clone).Field(i).Set(value) + } + return clone.Interface() +} + +// returns true if the "azure" tag contains the option "ro" +func azureTagIsReadOnly(tag string) bool { + if tag == "" { + return false + } + parts := strings.Split(tag, ",") + for _, part := range parts { + if part == "ro" { + return true + } + } + return false +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go new file mode 100644 index 000000000..f86ec0b95 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/response.go @@ -0,0 +1,136 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" +) + +// Payload reads and returns the response body or an error. +// On a successful read, the response body is cached. +// Subsequent reads will access the cached value. +func Payload(resp *http.Response) ([]byte, error) { + return exported.Payload(resp) +} + +// HasStatusCode returns true if the Response's status code is one of the specified values. +func HasStatusCode(resp *http.Response, statusCodes ...int) bool { + return exported.HasStatusCode(resp, statusCodes...) +} + +// UnmarshalAsByteArray will base-64 decode the received payload and place the result into the value pointed to by v. +func UnmarshalAsByteArray(resp *http.Response, v *[]byte, format Base64Encoding) error { + p, err := Payload(resp) + if err != nil { + return err + } + return DecodeByteArray(string(p), v, format) +} + +// UnmarshalAsJSON calls json.Unmarshal() to unmarshal the received payload into the value pointed to by v. +func UnmarshalAsJSON(resp *http.Response, v interface{}) error { + payload, err := Payload(resp) + if err != nil { + return err + } + // TODO: verify early exit is correct + if len(payload) == 0 { + return nil + } + err = removeBOM(resp) + if err != nil { + return err + } + err = json.Unmarshal(payload, v) + if err != nil { + err = fmt.Errorf("unmarshalling type %T: %s", v, err) + } + return err +} + +// UnmarshalAsXML calls xml.Unmarshal() to unmarshal the received payload into the value pointed to by v. +func UnmarshalAsXML(resp *http.Response, v interface{}) error { + payload, err := Payload(resp) + if err != nil { + return err + } + // TODO: verify early exit is correct + if len(payload) == 0 { + return nil + } + err = removeBOM(resp) + if err != nil { + return err + } + err = xml.Unmarshal(payload, v) + if err != nil { + err = fmt.Errorf("unmarshalling type %T: %s", v, err) + } + return err +} + +// Drain reads the response body to completion then closes it. The bytes read are discarded. +func Drain(resp *http.Response) { + if resp != nil && resp.Body != nil { + _, _ = io.Copy(io.Discard, resp.Body) + resp.Body.Close() + } +} + +// removeBOM removes any byte-order mark prefix from the payload if present. +func removeBOM(resp *http.Response) error { + payload, err := Payload(resp) + if err != nil { + return err + } + // UTF8 + trimmed := bytes.TrimPrefix(payload, []byte("\xef\xbb\xbf")) + if len(trimmed) < len(payload) { + resp.Body.(shared.BytesSetter).Set(trimmed) + } + return nil +} + +// DecodeByteArray will base-64 decode the provided string into v. +func DecodeByteArray(s string, v *[]byte, format Base64Encoding) error { + if len(s) == 0 { + return nil + } + payload := string(s) + if payload[0] == '"' { + // remove surrounding quotes + payload = payload[1 : len(payload)-1] + } + switch format { + case Base64StdFormat: + decoded, err := base64.StdEncoding.DecodeString(payload) + if err == nil { + *v = decoded + return nil + } + return err + case Base64URLFormat: + // use raw encoding as URL format should not contain any '=' characters + decoded, err := base64.RawURLEncoding.DecodeString(payload) + if err == nil { + *v = decoded + return nil + } + return err + default: + return fmt.Errorf("unrecognized byte array format: %d", format) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go new file mode 100644 index 000000000..869bed511 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/transport_default_http_client.go @@ -0,0 +1,37 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package runtime + +import ( + "crypto/tls" + "net" + "net/http" + "time" +) + +var defaultHTTPClient *http.Client + +func init() { + defaultTransport := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + }, + } + defaultHTTPClient = &http.Client{ + Transport: defaultTransport, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/doc.go new file mode 100644 index 000000000..cadaef3d5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/doc.go @@ -0,0 +1,9 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package streaming contains helpers for streaming IO operations and progress reporting. +package streaming diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/progress.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/progress.go new file mode 100644 index 000000000..8563375af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming/progress.go @@ -0,0 +1,72 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package streaming + +import ( + "io" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" +) + +type progress struct { + rc io.ReadCloser + rsc io.ReadSeekCloser + pr func(bytesTransferred int64) + offset int64 +} + +// NopCloser returns a ReadSeekCloser with a no-op close method wrapping the provided io.ReadSeeker. +func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser { + return exported.NopCloser(rs) +} + +// NewRequestProgress adds progress reporting to an HTTP request's body stream. +func NewRequestProgress(body io.ReadSeekCloser, pr func(bytesTransferred int64)) io.ReadSeekCloser { + return &progress{ + rc: body, + rsc: body, + pr: pr, + offset: 0, + } +} + +// NewResponseProgress adds progress reporting to an HTTP response's body stream. +func NewResponseProgress(body io.ReadCloser, pr func(bytesTransferred int64)) io.ReadCloser { + return &progress{ + rc: body, + rsc: nil, + pr: pr, + offset: 0, + } +} + +// Read reads a block of data from an inner stream and reports progress +func (p *progress) Read(b []byte) (n int, err error) { + n, err = p.rc.Read(b) + if err != nil && err != io.EOF { + return + } + p.offset += int64(n) + // Invokes the user's callback method to report progress + p.pr(p.offset) + return +} + +// Seek only expects a zero or from beginning. +func (p *progress) Seek(offset int64, whence int) (int64, error) { + // This should only ever be called with offset = 0 and whence = io.SeekStart + n, err := p.rsc.Seek(offset, whence) + if err == nil { + p.offset = int64(n) + } + return n, err +} + +// requestBodyProgress supports Close but the underlying stream may not; if it does, Close will close it. +func (p *progress) Close() error { + return p.rc.Close() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/doc.go new file mode 100644 index 000000000..faa98c9dc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/doc.go @@ -0,0 +1,9 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright 2017 Microsoft Corporation. All rights reserved. +// Use of this source code is governed by an MIT +// license that can be found in the LICENSE file. + +// Package to contains various type-conversion helper functions. +package to diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/to.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/to.go new file mode 100644 index 000000000..e0e4817b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/to/to.go @@ -0,0 +1,21 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package to + +// Ptr returns a pointer to the provided value. +func Ptr[T any](v T) *T { + return &v +} + +// SliceOfPtrs returns a slice of *T from the specified values. +func SliceOfPtrs[T any](vv ...T) []*T { + slc := make([]*T, len(vv)) + for i := range vv { + slc[i] = Ptr(vv[i]) + } + return slc +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md new file mode 100644 index 000000000..670839fd4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md @@ -0,0 +1,295 @@ +# Release History + +## 1.1.0 (2022-06-07) + +### Features Added +* `ClientCertificateCredential` and `ClientSecretCredential` support ESTS-R. First-party + applications can set environment variable `AZURE_REGIONAL_AUTHORITY_NAME` with a + region name. + +## 1.0.1 (2022-06-07) + +### Other Changes +* Upgrade `microsoft-authentication-library-for-go` requirement to v0.5.1 + ([#18176](https://github.com/Azure/azure-sdk-for-go/issues/18176)) + +## 1.0.0 (2022-05-12) + +### Features Added +* `DefaultAzureCredential` reads environment variable `AZURE_CLIENT_ID` for the + client ID of a user-assigned managed identity + ([#17293](https://github.com/Azure/azure-sdk-for-go/pull/17293)) + +### Breaking Changes +* Removed `AuthorizationCodeCredential`. Use `InteractiveBrowserCredential` instead + to authenticate a user with the authorization code flow. +* Instances of `AuthenticationFailedError` are now returned by pointer. +* `GetToken()` returns `azcore.AccessToken` by value + +### Bugs Fixed +* `AzureCLICredential` panics after receiving an unexpected error type + ([#17490](https://github.com/Azure/azure-sdk-for-go/issues/17490)) + +### Other Changes +* `GetToken()` returns an error when the caller specifies no scope +* Updated to the latest versions of `golang.org/x/crypto`, `azcore` and `internal` + +## 0.14.0 (2022-04-05) + +### Breaking Changes +* This module now requires Go 1.18 +* Removed `AuthorityHost`. Credentials are now configured for sovereign or private + clouds with the API in `azcore/cloud`, for example: + ```go + // before + opts := azidentity.ClientSecretCredentialOptions{AuthorityHost: azidentity.AzureGovernment} + cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, secret, &opts) + + // after + import "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + + opts := azidentity.ClientSecretCredentialOptions{} + opts.Cloud = cloud.AzureGovernment + cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, secret, &opts) + ``` + +## 0.13.2 (2022-03-08) + +### Bugs Fixed +* Prevented a data race in `DefaultAzureCredential` and `ChainedTokenCredential` + ([#17144](https://github.com/Azure/azure-sdk-for-go/issues/17144)) + +### Other Changes +* Upgraded App Service managed identity version from 2017-09-01 to 2019-08-01 + ([#17086](https://github.com/Azure/azure-sdk-for-go/pull/17086)) + +## 0.13.1 (2022-02-08) + +### Features Added +* `EnvironmentCredential` supports certificate SNI authentication when + `AZURE_CLIENT_SEND_CERTIFICATE_CHAIN` is "true". + ([#16851](https://github.com/Azure/azure-sdk-for-go/pull/16851)) + +### Bugs Fixed +* `ManagedIdentityCredential.GetToken()` now returns an error when configured for + a user assigned identity in Azure Cloud Shell (which doesn't support such identities) + ([#16946](https://github.com/Azure/azure-sdk-for-go/pull/16946)) + +### Other Changes +* `NewDefaultAzureCredential()` logs non-fatal errors. These errors are also included in the + error returned by `DefaultAzureCredential.GetToken()` when it's unable to acquire a token + from any source. ([#15923](https://github.com/Azure/azure-sdk-for-go/issues/15923)) + +## 0.13.0 (2022-01-11) + +### Breaking Changes +* Replaced `AuthenticationFailedError.RawResponse()` with a field having the same name +* Unexported `CredentialUnavailableError` +* Instances of `ChainedTokenCredential` will now skip looping through the list of source credentials and re-use the first successful credential on subsequent calls to `GetToken`. + * If `ChainedTokenCredentialOptions.RetrySources` is true, `ChainedTokenCredential` will continue to try all of the originally provided credentials each time the `GetToken` method is called. + * `ChainedTokenCredential.successfulCredential` will contain a reference to the last successful credential. + * `DefaultAzureCredenial` will also re-use the first successful credential on subsequent calls to `GetToken`. + * `DefaultAzureCredential.chain.successfulCredential` will also contain a reference to the last successful credential. + +### Other Changes +* `ManagedIdentityCredential` no longer probes IMDS before requesting a token + from it. Also, an error response from IMDS no longer disables a credential + instance. Following an error, a credential instance will continue to send + requests to IMDS as necessary. +* Adopted MSAL for user and service principal authentication +* Updated `azcore` requirement to 0.21.0 + +## 0.12.0 (2021-11-02) +### Breaking Changes +* Raised minimum go version to 1.16 +* Removed `NewAuthenticationPolicy()` from credentials. Clients should instead use azcore's + `runtime.NewBearerTokenPolicy()` to construct a bearer token authorization policy. +* The `AuthorityHost` field in credential options structs is now a custom type, + `AuthorityHost`, with underlying type `string` +* `NewChainedTokenCredential` has a new signature to accommodate a placeholder + options struct: + ```go + // before + cred, err := NewChainedTokenCredential(credA, credB) + + // after + cred, err := NewChainedTokenCredential([]azcore.TokenCredential{credA, credB}, nil) + ``` +* Removed `ExcludeAzureCLICredential`, `ExcludeEnvironmentCredential`, and `ExcludeMSICredential` + from `DefaultAzureCredentialOptions` +* `NewClientCertificateCredential` requires a `[]*x509.Certificate` and `crypto.PrivateKey` instead of + a path to a certificate file. Added `ParseCertificates` to simplify getting these in common cases: + ```go + // before + cred, err := NewClientCertificateCredential("tenant", "client-id", "/cert.pem", nil) + + // after + certData, err := os.ReadFile("/cert.pem") + certs, key, err := ParseCertificates(certData, password) + cred, err := NewClientCertificateCredential(tenantID, clientID, certs, key, nil) + ``` +* Removed `InteractiveBrowserCredentialOptions.ClientSecret` and `.Port` +* Removed `AADAuthenticationFailedError` +* Removed `id` parameter of `NewManagedIdentityCredential()`. User assigned identities are now + specified by `ManagedIdentityCredentialOptions.ID`: + ```go + // before + cred, err := NewManagedIdentityCredential("client-id", nil) + // or, for a resource ID + opts := &ManagedIdentityCredentialOptions{ID: ResourceID} + cred, err := NewManagedIdentityCredential("/subscriptions/...", opts) + + // after + clientID := ClientID("7cf7db0d-...") + opts := &ManagedIdentityCredentialOptions{ID: clientID} + // or, for a resource ID + resID: ResourceID("/subscriptions/...") + opts := &ManagedIdentityCredentialOptions{ID: resID} + cred, err := NewManagedIdentityCredential(opts) + ``` +* `DeviceCodeCredentialOptions.UserPrompt` has a new type: `func(context.Context, DeviceCodeMessage) error` +* Credential options structs now embed `azcore.ClientOptions`. In addition to changing literal initialization + syntax, this change renames `HTTPClient` fields to `Transport`. +* Renamed `LogCredential` to `EventCredential` +* `AzureCLICredential` no longer reads the environment variable `AZURE_CLI_PATH` +* `NewManagedIdentityCredential` no longer reads environment variables `AZURE_CLIENT_ID` and + `AZURE_RESOURCE_ID`. Use `ManagedIdentityCredentialOptions.ID` instead. +* Unexported `AuthenticationFailedError` and `CredentialUnavailableError` structs. In their place are two + interfaces having the same names. + +### Bugs Fixed +* `AzureCLICredential.GetToken` no longer mutates its `opts.Scopes` + +### Features Added +* Added connection configuration options to `DefaultAzureCredentialOptions` +* `AuthenticationFailedError.RawResponse()` returns the HTTP response motivating the error, + if available + +### Other Changes +* `NewDefaultAzureCredential()` returns `*DefaultAzureCredential` instead of `*ChainedTokenCredential` +* Added `TenantID` field to `DefaultAzureCredentialOptions` and `AzureCLICredentialOptions` + +## 0.11.0 (2021-09-08) +### Breaking Changes +* Unexported `AzureCLICredentialOptions.TokenProvider` and its type, + `AzureCLITokenProvider` + +### Bug Fixes +* `ManagedIdentityCredential.GetToken` returns `CredentialUnavailableError` + when IMDS has no assigned identity, signaling `DefaultAzureCredential` to + try other credentials + + +## 0.10.0 (2021-08-30) +### Breaking Changes +* Update based on `azcore` refactor [#15383](https://github.com/Azure/azure-sdk-for-go/pull/15383) + +## 0.9.3 (2021-08-20) + +### Bugs Fixed +* `ManagedIdentityCredential.GetToken` no longer mutates its `opts.Scopes` + +### Other Changes +* Bumps version of `azcore` to `v0.18.1` + + +## 0.9.2 (2021-07-23) +### Features Added +* Adding support for Service Fabric environment in `ManagedIdentityCredential` +* Adding an option for using a resource ID instead of client ID in `ManagedIdentityCredential` + + +## 0.9.1 (2021-05-24) +### Features Added +* Add LICENSE.txt and bump version information + + +## 0.9.0 (2021-05-21) +### Features Added +* Add support for authenticating in Azure Stack environments +* Enable user assigned identities for the IMDS scenario in `ManagedIdentityCredential` +* Add scope to resource conversion in `GetToken()` on `ManagedIdentityCredential` + + +## 0.8.0 (2021-01-20) +### Features Added +* Updating documentation + + +## 0.7.1 (2021-01-04) +### Features Added +* Adding port option to `InteractiveBrowserCredential` + + +## 0.7.0 (2020-12-11) +### Features Added +* Add `redirectURI` parameter back to authentication code flow + + +## 0.6.1 (2020-12-09) +### Features Added +* Updating query parameter in `ManagedIdentityCredential` and updating datetime string for parsing managed identity access tokens. + + +## 0.6.0 (2020-11-16) +### Features Added +* Remove `RedirectURL` parameter from auth code flow to align with the MSAL implementation which relies on the native client redirect URL. + + +## 0.5.0 (2020-10-30) +### Features Added +* Flattening credential options + + +## 0.4.3 (2020-10-21) +### Features Added +* Adding Azure Arc support in `ManagedIdentityCredential` + + +## 0.4.2 (2020-10-16) +### Features Added +* Typo fixes + + +## 0.4.1 (2020-10-16) +### Features Added +* Ensure authority hosts are only HTTPs + + +## 0.4.0 (2020-10-16) +### Features Added +* Adding options structs for credentials + + +## 0.3.0 (2020-10-09) +### Features Added +* Update `DeviceCodeCredential` callback + + +## 0.2.2 (2020-10-09) +### Features Added +* Add `AuthorizationCodeCredential` + + +## 0.2.1 (2020-10-06) +### Features Added +* Add `InteractiveBrowserCredential` + + +## 0.2.0 (2020-09-11) +### Features Added +* Refactor `azidentity` on top of `azcore` refactor +* Updated policies to conform to `policy.Policy` interface changes. +* Updated non-retriable errors to conform to `azcore.NonRetriableError`. +* Fixed calls to `Request.SetBody()` to include content type. +* Switched endpoints to string types and removed extra parsing code. + + +## 0.1.1 (2020-09-02) +### Features Added +* Add `AzureCLICredential` to `DefaultAzureCredential` chain + + +## 0.1.0 (2020-07-23) +### Features Added +* Initial Release. Azure Identity library that provides Azure Active Directory token authentication support for the SDK. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/LICENSE.txt new file mode 100644 index 000000000..48ea6616b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/MIGRATION.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/MIGRATION.md new file mode 100644 index 000000000..4ac53eb7b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/MIGRATION.md @@ -0,0 +1,307 @@ +# Migrating from autorest/adal to azidentity + +`azidentity` provides Azure Active Directory (Azure AD) authentication for the newest Azure SDK modules (`github.com/azure-sdk-for-go/sdk/...`). Older Azure SDK packages (`github.com/azure-sdk-for-go/services/...`) use types from `github.com/go-autorest/autorest/adal` instead. + +This guide shows common authentication code using `autorest/adal` and its equivalent using `azidentity`. + +## Table of contents + +- [Acquire a token](#acquire-a-token) +- [Client certificate authentication](#client-certificate-authentication) +- [Client secret authentication](#client-secret-authentication) +- [Configuration](#configuration) +- [Device code authentication](#device-code-authentication) +- [Managed identity](#managed-identity) +- [Use azidentity credentials with older packages](#use-azidentity-credentials-with-older-packages) + +## Configuration + +### `autorest/adal` + +Token providers require a token audience (resource identifier) and an instance of `adal.OAuthConfig`, which requires an Azure AD endpoint and tenant: + +```go +import "github.com/Azure/go-autorest/autorest/adal" + +oauthCfg, err := adal.NewOAuthConfig("https://login.chinacloudapi.cn", tenantID) +handle(err) + +spt, err := adal.NewServicePrincipalTokenWithSecret( + *oauthCfg, clientID, "https://management.chinacloudapi.cn/", &adal.ServicePrincipalTokenSecret{ClientSecret: secret}, +) +``` + +### `azidentity` + +A credential instance can acquire tokens for any audience. The audience for each token is determined by the client requesting it. Credentials require endpoint configuration only for sovereign or private clouds. The `azcore/cloud` package has predefined configuration for sovereign clouds such as Azure China: + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" +) + +clientOpts := azcore.ClientOptions{Cloud: cloud.AzureChina} + +cred, err := azidentity.NewClientSecretCredential( + tenantID, clientID, secret, &azidentity.ClientSecretCredentialOptions{ClientOptions: clientOpts}, +) +handle(err) +``` + +## Client secret authentication + +### `autorest/adal` + +```go +import ( + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" +) + +oauthCfg, err := adal.NewOAuthConfig("https://login.microsoftonline.com", tenantID) +handle(err) +spt, err := adal.NewServicePrincipalTokenWithSecret( + *oauthCfg, clientID, "https://management.azure.com/", &adal.ServicePrincipalTokenSecret{ClientSecret: secret}, +) +handle(err) + +client := subscriptions.NewClient() +client.Authorizer = autorest.NewBearerAuthorizer(spt) +``` + +### `azidentity` + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions" +) + +cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) +handle(err) + +client, err := armsubscriptions.NewClient(cred, nil) +handle(err) +``` + +## Client certificate authentication + +### `autorest/adal` + +```go +import ( + "os" + + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" +) +certData, err := os.ReadFile("./example.pfx") +handle(err) + +certificate, rsaPrivateKey, err := decodePkcs12(certData, "") +handle(err) + +oauthCfg, err := adal.NewOAuthConfig("https://login.microsoftonline.com", tenantID) +handle(err) + +spt, err := adal.NewServicePrincipalTokenFromCertificate( + *oauthConfig, clientID, certificate, rsaPrivateKey, "https://management.azure.com/", +) + +client := subscriptions.NewClient() +client.Authorizer = autorest.NewBearerAuthorizer(spt) +``` + +### `azidentity` + +```go +import ( + "os" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions" +) + +certData, err := os.ReadFile("./example.pfx") +handle(err) + +certs, key, err := azidentity.ParseCertificates(certData, nil) +handle(err) + +cred, err = azidentity.NewClientCertificateCredential(tenantID, clientID, certs, key, nil) +handle(err) + +client, err := armsubscriptions.NewClient(cred, nil) +handle(err) +``` + +## Managed identity + +### `autorest/adal` + +```go +import ( + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" +) + +spt, err := adal.NewServicePrincipalTokenFromManagedIdentity("https://management.azure.com/", nil) +handle(err) + +client := subscriptions.NewClient() +client.Authorizer = autorest.NewBearerAuthorizer(spt) +``` + +### `azidentity` + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions" +) + +cred, err := azidentity.NewManagedIdentityCredential(nil) +handle(err) + +client, err := armsubscriptions.NewClient(cred, nil) +handle(err) +``` + +### User-assigned identities + +`autorest/adal`: + +```go +import "github.com/Azure/go-autorest/autorest/adal" + +opts := &adal.ManagedIdentityOptions{ClientID: "..."} +spt, err := adal.NewServicePrincipalTokenFromManagedIdentity("https://management.azure.com/") +handle(err) +``` + +`azidentity`: + +```go +import "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + +opts := azidentity.ManagedIdentityCredentialOptions{ID: azidentity.ClientID("...")} +cred, err := azidentity.NewManagedIdentityCredential(&opts) +handle(err) +``` + +## Device code authentication + +### `autorest/adal` + +```go +import ( + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" +) + +oauthClient := &http.Client{} +oauthCfg, err := adal.NewOAuthConfig("https://login.microsoftonline.com", tenantID) +handle(err) +resource := "https://management.azure.com/" +deviceCode, err := adal.InitiateDeviceAuth(oauthClient, *oauthCfg, clientID, resource) +handle(err) + +// display instructions, wait for the user to authenticate +fmt.Println(*deviceCode.Message) +token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) +handle(err) + +spt, err := adal.NewServicePrincipalTokenFromManualToken(*oauthCfg, clientID, resource, *token) +handle(err) + +client := subscriptions.NewClient() +client.Authorizer = autorest.NewBearerAuthorizer(spt) +``` + +### `azidentity` + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions" +) + +cred, err := azidentity.NewDeviceCodeCredential(nil) +handle(err) + +client, err := armsubscriptions.NewSubscriptionsClient(cred, nil) +handle(err) +``` + +`azidentity.DeviceCodeCredential` will guide a user through authentication, printing instructions to the console by default. The user prompt is customizable. For more information, see the [package documentation](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#DeviceCodeCredential). + +## Acquire a token + +### `autorest/adal` + +```go +import "github.com/Azure/go-autorest/autorest/adal" + +oauthCfg, err := adal.NewOAuthConfig("https://login.microsoftonline.com", tenantID) +handle(err) + +spt, err := adal.NewServicePrincipalTokenWithSecret( + *oauthCfg, clientID, "https://vault.azure.net", &adal.ServicePrincipalTokenSecret{ClientSecret: secret}, +) + +err = spt.Refresh() +if err == nil { + token := spt.Token +} +``` + +### `azidentity` + +In ordinary usage, application code doesn't need to request tokens from credentials directly. Azure SDK clients handle token acquisition and refreshing internally. However, applications may call `GetToken()` to do so. All credential types have this method. + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" +) + +cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) +handle(err) + +tk, err := cred.GetToken( + context.TODO(), policy.TokenRequestOptions{Scopes: []string{"https://vault.azure.net/.default"}}, +) +if err == nil { + token := tk.Token +} +``` + +Note that `azidentity` credentials use the Azure AD v2.0 endpoint, which requires OAuth 2 scopes instead of the resource identifiers `autorest/adal` expects. For more information, see [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/v2-permissions-and-consent). + +## Use azidentity credentials with older packages + +The [azidext module](https://pkg.go.dev/github.com/jongio/azidext/go/azidext) provides an adapter for `azidentity` credential types. The adapter enables using the credential types with older Azure SDK clients. For example: + +```go +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/subscriptions" + "github.com/jongio/azidext/go/azidext" +) + +cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, secret, nil) +handle(err) + +client := subscriptions.NewClient() +client.Authorizer = azidext.NewTokenCredentialAdapter(cred, []string{"https://management.azure.com//.default"}) +``` + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-go%2Fsdk%2Fazidentity%2FMIGRATION.png) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md new file mode 100644 index 000000000..68b35a545 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/README.md @@ -0,0 +1,239 @@ +# Azure Identity Client Module for Go + +The Azure Identity module provides Azure Active Directory (Azure AD) token authentication support across the Azure SDK. It includes a set of `TokenCredential` implementations, which can be used with Azure SDK clients supporting token authentication. + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/azidentity)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) +| [Azure Active Directory documentation](https://docs.microsoft.com/azure/active-directory/) +| [Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/azidentity) + +# Getting started + +## Install the module + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Identity module: + +```sh +go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity +``` + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 + +### Authenticating during local development + +When debugging and executing code locally, developers typically use their own accounts to authenticate calls to Azure services. The `azidentity` module supports authenticating through developer tools to simplify local development. + +#### Authenticating via the Azure CLI + +`DefaultAzureCredential` and `AzureCLICredential` can authenticate as the user +signed in to the [Azure CLI](https://docs.microsoft.com/cli/azure). To sign in to the Azure CLI, run `az login`. On a system with a default web browser, the Azure CLI will launch the browser to authenticate a user. + +When no default browser is available, `az login` will use the device code +authentication flow. This can also be selected manually by running `az login --use-device-code`. + +## Key concepts + +### Credentials + +A credential is a type which contains or can obtain the data needed for a +service client to authenticate requests. Service clients across the Azure SDK +accept a credential instance when they are constructed, and use that credential +to authenticate requests. + +The `azidentity` module focuses on OAuth authentication with Azure Active +Directory (AAD). It offers a variety of credential types capable of acquiring +an Azure AD access token. See [Credential Types](#credential-types "Credential Types") for a list of this module's credential types. + +### DefaultAzureCredential + +`DefaultAzureCredential` is appropriate for most apps that will be deployed to Azure. It combines common production credentials with development credentials. It attempts to authenticate via the following mechanisms in this order, stopping when one succeeds: + +![DefaultAzureCredential authentication flow](img/mermaidjs/DefaultAzureCredentialAuthFlow.svg) + +1. **Environment** - `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate. +2. **Managed Identity** - If the app is deployed to an Azure host with managed identity enabled, `DefaultAzureCredential` will authenticate with it. +3. **Azure CLI** - If a user or service principal has authenticated via the Azure CLI `az login` command, `DefaultAzureCredential` will authenticate that identity. + +> Note: `DefaultAzureCredential` is intended to simplify getting started with the SDK by handling common scenarios with reasonable default behaviors. Developers who want more control or whose scenario isn't served by the default settings should use other credential types. + +## Managed Identity + +`DefaultAzureCredential` and `ManagedIdentityCredential` support +[managed identity authentication](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview) +in any hosting environment which supports managed identities, such as (this list is not exhaustive): +* [Azure App Service](https://docs.microsoft.com/azure/app-service/overview-managed-identity) +* [Azure Arc](https://docs.microsoft.com/azure/azure-arc/servers/managed-identity-authentication) +* [Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/msi-authorization) +* [Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/use-managed-identity) +* [Azure Service Fabric](https://docs.microsoft.com/azure/service-fabric/concepts-managed-identity) +* [Azure Virtual Machines](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token) + +## Examples + +- [Authenticate with DefaultAzureCredential](#authenticate-with-defaultazurecredential "Authenticate with DefaultAzureCredential") +- [Define a custom authentication flow with ChainedTokenCredential](#define-a-custom-authentication-flow-with-chainedtokencredential "Define a custom authentication flow with ChainedTokenCredential") +- [Specify a user-assigned managed identity for DefaultAzureCredential](#specify-a-user-assigned-managed-identity-for-defaultazurecredential) + +### Authenticate with DefaultAzureCredential + +This example demonstrates authenticating a client from the `armresources` module with `DefaultAzureCredential`. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +if err != nil { + // handle error +} + +client := armresources.NewResourceGroupsClient("subscription ID", cred, nil) +``` + +### Specify a user-assigned managed identity for DefaultAzureCredential + +To configure `DefaultAzureCredential` to authenticate a user-assigned managed identity, set the environment variable `AZURE_CLIENT_ID` to the identity's client ID. + +### Define a custom authentication flow with `ChainedTokenCredential` + +`DefaultAzureCredential` is generally the quickest way to get started developing apps for Azure. For more advanced scenarios, `ChainedTokenCredential` links multiple credential instances to be tried sequentially when authenticating. It will try each chained credential in turn until one provides a token or fails to authenticate due to an error. + +The following example demonstrates creating a credential, which will attempt to authenticate using managed identity. It will fall back to authenticating via the Azure CLI when a managed identity is unavailable. + +```go +managed, err := azidentity.NewManagedIdentityCredential(nil) +if err != nil { + // handle error +} +azCLI, err := azidentity.NewAzureCLICredential(nil) +if err != nil { + // handle error +} +chain, err := azidentity.NewChainedTokenCredential([]azcore.TokenCredential{managed, azCLI}, nil) +if err != nil { + // handle error +} + +client := armresources.NewResourceGroupsClient("subscription ID", chain, nil) +``` + +## Credential Types + +### Authenticating Azure Hosted Applications + +|Credential|Usage +|-|- +|[DefaultAzureCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#DefaultAzureCredential)|Simplified authentication experience for getting started developing Azure apps +|[ChainedTokenCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ChainedTokenCredential)|Define custom authentication flows, composing multiple credentials +|[EnvironmentCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#EnvironmentCredential)|Authenticate a service principal or user configured by environment variables +|[ManagedIdentityCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ManagedIdentityCredential)|Authenticate the managed identity of an Azure resource + +### Authenticating Service Principals + +|Credential|Usage +|-|- +|[ClientSecretCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ClientSecretCredential)|Authenticate a service principal with a secret +|[ClientCertificateCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#ClientCertificateCredential)|Authenticate a service principal with a certificate + +### Authenticating Users + +|Credential|Usage +|-|- +|[InteractiveBrowserCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#InteractiveBrowserCredential)|Interactively authenticate a user with the default web browser +|[DeviceCodeCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#DeviceCodeCredential)|Interactively authenticate a user on a device with limited UI +|[UsernamePasswordCredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#UsernamePasswordCredential)|Authenticate a user with a username and password + +### Authenticating via Development Tools + +|Credential|Usage +|-|- +|[AzureCLICredential](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#AzureCLICredential)|Authenticate as the user signed in to the Azure CLI + +## Environment Variables + +`DefaultAzureCredential` and `EnvironmentCredential` can be configured with environment variables. Each type of authentication requires values for specific variables: + +#### Service principal with secret + +|variable name|value +|-|- +|`AZURE_CLIENT_ID`|ID of an Azure Active Directory application +|`AZURE_TENANT_ID`|ID of the application's Azure Active Directory tenant +|`AZURE_CLIENT_SECRET`|one of the application's client secrets + +#### Service principal with certificate + +|variable name|value +|-|- +|`AZURE_CLIENT_ID`|ID of an Azure Active Directory application +|`AZURE_TENANT_ID`|ID of the application's Azure Active Directory tenant +|`AZURE_CLIENT_CERTIFICATE_PATH`|path to a certificate file including private key (without password protection) + +#### Username and password + +|variable name|value +|-|- +|`AZURE_CLIENT_ID`|ID of an Azure Active Directory application +|`AZURE_USERNAME`|a username (usually an email address) +|`AZURE_PASSWORD`|that user's password + +Configuration is attempted in the above order. For example, if values for a +client secret and certificate are both present, the client secret will be used. + +## Troubleshooting + +### Error Handling + +Credentials return an `error` when they fail to authenticate or lack data they require to authenticate. For guidance on resolving errors from specific credential types, see the [troubleshooting guide](https://aka.ms/azsdk/go/identity/troubleshoot). + +For more details on handling specific Azure Active Directory errors please refer to the +Azure Active Directory +[error code documentation](https://docs.microsoft.com/azure/active-directory/develop/reference-aadsts-error-codes). + +### Logging + +This module uses the classification-based logging implementation in `azcore`. To enable console logging for all SDK modules, set `AZURE_SDK_GO_LOGGING` to `all`. Use the `azcore/log` package to control log event output or to enable logs for `azidentity` only. For example: +```go +import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log" + +// print log output to stdout +azlog.SetListener(func(event azlog.Event, s string) { + fmt.Println(s) +}) + +// include only azidentity credential logs +azlog.SetEvents(azidentity.EventAuthentication) +``` + +Credentials log basic information only, such as `GetToken` success or failure and errors. These log entries don't contain authentication secrets but may contain sensitive information. + +## Next steps + +Client and management modules listed on the [Azure SDK releases page](https://azure.github.io/azure-sdk/releases/latest/go.html) support authenticating with `azidentity` credential types. You can learn more about using these libraries in their documentation, which is linked from the release page. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues). + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-go%2Fsdk%2Fazidentity%2FREADME.png) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md new file mode 100644 index 000000000..1e28d181f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md @@ -0,0 +1,192 @@ +# Troubleshoot Azure Identity authentication issues + +This troubleshooting guide covers failure investigation techniques, common errors for the credential types in the `azidentity` module, and mitigation steps to resolve these errors. + +## Table of contents + +- [Handle azidentity errors](#handle-azidentity-errors) + - [Permission issues](#permission-issues) +- [Find relevant information in errors](#find-relevant-information-in-errors) +- [Enable and configure logging](#enable-and-configure-logging) +- [Troubleshoot DefaultAzureCredential authentication issues](#troubleshoot-defaultazurecredential-authentication-issues) +- [Troubleshoot EnvironmentCredential authentication issues](#troubleshoot-environmentcredential-authentication-issues) +- [Troubleshoot ClientSecretCredential authentication issues](#troubleshoot-clientsecretcredential-authentication-issues) +- [Troubleshoot ClientCertificateCredential authentication issues](#troubleshoot-clientcertificatecredential-authentication-issues) +- [Troubleshoot UsernamePasswordCredential authentication issues](#troubleshoot-usernamepasswordcredential-authentication-issues) +- [Troubleshoot ManagedIdentityCredential authentication issues](#troubleshoot-managedidentitycredential-authentication-issues) + - [Azure Virtual Machine managed identity](#azure-virtual-machine-managed-identity) + - [Azure App Service and Azure Functions managed identity](#azure-app-service-and-azure-functions-managed-identity) + - [Azure Kubernetes Service managed identity](#azure-kubernetes-service-managed-identity) +- [Troubleshoot AzureCliCredential authentication issues](#troubleshoot-azureclicredential-authentication-issues) +- [Get additional help](#get-additional-help) + +## Handle azidentity errors + +Any service client method that makes a request to the service may return an error due to authentication failure. This is because the credential authenticates on the first call to the service and on any subsequent call that needs to refresh an access token. Authentication errors include a description of the failure and possibly an error message from Azure Active Directory (Azure AD). Depending on the application, these errors may or may not be recoverable. + +### Permission issues + +Service client errors with a status code of 401 or 403 often indicate that authentication succeeded but the caller doesn't have permission to access the specified API. Check the service documentation to determine which RBAC roles are needed for the request, and ensure the authenticated user or service principal has the appropriate role assignments. + +## Find relevant information in errors + +Authentication errors can include responses from Azure AD and often contain information helpful in diagnosis. Consider the following error message: + +``` +ClientSecretCredential authentication failed +POST https://login.microsoftonline.com/3c631bb7-a9f7-4343-a5ba-a615913/oauth2/v2.0/token +-------------------------------------------------------------------------------- +RESPONSE 401 Unauthorized +-------------------------------------------------------------------------------- +{ + "error": "invalid_client", + "error_description": "AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '86be4c01-505b-45e9-bfc0-9b825fd84'.\r\nTrace ID: 03da4b8e-5ffe-48ca-9754-aff4276f0100\r\nCorrelation ID: 7b12f9bb-2eef-42e3-ad75-eee69ec9088d\r\nTimestamp: 2022-03-02 18:25:26Z", + "error_codes": [ + 7000215 + ], + "timestamp": "2022-03-02 18:25:26Z", + "trace_id": "03da4b8e-5ffe-48ca-9754-aff4276f0100", + "correlation_id": "7b12f9bb-2eef-42e3-ad75-eee69ec9088d", + "error_uri": "https://login.microsoftonline.com/error?code=7000215" +} +-------------------------------------------------------------------------------- +``` + +This error contains several pieces of information: + +- __Failing Credential Type__: The type of credential that failed to authenticate. This can be helpful when diagnosing issues with chained credential types such as `DefaultAzureCredential` or `ChainedTokenCredential`. + +- __Azure AD Error Code and Message__: The error code and message returned by Azure AD. This can give insight into the specific reason the request failed. For instance, in this case authentication failed because the provided client secret is incorrect. [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/reference-aadsts-error-codes#aadsts-error-codes) has more information on AADSTS error codes. + +- __Correlation ID and Timestamp__: The correlation ID and timestamp identify the request in server-side logs. This information can be useful to support engineers diagnosing unexpected Azure AD failures. + +### Enable and configure logging + +`azidentity` provides the same logging capabilities as the rest of the Azure SDK. The simplest way to see the logs to help debug authentication issues is to print credential logs to the console. +```go +import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log" + +// print log output to stdout +azlog.SetListener(func(event azlog.Event, s string) { + fmt.Println(s) +}) + +// include only azidentity credential logs +azlog.SetEvents(azidentity.EventAuthentication) +``` + +## Troubleshoot DefaultAzureCredential authentication issues + +| Error |Description| Mitigation | +|---|---|---| +|"DefaultAzureCredential failed to acquire a token"|No credential in the `DefaultAzureCredential` chain provided a token|
  • [Enable logging](#enable-and-configure-logging) to get further diagnostic information.
  • Consult the troubleshooting guide for underlying credential types for more information.
    • [EnvironmentCredential](#troubleshoot-environmentcredential-authentication-issues)
    • [ManagedIdentityCredential](#troubleshoot-visualstudiocredential-authentication-issues)
    • [AzureCLICredential](#troubleshoot-azureclicredential-authentication-issues)
    | +|Error from the client with a status code of 401 or 403|Authentication succeeded but the authorizing Azure service responded with a 401 (Unauthorized), or 403 (Forbidden) status code|
    • [Enable logging](#enable-and-configure-logging) to determine which credential in the chain returned the authenticating token.
    • If an unexpected credential is returning a token, check application configuration such as environment variables.
    • Ensure the correct role is assigned to the authenticated identity. For example, a service specific role rather than the subscription Owner role.
    | + +## Troubleshoot EnvironmentCredential authentication issues + +| Error Message |Description| Mitigation | +|---|---|---| +|Missing or incomplete environment variable configuration|A valid combination of environment variables wasn't set|Ensure the appropriate environment variables are set for the intended authentication method as described in the [module documentation](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#EnvironmentCredential)| + +## Troubleshoot ClientSecretCredential authentication issues + +| Error Code | Issue | Mitigation | +|---|---|---| +|AADSTS7000215|An invalid client secret was provided.|Ensure the secret provided to the credential constructor is valid. If unsure, create a new client secret using the Azure portal. Details on creating a new client secret are in [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#option-2-create-a-new-application-secret).| +|AADSTS7000222|An expired client secret was provided.|Create a new client secret using the Azure portal. Details on creating a new client secret are in [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#option-2-create-a-new-application-secret).| +|AADSTS700016|The specified application wasn't found in the specified tenant.|Ensure the client and tenant IDs provided to the credential constructor are correct for your application registration. For multi-tenant apps, ensure the application has been added to the desired tenant by a tenant admin. To add a new application in the desired tenant, follow the [Azure AD instructions](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).| + +## Troubleshoot ClientCertificateCredential authentication issues + +| Error Code | Description | Mitigation | +|---|---|---| +|AADSTS700027|Client assertion contains an invalid signature.|Ensure the specified certificate has been uploaded to the application registration as described in [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#option-1-upload-a-certificate).| +|AADSTS700016|The specified application wasn't found in the specified tenant.|Ensure the client and tenant IDs provided to the credential constructor are correct for your application registration. For multi-tenant apps, ensure the application has been added to the desired tenant by a tenant admin. To add a new application in the desired tenant, follow the [Azure AD instructions](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).| + +## Troubleshoot UsernamePasswordCredential authentication issues + +| Error Code | Issue | Mitigation | +|---|---|---| +|AADSTS50126|The provided username or password is invalid.|Ensure the username and password provided to the credential constructor are valid.| + +## Troubleshoot ManagedIdentityCredential authentication issues + +`ManagedIdentityCredential` is designed to work on a variety of Azure hosts support managed identity. Configuration and troubleshooting vary from host to host. The below table lists the Azure hosts that can be assigned a managed identity and are supported by `ManagedIdentityCredential`. + +|Host Environment| | | +|---|---|---| +|Azure Virtual Machines and Scale Sets|[Configuration](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm)|[Troubleshooting](#azure-virtual-machine-managed-identity)| +|Azure App Service and Azure Functions|[Configuration](https://docs.microsoft.com/azure/app-service/overview-managed-identity)|[Troubleshooting](#azure-app-service-and-azure-functions-managed-identity)| +|Azure Kubernetes Service|[Configuration](https://azure.github.io/aad-pod-identity/docs/)|[Troubleshooting](#azure-kubernetes-service-managed-identity)| +|Azure Arc|[Configuration](https://docs.microsoft.com/azure/azure-arc/servers/managed-identity-authentication)|| +|Azure Service Fabric|[Configuration](https://docs.microsoft.com/azure/service-fabric/concepts-managed-identity)|| + +### Azure Virtual Machine managed identity + +| Error Message |Description| Mitigation | +|---|---|---| +|The requested identity hasn’t been assigned to this resource.|The IMDS endpoint responded with a status code of 400, indicating the requested identity isn’t assigned to the VM.|If using a user assigned identity, ensure the specified ID is correct.

    If using a system assigned identity, make sure it has been enabled as described in [managed identity documentation](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm#enable-system-assigned-managed-identity-on-an-existing-vm).| +|The request failed due to a gateway error.|The request to the IMDS endpoint failed due to a gateway error, 502 or 504 status code.|IMDS doesn't support requests via proxy or gateway. Disable proxies or gateways running on the VM for requests to the IMDS endpoint `http://169.254.169.254`| +|No response received from the managed identity endpoint.|No response was received for the request to IMDS or the request timed out.|

    • Ensure the VM is configured for managed identity as described in [managed identity documentation](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm).
    • Verify the IMDS endpoint is reachable on the VM. See [below](#verify-imds-is-available-on-the-vm) for instructions.
    | +|Multiple attempts failed to obtain a token from the managed identity endpoint.|The credential has exhausted its retries for a token request.|
    • Refer to the error message for more details on specific failures.
    • Ensure the VM is configured for managed identity as described in [managed identity documentation](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm).
    • Verify the IMDS endpoint is reachable on the VM. See [below](#verify-imds-is-available-on-the-vm) for instructions.
    | + +#### Verify IMDS is available on the VM + +If you have access to the VM, you can use `curl` to verify the managed identity endpoint is available. + +```sh +curl 'http://169.254.169.254/metadata/identity/oauth2/token?resource=https://management.core.windows.net&api-version=2018-02-01' -H "Metadata: true" +``` + +> This command's output will contain an access token and SHOULD NOT BE SHARED, to avoid compromising account security. + +### Azure App Service and Azure Functions managed identity + +| Error Message |Description| Mitigation | +|---|---|---| +|Get "`http://169.254.169.254/...`" i/o timeout|The App Service host hasn't set environment variables for managed identity configuration.|
    • Ensure the App Service is configured for managed identity as described in [App Service documentation](https://docs.microsoft.com/azure/app-service/overview-managed-identity).
    • Verify the App Service environment is properly configured and the managed identity endpoint is available. See [below](#verify-the-app-service-managed-identity-endpoint-is-available) for instructions.
    | + +#### Verify the App Service managed identity endpoint is available + +If you can SSH into the App Service, you can verify managed identity is available in the environment. First ensure the environment variables `IDENTITY_ENDPOINT` and `IDENTITY_SECRET` are set. Then you can verify the managed identity endpoint is available using `curl`. + +```sh +curl "$IDENTITY_ENDPOINT?resource=https://management.core.windows.net&api-version=2019-08-01" -H "X-IDENTITY-HEADER: $IDENTITY_HEADER" +``` + +> This command's output will contain an access token and SHOULD NOT BE SHARED, to avoid compromising account security. + +### Azure Kubernetes Service managed identity + +#### Pod Identity + +| Error Message |Description| Mitigation | +|---|---|---| +|"no azure identity found for request clientID"|The application attempted to authenticate before an identity was assigned to its pod|Verify the pod is labeled correctly. This also occurs when a correctly labeled pod authenticates before the identity is ready. To prevent initialization races, configure NMI to set the Retry-After header in its responses as described in [Pod Identity documentation](https://azure.github.io/aad-pod-identity/docs/configure/feature_flags/#set-retry-after-header-in-nmi-response). + +## Troubleshoot AzureCliCredential authentication issues + +| Error Message |Description| Mitigation | +|---|---|---| +|Azure CLI not found on path|The Azure CLI isn’t installed or isn't on the application's path.|
    • Ensure the Azure CLI is installed as described in [Azure CLI documentation](https://docs.microsoft.com/cli/azure/install-azure-cli).
    • Validate the installation location is in the application's `PATH` environment variable.
    | +|Please run 'az login' to set up account|No account is currently logged into the Azure CLI, or the login has expired.|
    • Run `az login` to log into the Azure CLI. More information about Azure CLI authentication is available in the [Azure CLI documentation](https://docs.microsoft.com/cli/azure/authenticate-azure-cli).
    • Verify that the Azure CLI can obtain tokens. See [below](#verify-the-azure-cli-can-obtain-tokens) for instructions.
    | + +#### Verify the Azure CLI can obtain tokens + +You can manually verify that the Azure CLI can authenticate and obtain tokens. First, use the `account` command to verify the logged in account. + +```azurecli +az account show +``` + +Once you've verified the Azure CLI is using the correct account, you can validate that it's able to obtain tokens for that account. + +```azurecli +az account get-access-token --output json --resource https://management.core.windows.net +``` + +> This command's output will contain an access token and SHOULD NOT BE SHARED, to avoid compromising account security. + +## Get additional help + +Additional information on ways to reach out for support can be found in [SUPPORT.md](https://github.com/Azure/azure-sdk-for-go/blob/main/SUPPORT.md). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azidentity.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azidentity.go new file mode 100644 index 000000000..0faee55ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azidentity.go @@ -0,0 +1,129 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "bytes" + "context" + "errors" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "regexp" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" +) + +const ( + azureAuthorityHost = "AZURE_AUTHORITY_HOST" + azureClientID = "AZURE_CLIENT_ID" + azureRegionalAuthorityName = "AZURE_REGIONAL_AUTHORITY_NAME" + + organizationsTenantID = "organizations" + developerSignOnClientID = "04b07795-8ddb-461a-bbee-02f9e1bf7b46" + defaultSuffix = "/.default" + tenantIDValidationErr = "invalid tenantID. You can locate your tenantID by following the instructions listed here: https://docs.microsoft.com/partner-center/find-ids-and-domain-names" +) + +// setAuthorityHost initializes the authority host for credentials. Precedence is: +// 1. cloud.Configuration.ActiveDirectoryAuthorityHost value set by user +// 2. value of AZURE_AUTHORITY_HOST +// 3. default: Azure Public Cloud +func setAuthorityHost(cc cloud.Configuration) (string, error) { + host := cc.ActiveDirectoryAuthorityHost + if host == "" { + if len(cc.Services) > 0 { + return "", errors.New("missing ActiveDirectoryAuthorityHost for specified cloud") + } + host = cloud.AzurePublic.ActiveDirectoryAuthorityHost + if envAuthorityHost := os.Getenv(azureAuthorityHost); envAuthorityHost != "" { + host = envAuthorityHost + } + } + u, err := url.Parse(host) + if err != nil { + return "", err + } + if u.Scheme != "https" { + return "", errors.New("cannot use an authority host without https") + } + return host, nil +} + +// validTenantID return true is it receives a valid tenantID, returns false otherwise +func validTenantID(tenantID string) bool { + match, err := regexp.MatchString("^[0-9a-zA-Z-.]+$", tenantID) + if err != nil { + return false + } + return match +} + +func newPipelineAdapter(opts *azcore.ClientOptions) pipelineAdapter { + pl := runtime.NewPipeline(component, version, runtime.PipelineOptions{}, opts) + return pipelineAdapter{pl: pl} +} + +type pipelineAdapter struct { + pl runtime.Pipeline +} + +func (p pipelineAdapter) CloseIdleConnections() { + // do nothing +} + +func (p pipelineAdapter) Do(r *http.Request) (*http.Response, error) { + req, err := runtime.NewRequest(r.Context(), r.Method, r.URL.String()) + if err != nil { + return nil, err + } + if r.Body != nil && r.Body != http.NoBody { + // create a rewindable body from the existing body as required + var body io.ReadSeekCloser + if rsc, ok := r.Body.(io.ReadSeekCloser); ok { + body = rsc + } else { + b, err := ioutil.ReadAll(r.Body) + if err != nil { + return nil, err + } + body = streaming.NopCloser(bytes.NewReader(b)) + } + err = req.SetBody(body, r.Header.Get("Content-Type")) + if err != nil { + return nil, err + } + } + resp, err := p.pl.Do(req) + if err != nil { + return nil, err + } + return resp, err +} + +// enables fakes for test scenarios +type confidentialClient interface { + AcquireTokenSilent(ctx context.Context, scopes []string, options ...confidential.AcquireTokenSilentOption) (confidential.AuthResult, error) + AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, options ...confidential.AcquireTokenByAuthCodeOption) (confidential.AuthResult, error) + AcquireTokenByCredential(ctx context.Context, scopes []string) (confidential.AuthResult, error) +} + +// enables fakes for test scenarios +type publicClient interface { + AcquireTokenSilent(ctx context.Context, scopes []string, options ...public.AcquireTokenSilentOption) (public.AuthResult, error) + AcquireTokenByUsernamePassword(ctx context.Context, scopes []string, username string, password string) (public.AuthResult, error) + AcquireTokenByDeviceCode(ctx context.Context, scopes []string) (public.DeviceCode, error) + AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, options ...public.AcquireTokenByAuthCodeOption) (public.AuthResult, error) + AcquireTokenInteractive(ctx context.Context, scopes []string, options ...public.InteractiveAuthOption) (public.AuthResult, error) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azure_cli_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azure_cli_credential.go new file mode 100644 index 000000000..68f46d51a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/azure_cli_credential.go @@ -0,0 +1,189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "os" + "os/exec" + "regexp" + "runtime" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +const credNameAzureCLI = "AzureCLICredential" + +// used by tests to fake invoking the CLI +type azureCLITokenProvider func(ctx context.Context, resource string, tenantID string) ([]byte, error) + +// AzureCLICredentialOptions contains optional parameters for AzureCLICredential. +type AzureCLICredentialOptions struct { + // TenantID identifies the tenant the credential should authenticate in. + // Defaults to the CLI's default tenant, which is typically the home tenant of the logged in user. + TenantID string + + tokenProvider azureCLITokenProvider +} + +// init returns an instance of AzureCLICredentialOptions initialized with default values. +func (o *AzureCLICredentialOptions) init() { + if o.tokenProvider == nil { + o.tokenProvider = defaultTokenProvider() + } +} + +// AzureCLICredential authenticates as the identity logged in to the Azure CLI. +type AzureCLICredential struct { + tokenProvider azureCLITokenProvider + tenantID string +} + +// NewAzureCLICredential constructs an AzureCLICredential. Pass nil to accept default options. +func NewAzureCLICredential(options *AzureCLICredentialOptions) (*AzureCLICredential, error) { + cp := AzureCLICredentialOptions{} + if options != nil { + cp = *options + } + cp.init() + return &AzureCLICredential{ + tokenProvider: cp.tokenProvider, + tenantID: cp.TenantID, + }, nil +} + +// GetToken requests a token from the Azure CLI. This credential doesn't cache tokens, so every call invokes the CLI. +// This method is called automatically by Azure SDK clients. +func (c *AzureCLICredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) != 1 { + return azcore.AccessToken{}, errors.New(credNameAzureCLI + ": GetToken() requires exactly one scope") + } + // CLI expects an AAD v1 resource, not a v2 scope + scope := strings.TrimSuffix(opts.Scopes[0], defaultSuffix) + at, err := c.authenticate(ctx, scope) + if err != nil { + return azcore.AccessToken{}, err + } + logGetTokenSuccess(c, opts) + return at, nil +} + +const timeoutCLIRequest = 10 * time.Second + +func (c *AzureCLICredential) authenticate(ctx context.Context, resource string) (azcore.AccessToken, error) { + output, err := c.tokenProvider(ctx, resource, c.tenantID) + if err != nil { + return azcore.AccessToken{}, err + } + + return c.createAccessToken(output) +} + +func defaultTokenProvider() func(ctx context.Context, resource string, tenantID string) ([]byte, error) { + return func(ctx context.Context, resource string, tenantID string) ([]byte, error) { + match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", resource) + if err != nil { + return nil, err + } + if !match { + return nil, fmt.Errorf(`%s: unexpected scope "%s". Only alphanumeric characters and ".", ";", "-", and "/" are allowed`, credNameAzureCLI, resource) + } + + ctx, cancel := context.WithTimeout(ctx, timeoutCLIRequest) + defer cancel() + + commandLine := "az account get-access-token -o json --resource " + resource + if tenantID != "" { + commandLine += " --tenant " + tenantID + } + var cliCmd *exec.Cmd + if runtime.GOOS == "windows" { + dir := os.Getenv("SYSTEMROOT") + if dir == "" { + return nil, newCredentialUnavailableError(credNameAzureCLI, "environment variable 'SYSTEMROOT' has no value") + } + cliCmd = exec.CommandContext(ctx, "cmd.exe", "/c", commandLine) + cliCmd.Dir = dir + } else { + cliCmd = exec.CommandContext(ctx, "/bin/sh", "-c", commandLine) + cliCmd.Dir = "/bin" + } + cliCmd.Env = os.Environ() + var stderr bytes.Buffer + cliCmd.Stderr = &stderr + + output, err := cliCmd.Output() + if err != nil { + msg := stderr.String() + var exErr *exec.ExitError + if errors.As(err, &exErr) && exErr.ExitCode() == 127 || strings.HasPrefix(msg, "'az' is not recognized") { + msg = "Azure CLI not found on path" + } + if msg == "" { + msg = err.Error() + } + return nil, newCredentialUnavailableError(credNameAzureCLI, msg) + } + + return output, nil + } +} + +func (c *AzureCLICredential) createAccessToken(tk []byte) (azcore.AccessToken, error) { + t := struct { + AccessToken string `json:"accessToken"` + Authority string `json:"_authority"` + ClientID string `json:"_clientId"` + ExpiresOn string `json:"expiresOn"` + IdentityProvider string `json:"identityProvider"` + IsMRRT bool `json:"isMRRT"` + RefreshToken string `json:"refreshToken"` + Resource string `json:"resource"` + TokenType string `json:"tokenType"` + UserID string `json:"userId"` + }{} + err := json.Unmarshal(tk, &t) + if err != nil { + return azcore.AccessToken{}, err + } + + tokenExpirationDate, err := parseExpirationDate(t.ExpiresOn) + if err != nil { + return azcore.AccessToken{}, fmt.Errorf("Error parsing Token Expiration Date %q: %+v", t.ExpiresOn, err) + } + + converted := azcore.AccessToken{ + Token: t.AccessToken, + ExpiresOn: *tokenExpirationDate, + } + return converted, nil +} + +// parseExpirationDate parses either a Azure CLI or CloudShell date into a time object +func parseExpirationDate(input string) (*time.Time, error) { + // CloudShell (and potentially the Azure CLI in future) + expirationDate, cloudShellErr := time.Parse(time.RFC3339, input) + if cloudShellErr != nil { + // Azure CLI (Python) e.g. 2017-08-31 19:48:57.998857 (plus the local timezone) + const cliFormat = "2006-01-02 15:04:05.999999" + expirationDate, cliErr := time.ParseInLocation(cliFormat, input, time.Local) + if cliErr != nil { + return nil, fmt.Errorf("Error parsing expiration date %q.\n\nCloudShell Error: \n%+v\n\nCLI Error:\n%+v", input, cloudShellErr, cliErr) + } + return &expirationDate, nil + } + return &expirationDate, nil +} + +var _ azcore.TokenCredential = (*AzureCLICredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/chained_token_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/chained_token_credential.go new file mode 100644 index 000000000..86a890645 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/chained_token_credential.go @@ -0,0 +1,133 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +// ChainedTokenCredentialOptions contains optional parameters for ChainedTokenCredential. +type ChainedTokenCredentialOptions struct { + // RetrySources configures how the credential uses its sources. When true, the credential always attempts to + // authenticate through each source in turn, stopping when one succeeds. When false, the credential authenticates + // only through this first successful source--it never again tries the sources which failed. + RetrySources bool +} + +// ChainedTokenCredential links together multiple credentials and tries them sequentially when authenticating. By default, +// it tries all the credentials until one authenticates, after which it always uses that credential. +type ChainedTokenCredential struct { + cond *sync.Cond + iterating bool + name string + retrySources bool + sources []azcore.TokenCredential + successfulCredential azcore.TokenCredential +} + +// NewChainedTokenCredential creates a ChainedTokenCredential. Pass nil for options to accept defaults. +func NewChainedTokenCredential(sources []azcore.TokenCredential, options *ChainedTokenCredentialOptions) (*ChainedTokenCredential, error) { + if len(sources) == 0 { + return nil, errors.New("sources must contain at least one TokenCredential") + } + for _, source := range sources { + if source == nil { // cannot have a nil credential in the chain or else the application will panic when GetToken() is called on nil + return nil, errors.New("sources cannot contain nil") + } + } + cp := make([]azcore.TokenCredential, len(sources)) + copy(cp, sources) + if options == nil { + options = &ChainedTokenCredentialOptions{} + } + return &ChainedTokenCredential{ + cond: sync.NewCond(&sync.Mutex{}), + name: "ChainedTokenCredential", + retrySources: options.RetrySources, + sources: cp, + }, nil +} + +// GetToken calls GetToken on the chained credentials in turn, stopping when one returns a token. +// This method is called automatically by Azure SDK clients. +func (c *ChainedTokenCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if !c.retrySources { + // ensure only one goroutine at a time iterates the sources and perhaps sets c.successfulCredential + c.cond.L.Lock() + for { + if c.successfulCredential != nil { + c.cond.L.Unlock() + return c.successfulCredential.GetToken(ctx, opts) + } + if !c.iterating { + c.iterating = true + // allow other goroutines to wait while this one iterates + c.cond.L.Unlock() + break + } + c.cond.Wait() + } + } + + var err error + var errs []error + var token azcore.AccessToken + var successfulCredential azcore.TokenCredential + for _, cred := range c.sources { + token, err = cred.GetToken(ctx, opts) + if err == nil { + log.Writef(EventAuthentication, "%s authenticated with %s", c.name, extractCredentialName(cred)) + successfulCredential = cred + break + } + errs = append(errs, err) + if _, ok := err.(*credentialUnavailableError); !ok { + break + } + } + if c.iterating { + c.cond.L.Lock() + c.successfulCredential = successfulCredential + c.iterating = false + c.cond.L.Unlock() + c.cond.Broadcast() + } + // err is the error returned by the last GetToken call. It will be nil when that call succeeds + if err != nil { + // return credentialUnavailableError iff all sources did so; return AuthenticationFailedError otherwise + msg := createChainedErrorMessage(errs) + if _, ok := err.(*credentialUnavailableError); ok { + err = newCredentialUnavailableError(c.name, msg) + } else { + res := getResponseFromError(err) + err = newAuthenticationFailedError(c.name, msg, res) + } + } + return token, err +} + +func createChainedErrorMessage(errs []error) string { + msg := "failed to acquire a token.\nAttempted credentials:" + for _, err := range errs { + msg += fmt.Sprintf("\n\t%s", err.Error()) + } + return msg +} + +func extractCredentialName(credential azcore.TokenCredential) string { + return strings.TrimPrefix(fmt.Sprintf("%T", credential), "*azidentity.") +} + +var _ azcore.TokenCredential = (*ChainedTokenCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/ci.yml new file mode 100644 index 000000000..3b443e8ee --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azidentity/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azidentity/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + RunLiveTests: true + ServiceDirectory: 'azidentity' + PreSteps: + - pwsh: | + [System.Convert]::FromBase64String($env:PFX_CONTENTS) | Set-Content -Path $(Agent.TempDirectory)/test.pfx -AsByteStream + Set-Content -Path $(Agent.TempDirectory)/test.pem -Value $env:PEM_CONTENTS + [System.Convert]::FromBase64String($env:SNI_CONTENTS) | Set-Content -Path $(Agent.TempDirectory)/testsni.pfx -AsByteStream + env: + PFX_CONTENTS: $(net-identity-spcert-pfx) + PEM_CONTENTS: $(net-identity-spcert-pem) + SNI_CONTENTS: $(net-identity-spcert-sni) + EnvVars: + AZURE_IDENTITY_TEST_TENANTID: $(net-identity-tenantid) + AZURE_IDENTITY_TEST_USERNAME: $(net-identity-username) + AZURE_IDENTITY_TEST_PASSWORD: $(net-identity-password) + IDENTITY_SP_TENANT_ID: $(net-identity-sp-tenantid) + IDENTITY_SP_CLIENT_ID: $(net-identity-sp-clientid) + IDENTITY_SP_CLIENT_SECRET: $(net-identity-sp-clientsecret) + IDENTITY_SP_CERT_PEM: $(Agent.TempDirectory)/test.pem + IDENTITY_SP_CERT_PFX: $(Agent.TempDirectory)/test.pfx + IDENTITY_SP_CERT_SNI: $(Agent.TempDirectory)/testsni.pfx diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_certificate_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_certificate_credential.go new file mode 100644 index 000000000..e50157b10 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_certificate_credential.go @@ -0,0 +1,217 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "crypto" + "crypto/rsa" + "crypto/sha1" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "errors" + "os" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential" + "golang.org/x/crypto/pkcs12" +) + +const credNameCert = "ClientCertificateCredential" + +// ClientCertificateCredentialOptions contains optional parameters for ClientCertificateCredential. +type ClientCertificateCredentialOptions struct { + azcore.ClientOptions + + // SendCertificateChain controls whether the credential sends the public certificate chain in the x5c + // header of each token request's JWT. This is required for Subject Name/Issuer (SNI) authentication. + // Defaults to False. + SendCertificateChain bool +} + +// ClientCertificateCredential authenticates a service principal with a certificate. +type ClientCertificateCredential struct { + client confidentialClient +} + +// NewClientCertificateCredential constructs a ClientCertificateCredential. Pass nil for options to accept defaults. +func NewClientCertificateCredential(tenantID string, clientID string, certs []*x509.Certificate, key crypto.PrivateKey, options *ClientCertificateCredentialOptions) (*ClientCertificateCredential, error) { + if len(certs) == 0 { + return nil, errors.New("at least one certificate is required") + } + pk, ok := key.(*rsa.PrivateKey) + if !ok { + return nil, errors.New("'key' must be an *rsa.PrivateKey") + } + if !validTenantID(tenantID) { + return nil, errors.New(tenantIDValidationErr) + } + if options == nil { + options = &ClientCertificateCredentialOptions{} + } + authorityHost, err := setAuthorityHost(options.Cloud) + if err != nil { + return nil, err + } + cert, err := newCertContents(certs, pk, options.SendCertificateChain) + if err != nil { + return nil, err + } + cred := confidential.NewCredFromCert(cert.c, key) // TODO: NewCredFromCert should take a slice + if err != nil { + return nil, err + } + o := []confidential.Option{ + confidential.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)), + confidential.WithHTTPClient(newPipelineAdapter(&options.ClientOptions)), + confidential.WithAzureRegion(os.Getenv(azureRegionalAuthorityName)), + } + if options.SendCertificateChain { + o = append(o, confidential.WithX5C()) + } + c, err := confidential.New(clientID, cred, o...) + if err != nil { + return nil, err + } + return &ClientCertificateCredential{client: c}, nil +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *ClientCertificateCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) == 0 { + return azcore.AccessToken{}, errors.New(credNameCert + ": GetToken() requires at least one scope") + } + ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes) + if err == nil { + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + } + + ar, err = c.client.AcquireTokenByCredential(ctx, opts.Scopes) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameCert, err) + } + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +// ParseCertificates loads certificates and a private key, in PEM or PKCS12 format, for use with NewClientCertificateCredential. +// Pass nil for password if the private key isn't encrypted. This function can't decrypt keys in PEM format. +func ParseCertificates(certData []byte, password []byte) ([]*x509.Certificate, crypto.PrivateKey, error) { + var blocks []*pem.Block + var err error + if len(password) == 0 { + blocks, err = loadPEMCert(certData) + } + if len(blocks) == 0 || err != nil { + blocks, err = loadPKCS12Cert(certData, string(password)) + } + if err != nil { + return nil, nil, err + } + var certs []*x509.Certificate + var pk crypto.PrivateKey + for _, block := range blocks { + switch block.Type { + case "CERTIFICATE": + c, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return nil, nil, err + } + certs = append(certs, c) + case "PRIVATE KEY": + if pk != nil { + return nil, nil, errors.New("certData contains multiple private keys") + } + pk, err = x509.ParsePKCS8PrivateKey(block.Bytes) + if err != nil { + pk, err = x509.ParsePKCS1PrivateKey(block.Bytes) + } + if err != nil { + return nil, nil, err + } + case "RSA PRIVATE KEY": + if pk != nil { + return nil, nil, errors.New("certData contains multiple private keys") + } + pk, err = x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + return nil, nil, err + } + } + } + if len(certs) == 0 { + return nil, nil, errors.New("found no certificate") + } + if pk == nil { + return nil, nil, errors.New("found no private key") + } + return certs, pk, nil +} + +type certContents struct { + c *x509.Certificate // the signing cert + fp []byte // the signing cert's fingerprint, a SHA-1 digest + pk *rsa.PrivateKey // the signing key + x5c []string // concatenation of every provided cert, base64 encoded +} + +func newCertContents(certs []*x509.Certificate, key *rsa.PrivateKey, sendCertificateChain bool) (*certContents, error) { + cc := certContents{pk: key} + // need the the signing cert's fingerprint: identify that cert by matching its public key to the private key + for _, cert := range certs { + certKey, ok := cert.PublicKey.(*rsa.PublicKey) + if ok && key.E == certKey.E && key.N.Cmp(certKey.N) == 0 { + fp := sha1.Sum(cert.Raw) + cc.fp = fp[:] + cc.c = cert + if sendCertificateChain { + // signing cert must be first in x5c + cc.x5c = append([]string{base64.StdEncoding.EncodeToString(cert.Raw)}, cc.x5c...) + } + } else if sendCertificateChain { + cc.x5c = append(cc.x5c, base64.StdEncoding.EncodeToString(cert.Raw)) + } + } + if len(cc.fp) == 0 || cc.c == nil { + return nil, errors.New("found no certificate matching 'key'") + } + return &cc, nil +} + +func loadPEMCert(certData []byte) ([]*pem.Block, error) { + blocks := []*pem.Block{} + for { + var block *pem.Block + block, certData = pem.Decode(certData) + if block == nil { + break + } + blocks = append(blocks, block) + } + if len(blocks) == 0 { + return nil, errors.New("didn't find any PEM blocks") + } + return blocks, nil +} + +func loadPKCS12Cert(certData []byte, password string) ([]*pem.Block, error) { + blocks, err := pkcs12.ToPEM(certData, password) + if err != nil { + return nil, err + } + if len(blocks) == 0 { + // not mentioning PKCS12 in this message because we end up here when certData is garbage + return nil, errors.New("didn't find any certificate content") + } + return blocks, err +} + +var _ azcore.TokenCredential = (*ClientCertificateCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_secret_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_secret_credential.go new file mode 100644 index 000000000..6ecb8f4db --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/client_secret_credential.go @@ -0,0 +1,78 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "os" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential" +) + +const credNameSecret = "ClientSecretCredential" + +// ClientSecretCredentialOptions contains optional parameters for ClientSecretCredential. +type ClientSecretCredentialOptions struct { + azcore.ClientOptions +} + +// ClientSecretCredential authenticates an application with a client secret. +type ClientSecretCredential struct { + client confidentialClient +} + +// NewClientSecretCredential constructs a ClientSecretCredential. Pass nil for options to accept defaults. +func NewClientSecretCredential(tenantID string, clientID string, clientSecret string, options *ClientSecretCredentialOptions) (*ClientSecretCredential, error) { + if !validTenantID(tenantID) { + return nil, errors.New(tenantIDValidationErr) + } + if options == nil { + options = &ClientSecretCredentialOptions{} + } + authorityHost, err := setAuthorityHost(options.Cloud) + if err != nil { + return nil, err + } + cred, err := confidential.NewCredFromSecret(clientSecret) + if err != nil { + return nil, err + } + c, err := confidential.New(clientID, cred, + confidential.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)), + confidential.WithHTTPClient(newPipelineAdapter(&options.ClientOptions)), + confidential.WithAzureRegion(os.Getenv(azureRegionalAuthorityName)), + ) + if err != nil { + return nil, err + } + return &ClientSecretCredential{client: c}, nil +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *ClientSecretCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) == 0 { + return azcore.AccessToken{}, errors.New(credNameSecret + ": GetToken() requires at least one scope") + } + ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes) + if err == nil { + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + } + + ar, err = c.client.AcquireTokenByCredential(ctx, opts.Scopes) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameSecret, err) + } + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +var _ azcore.TokenCredential = (*ClientSecretCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/default_azure_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/default_azure_credential.go new file mode 100644 index 000000000..7358558ac --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/default_azure_credential.go @@ -0,0 +1,132 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "os" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +// DefaultAzureCredentialOptions contains optional parameters for DefaultAzureCredential. +// These options may not apply to all credentials in the chain. +type DefaultAzureCredentialOptions struct { + azcore.ClientOptions + + // TenantID identifies the tenant the Azure CLI should authenticate in. + // Defaults to the CLI's default tenant, which is typically the home tenant of the user logged in to the CLI. + TenantID string +} + +// DefaultAzureCredential is a default credential chain for applications that will deploy to Azure. +// It combines credentials suitable for deployment with credentials suitable for local development. +// It attempts to authenticate with each of these credential types, in the following order, stopping when one provides a token: +// EnvironmentCredential +// ManagedIdentityCredential +// AzureCLICredential +// Consult the documentation for these credential types for more information on how they authenticate. +// Once a credential has successfully authenticated, DefaultAzureCredential will use that credential for +// every subsequent authentication. +type DefaultAzureCredential struct { + chain *ChainedTokenCredential +} + +// NewDefaultAzureCredential creates a DefaultAzureCredential. Pass nil for options to accept defaults. +func NewDefaultAzureCredential(options *DefaultAzureCredentialOptions) (*DefaultAzureCredential, error) { + var creds []azcore.TokenCredential + var errorMessages []string + + if options == nil { + options = &DefaultAzureCredentialOptions{} + } + + envCred, err := NewEnvironmentCredential(&EnvironmentCredentialOptions{ClientOptions: options.ClientOptions}) + if err == nil { + creds = append(creds, envCred) + } else { + errorMessages = append(errorMessages, "EnvironmentCredential: "+err.Error()) + creds = append(creds, &defaultCredentialErrorReporter{credType: "EnvironmentCredential", err: err}) + } + + o := &ManagedIdentityCredentialOptions{ClientOptions: options.ClientOptions} + if ID, ok := os.LookupEnv(azureClientID); ok { + o.ID = ClientID(ID) + } + msiCred, err := NewManagedIdentityCredential(o) + if err == nil { + creds = append(creds, msiCred) + msiCred.client.imdsTimeout = time.Second + } else { + errorMessages = append(errorMessages, credNameManagedIdentity+": "+err.Error()) + creds = append(creds, &defaultCredentialErrorReporter{credType: credNameManagedIdentity, err: err}) + } + + cliCred, err := NewAzureCLICredential(&AzureCLICredentialOptions{TenantID: options.TenantID}) + if err == nil { + creds = append(creds, cliCred) + } else { + errorMessages = append(errorMessages, credNameAzureCLI+": "+err.Error()) + creds = append(creds, &defaultCredentialErrorReporter{credType: credNameAzureCLI, err: err}) + } + + err = defaultAzureCredentialConstructorErrorHandler(len(creds), errorMessages) + if err != nil { + return nil, err + } + + chain, err := NewChainedTokenCredential(creds, nil) + if err != nil { + return nil, err + } + chain.name = "DefaultAzureCredential" + return &DefaultAzureCredential{chain: chain}, nil +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *DefaultAzureCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + return c.chain.GetToken(ctx, opts) +} + +var _ azcore.TokenCredential = (*DefaultAzureCredential)(nil) + +func defaultAzureCredentialConstructorErrorHandler(numberOfSuccessfulCredentials int, errorMessages []string) (err error) { + errorMessage := strings.Join(errorMessages, "\n\t") + + if numberOfSuccessfulCredentials == 0 { + return errors.New(errorMessage) + } + + if len(errorMessages) != 0 { + log.Writef(EventAuthentication, "NewDefaultAzureCredential failed to initialize some credentials:\n\t%s", errorMessage) + } + + return nil +} + +// defaultCredentialErrorReporter is a substitute for credentials that couldn't be constructed. +// Its GetToken method always returns a credentialUnavailableError having the same message as +// the error that prevented constructing the credential. This ensures the message is present +// in the error returned by ChainedTokenCredential.GetToken() +type defaultCredentialErrorReporter struct { + credType string + err error +} + +func (d *defaultCredentialErrorReporter) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if _, ok := d.err.(*credentialUnavailableError); ok { + return azcore.AccessToken{}, d.err + } + return azcore.AccessToken{}, newCredentialUnavailableError(d.credType, d.err.Error()) +} + +var _ azcore.TokenCredential = (*defaultCredentialErrorReporter)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/device_code_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/device_code_credential.go new file mode 100644 index 000000000..d0c72c348 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/device_code_credential.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" +) + +const credNameDeviceCode = "DeviceCodeCredential" + +// DeviceCodeCredentialOptions contains optional parameters for DeviceCodeCredential. +type DeviceCodeCredentialOptions struct { + azcore.ClientOptions + + // TenantID is the Azure Active Directory tenant the credential authenticates in. Defaults to the + // "organizations" tenant, which can authenticate work and school accounts. Required for single-tenant + // applications. + TenantID string + // ClientID is the ID of the application users will authenticate to. + // Defaults to the ID of an Azure development application. + ClientID string + // UserPrompt controls how the credential presents authentication instructions. The credential calls + // this function with authentication details when it receives a device code. By default, the credential + // prints these details to stdout. + UserPrompt func(context.Context, DeviceCodeMessage) error +} + +func (o *DeviceCodeCredentialOptions) init() { + if o.TenantID == "" { + o.TenantID = organizationsTenantID + } + if o.ClientID == "" { + o.ClientID = developerSignOnClientID + } + if o.UserPrompt == nil { + o.UserPrompt = func(ctx context.Context, dc DeviceCodeMessage) error { + fmt.Println(dc.Message) + return nil + } + } +} + +// DeviceCodeMessage contains the information a user needs to complete authentication. +type DeviceCodeMessage struct { + // UserCode is the user code returned by the service. + UserCode string `json:"user_code"` + // VerificationURL is the URL at which the user must authenticate. + VerificationURL string `json:"verification_uri"` + // Message is user instruction from Azure Active Directory. + Message string `json:"message"` +} + +// DeviceCodeCredential acquires tokens for a user via the device code flow, which has the +// user browse to an Azure Active Directory URL, enter a code, and authenticate. It's useful +// for authenticating a user in an environment without a web browser, such as an SSH session. +// If a web browser is available, InteractiveBrowserCredential is more convenient because it +// automatically opens a browser to the login page. +type DeviceCodeCredential struct { + client publicClient + userPrompt func(context.Context, DeviceCodeMessage) error + account public.Account +} + +// NewDeviceCodeCredential creates a DeviceCodeCredential. Pass nil to accept default options. +func NewDeviceCodeCredential(options *DeviceCodeCredentialOptions) (*DeviceCodeCredential, error) { + cp := DeviceCodeCredentialOptions{} + if options != nil { + cp = *options + } + cp.init() + if !validTenantID(cp.TenantID) { + return nil, errors.New(tenantIDValidationErr) + } + authorityHost, err := setAuthorityHost(cp.Cloud) + if err != nil { + return nil, err + } + c, err := public.New(cp.ClientID, + public.WithAuthority(runtime.JoinPaths(authorityHost, cp.TenantID)), + public.WithHTTPClient(newPipelineAdapter(&cp.ClientOptions)), + ) + if err != nil { + return nil, err + } + return &DeviceCodeCredential{userPrompt: cp.UserPrompt, client: c}, nil +} + +// GetToken requests an access token from Azure Active Directory. It will begin the device code flow and poll until the user completes authentication. +// This method is called automatically by Azure SDK clients. +func (c *DeviceCodeCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) == 0 { + return azcore.AccessToken{}, errors.New(credNameDeviceCode + ": GetToken() requires at least one scope") + } + ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, public.WithSilentAccount(c.account)) + if err == nil { + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + } + dc, err := c.client.AcquireTokenByDeviceCode(ctx, opts.Scopes) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameDeviceCode, err) + } + err = c.userPrompt(ctx, DeviceCodeMessage{ + UserCode: dc.Result.UserCode, + VerificationURL: dc.Result.VerificationURL, + Message: dc.Result.Message, + }) + if err != nil { + return azcore.AccessToken{}, err + } + ar, err = dc.AuthenticationResult(ctx) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameDeviceCode, err) + } + c.account = ar.Account + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +var _ azcore.TokenCredential = (*DeviceCodeCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/environment_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/environment_credential.go new file mode 100644 index 000000000..16c595d1d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/environment_credential.go @@ -0,0 +1,122 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "fmt" + "os" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +const envVarSendCertChain = "AZURE_CLIENT_SEND_CERTIFICATE_CHAIN" + +// EnvironmentCredentialOptions contains optional parameters for EnvironmentCredential +type EnvironmentCredentialOptions struct { + azcore.ClientOptions +} + +// EnvironmentCredential authenticates a service principal with a secret or certificate, or a user with a password, depending +// on environment variable configuration. It reads configuration from these variables, in the following order: +// +// Service principal with client secret +// +// AZURE_TENANT_ID: ID of the service principal's tenant. Also called its "directory" ID. +// +// AZURE_CLIENT_ID: the service principal's client ID +// +// AZURE_CLIENT_SECRET: one of the service principal's client secrets +// +// Service principal with certificate +// +// AZURE_TENANT_ID: ID of the service principal's tenant. Also called its "directory" ID. +// +// AZURE_CLIENT_ID: the service principal's client ID +// +// AZURE_CLIENT_CERTIFICATE_PATH: path to a PEM or PKCS12 certificate file including the unencrypted private key. +// +// User with username and password +// +// AZURE_TENANT_ID: (optional) tenant to authenticate in. Defaults to "organizations". +// +// AZURE_CLIENT_ID: client ID of the application the user will authenticate to +// +// AZURE_USERNAME: a username (usually an email address) +// +// AZURE_PASSWORD: the user's password +type EnvironmentCredential struct { + cred azcore.TokenCredential +} + +// NewEnvironmentCredential creates an EnvironmentCredential. Pass nil to accept default options. +func NewEnvironmentCredential(options *EnvironmentCredentialOptions) (*EnvironmentCredential, error) { + if options == nil { + options = &EnvironmentCredentialOptions{} + } + tenantID := os.Getenv("AZURE_TENANT_ID") + if tenantID == "" { + return nil, errors.New("missing environment variable AZURE_TENANT_ID") + } + clientID := os.Getenv(azureClientID) + if clientID == "" { + return nil, errors.New("missing environment variable " + azureClientID) + } + if clientSecret := os.Getenv("AZURE_CLIENT_SECRET"); clientSecret != "" { + log.Write(EventAuthentication, "EnvironmentCredential will authenticate with ClientSecretCredential") + o := &ClientSecretCredentialOptions{ClientOptions: options.ClientOptions} + cred, err := NewClientSecretCredential(tenantID, clientID, clientSecret, o) + if err != nil { + return nil, err + } + return &EnvironmentCredential{cred: cred}, nil + } + if certPath := os.Getenv("AZURE_CLIENT_CERTIFICATE_PATH"); certPath != "" { + log.Write(EventAuthentication, "EnvironmentCredential will authenticate with ClientCertificateCredential") + certData, err := os.ReadFile(certPath) + if err != nil { + return nil, fmt.Errorf(`failed to read certificate file "%s": %v`, certPath, err) + } + certs, key, err := ParseCertificates(certData, nil) + if err != nil { + return nil, fmt.Errorf(`failed to load certificate from "%s": %v`, certPath, err) + } + o := &ClientCertificateCredentialOptions{ClientOptions: options.ClientOptions} + if v, ok := os.LookupEnv(envVarSendCertChain); ok { + o.SendCertificateChain = v == "1" || strings.ToLower(v) == "true" + } + cred, err := NewClientCertificateCredential(tenantID, clientID, certs, key, o) + if err != nil { + return nil, err + } + return &EnvironmentCredential{cred: cred}, nil + } + if username := os.Getenv("AZURE_USERNAME"); username != "" { + if password := os.Getenv("AZURE_PASSWORD"); password != "" { + log.Write(EventAuthentication, "EnvironmentCredential will authenticate with UsernamePasswordCredential") + o := &UsernamePasswordCredentialOptions{ClientOptions: options.ClientOptions} + cred, err := NewUsernamePasswordCredential(tenantID, clientID, username, password, o) + if err != nil { + return nil, err + } + return &EnvironmentCredential{cred: cred}, nil + } + return nil, errors.New("no value for AZURE_PASSWORD") + } + return nil, errors.New("incomplete environment variable configuration. Only AZURE_TENANT_ID and AZURE_CLIENT_ID are set") +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *EnvironmentCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + return c.cred.GetToken(ctx, opts) +} + +var _ azcore.TokenCredential = (*EnvironmentCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/errors.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/errors.go new file mode 100644 index 000000000..c60d13d00 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/errors.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" + msal "github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors" +) + +// getResponseFromError retrieves the response carried by +// an AuthenticationFailedError or MSAL CallErr, if any +func getResponseFromError(err error) *http.Response { + var a *AuthenticationFailedError + var c msal.CallErr + var res *http.Response + if errors.As(err, &c) { + res = c.Resp + } else if errors.As(err, &a) { + res = a.RawResponse + } + return res +} + +// AuthenticationFailedError indicates an authentication request has failed. +type AuthenticationFailedError struct { + // RawResponse is the HTTP response motivating the error, if available. + RawResponse *http.Response + + credType string + message string +} + +func newAuthenticationFailedError(credType string, message string, resp *http.Response) error { + return &AuthenticationFailedError{credType: credType, message: message, RawResponse: resp} +} + +func newAuthenticationFailedErrorFromMSALError(credType string, err error) error { + res := getResponseFromError(err) + return newAuthenticationFailedError(credType, err.Error(), res) +} + +// Error implements the error interface. Note that the message contents are not contractual and can change over time. +func (e *AuthenticationFailedError) Error() string { + if e.RawResponse == nil { + return e.credType + ": " + e.message + } + msg := &bytes.Buffer{} + fmt.Fprintf(msg, e.credType+" authentication failed\n") + fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.Path) + fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + fmt.Fprintf(msg, "RESPONSE %s\n", e.RawResponse.Status) + fmt.Fprintln(msg, "--------------------------------------------------------------------------------") + body, err := io.ReadAll(e.RawResponse.Body) + e.RawResponse.Body.Close() + if err != nil { + fmt.Fprintf(msg, "Error reading response body: %v", err) + } else if len(body) > 0 { + e.RawResponse.Body = io.NopCloser(bytes.NewReader(body)) + if err := json.Indent(msg, body, "", " "); err != nil { + // failed to pretty-print so just dump it verbatim + fmt.Fprint(msg, string(body)) + } + } else { + fmt.Fprint(msg, "Response contained no body") + } + fmt.Fprintln(msg, "\n--------------------------------------------------------------------------------") + return msg.String() +} + +// NonRetriable indicates the request which provoked this error shouldn't be retried. +func (*AuthenticationFailedError) NonRetriable() { + // marker method +} + +var _ errorinfo.NonRetriable = (*AuthenticationFailedError)(nil) + +// credentialUnavailableError indicates a credential can't attempt +// authentication because it lacks required data or state. +type credentialUnavailableError struct { + credType string + message string +} + +func newCredentialUnavailableError(credType, message string) error { + return &credentialUnavailableError{credType: credType, message: message} +} + +func (e *credentialUnavailableError) Error() string { + return e.credType + ": " + e.message +} + +// NonRetriable indicates that this error should not be retried. +func (e *credentialUnavailableError) NonRetriable() { + // marker method +} + +var _ errorinfo.NonRetriable = (*credentialUnavailableError)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/interactive_browser_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/interactive_browser_credential.go new file mode 100644 index 000000000..e4aaf45b6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/interactive_browser_credential.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" +) + +const credNameBrowser = "InteractiveBrowserCredentiall" + +// InteractiveBrowserCredentialOptions contains optional parameters for InteractiveBrowserCredential. +type InteractiveBrowserCredentialOptions struct { + azcore.ClientOptions + + // TenantID is the Azure Active Directory tenant the credential authenticates in. Defaults to the + // "organizations" tenant, which can authenticate work and school accounts. + TenantID string + // ClientID is the ID of the application users will authenticate to. + // Defaults to the ID of an Azure development application. + ClientID string + // RedirectURL will be supported in a future version but presently doesn't work: https://github.com/Azure/azure-sdk-for-go/issues/15632. + // Applications which have "http://localhost" registered as a redirect URL need not set this option. + RedirectURL string +} + +func (o *InteractiveBrowserCredentialOptions) init() { + if o.TenantID == "" { + o.TenantID = organizationsTenantID + } + if o.ClientID == "" { + o.ClientID = developerSignOnClientID + } +} + +// InteractiveBrowserCredential opens a browser to interactively authenticate a user. +type InteractiveBrowserCredential struct { + client publicClient + options InteractiveBrowserCredentialOptions + account public.Account +} + +// NewInteractiveBrowserCredential constructs a new InteractiveBrowserCredential. Pass nil to accept default options. +func NewInteractiveBrowserCredential(options *InteractiveBrowserCredentialOptions) (*InteractiveBrowserCredential, error) { + cp := InteractiveBrowserCredentialOptions{} + if options != nil { + cp = *options + } + cp.init() + if !validTenantID(cp.TenantID) { + return nil, errors.New(tenantIDValidationErr) + } + authorityHost, err := setAuthorityHost(cp.Cloud) + if err != nil { + return nil, err + } + c, err := public.New(cp.ClientID, + public.WithAuthority(runtime.JoinPaths(authorityHost, cp.TenantID)), + public.WithHTTPClient(newPipelineAdapter(&cp.ClientOptions)), + ) + if err != nil { + return nil, err + } + return &InteractiveBrowserCredential{options: cp, client: c}, nil +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *InteractiveBrowserCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) == 0 { + return azcore.AccessToken{}, errors.New(credNameBrowser + ": GetToken() requires at least one scope") + } + ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, public.WithSilentAccount(c.account)) + if err == nil { + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + } + + o := []public.InteractiveAuthOption{} + if c.options.RedirectURL != "" { + o = append(o, public.WithRedirectURI(c.options.RedirectURL)) + } + ar, err = c.client.AcquireTokenInteractive(ctx, opts.Scopes, o...) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameBrowser, err) + } + c.account = ar.Account + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +var _ azcore.TokenCredential = (*InteractiveBrowserCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/logging.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/logging.go new file mode 100644 index 000000000..569453e46 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/logging.go @@ -0,0 +1,30 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "fmt" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +// EventAuthentication entries contain information about authentication. +// This includes information like the names of environment variables +// used when obtaining credentials and the type of credential used. +const EventAuthentication log.Event = "Authentication" + +func logGetTokenSuccess(cred azcore.TokenCredential, opts policy.TokenRequestOptions) { + if !log.Should(EventAuthentication) { + return + } + scope := strings.Join(opts.Scopes, ", ") + msg := fmt.Sprintf("%T.GetToken() acquired a token for scope %s\n", cred, scope) + log.Write(EventAuthentication, msg) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_client.go new file mode 100644 index 000000000..ce6e1e614 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_client.go @@ -0,0 +1,393 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" + "strconv" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" + "github.com/Azure/azure-sdk-for-go/sdk/internal/log" +) + +const ( + arcIMDSEndpoint = "IMDS_ENDPOINT" + identityEndpoint = "IDENTITY_ENDPOINT" + identityHeader = "IDENTITY_HEADER" + identityServerThumbprint = "IDENTITY_SERVER_THUMBPRINT" + headerMetadata = "Metadata" + imdsEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token" + msiEndpoint = "MSI_ENDPOINT" + imdsAPIVersion = "2018-02-01" + azureArcAPIVersion = "2019-08-15" + serviceFabricAPIVersion = "2019-07-01-preview" + + qpClientID = "client_id" + qpResID = "mi_res_id" +) + +type msiType int + +const ( + msiTypeAppService msiType = iota + msiTypeAzureArc + msiTypeCloudShell + msiTypeIMDS + msiTypeServiceFabric +) + +// managedIdentityClient provides the base for authenticating in managed identity environments +// This type includes an runtime.Pipeline and TokenCredentialOptions. +type managedIdentityClient struct { + pipeline runtime.Pipeline + msiType msiType + endpoint string + id ManagedIDKind + imdsTimeout time.Duration +} + +type wrappedNumber json.Number + +func (n *wrappedNumber) UnmarshalJSON(b []byte) error { + c := string(b) + if c == "\"\"" { + return nil + } + return json.Unmarshal(b, (*json.Number)(n)) +} + +// setIMDSRetryOptionDefaults sets zero-valued fields to default values appropriate for IMDS +func setIMDSRetryOptionDefaults(o *policy.RetryOptions) { + if o.MaxRetries == 0 { + o.MaxRetries = 5 + } + if o.MaxRetryDelay == 0 { + o.MaxRetryDelay = 1 * time.Minute + } + if o.RetryDelay == 0 { + o.RetryDelay = 2 * time.Second + } + if o.StatusCodes == nil { + o.StatusCodes = []int{ + // IMDS docs recommend retrying 404, 429 and all 5xx + // https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#error-handling + http.StatusNotFound, // 404 + http.StatusTooManyRequests, // 429 + http.StatusInternalServerError, // 500 + http.StatusNotImplemented, // 501 + http.StatusBadGateway, // 502 + http.StatusGatewayTimeout, // 504 + http.StatusHTTPVersionNotSupported, // 505 + http.StatusVariantAlsoNegotiates, // 506 + http.StatusInsufficientStorage, // 507 + http.StatusLoopDetected, // 508 + http.StatusNotExtended, // 510 + http.StatusNetworkAuthenticationRequired, // 511 + } + } + if o.TryTimeout == 0 { + o.TryTimeout = 1 * time.Minute + } +} + +// newManagedIdentityClient creates a new instance of the ManagedIdentityClient with the ManagedIdentityCredentialOptions +// that are passed into it along with a default pipeline. +// options: ManagedIdentityCredentialOptions configure policies for the pipeline and the authority host that +// will be used to retrieve tokens and authenticate +func newManagedIdentityClient(options *ManagedIdentityCredentialOptions) (*managedIdentityClient, error) { + if options == nil { + options = &ManagedIdentityCredentialOptions{} + } + cp := options.ClientOptions + c := managedIdentityClient{id: options.ID, endpoint: imdsEndpoint, msiType: msiTypeIMDS} + env := "IMDS" + if endpoint, ok := os.LookupEnv(identityEndpoint); ok { + if _, ok := os.LookupEnv(identityHeader); ok { + if _, ok := os.LookupEnv(identityServerThumbprint); ok { + env = "Service Fabric" + c.endpoint = endpoint + c.msiType = msiTypeServiceFabric + } else { + env = "App Service" + c.endpoint = endpoint + c.msiType = msiTypeAppService + } + } else if _, ok := os.LookupEnv(arcIMDSEndpoint); ok { + env = "Azure Arc" + c.endpoint = endpoint + c.msiType = msiTypeAzureArc + } + } else if endpoint, ok := os.LookupEnv(msiEndpoint); ok { + env = "Cloud Shell" + c.endpoint = endpoint + c.msiType = msiTypeCloudShell + } else { + setIMDSRetryOptionDefaults(&cp.Retry) + } + c.pipeline = runtime.NewPipeline(component, version, runtime.PipelineOptions{}, &cp) + + if log.Should(EventAuthentication) { + log.Writef(EventAuthentication, "Managed Identity Credential will use %s managed identity", env) + } + + return &c, nil +} + +// authenticate creates an authentication request for a Managed Identity and returns the resulting Access Token if successful. +// ctx: The current context for controlling the request lifetime. +// clientID: The client (application) ID of the service principal. +// scopes: The scopes required for the token. +func (c *managedIdentityClient) authenticate(ctx context.Context, id ManagedIDKind, scopes []string) (azcore.AccessToken, error) { + var cancel context.CancelFunc + if c.imdsTimeout > 0 && c.msiType == msiTypeIMDS { + ctx, cancel = context.WithTimeout(ctx, c.imdsTimeout) + defer cancel() + } + + msg, err := c.createAuthRequest(ctx, id, scopes) + if err != nil { + return azcore.AccessToken{}, err + } + + resp, err := c.pipeline.Do(msg) + if err != nil { + if cancel != nil && errors.Is(err, context.DeadlineExceeded) { + return azcore.AccessToken{}, newCredentialUnavailableError(credNameManagedIdentity, "IMDS token request timed out") + } + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, err.Error(), nil) + } + + // got a response, remove the IMDS timeout so future requests use the transport's configuration + c.imdsTimeout = 0 + + if runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return c.createAccessToken(resp) + } + + if c.msiType == msiTypeIMDS && resp.StatusCode == 400 { + if id != nil { + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, "the requested identity isn't assigned to this resource", resp) + } + return azcore.AccessToken{}, newCredentialUnavailableError(credNameManagedIdentity, "no default identity is assigned to this resource") + } + + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, "authentication failed", resp) +} + +func (c *managedIdentityClient) createAccessToken(res *http.Response) (azcore.AccessToken, error) { + value := struct { + // these are the only fields that we use + Token string `json:"access_token,omitempty"` + RefreshToken string `json:"refresh_token,omitempty"` + ExpiresIn wrappedNumber `json:"expires_in,omitempty"` // this field should always return the number of seconds for which a token is valid + ExpiresOn interface{} `json:"expires_on,omitempty"` // the value returned in this field varies between a number and a date string + }{} + if err := runtime.UnmarshalAsJSON(res, &value); err != nil { + return azcore.AccessToken{}, fmt.Errorf("internal AccessToken: %v", err) + } + if value.ExpiresIn != "" { + expiresIn, err := json.Number(value.ExpiresIn).Int64() + if err != nil { + return azcore.AccessToken{}, err + } + return azcore.AccessToken{Token: value.Token, ExpiresOn: time.Now().Add(time.Second * time.Duration(expiresIn)).UTC()}, nil + } + switch v := value.ExpiresOn.(type) { + case float64: + return azcore.AccessToken{Token: value.Token, ExpiresOn: time.Unix(int64(v), 0).UTC()}, nil + case string: + if expiresOn, err := strconv.Atoi(v); err == nil { + return azcore.AccessToken{Token: value.Token, ExpiresOn: time.Unix(int64(expiresOn), 0).UTC()}, nil + } + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, "unexpected expires_on value: "+v, res) + default: + msg := fmt.Sprintf("unsupported type received in expires_on: %T, %v", v, v) + return azcore.AccessToken{}, newAuthenticationFailedError(credNameManagedIdentity, msg, res) + } +} + +func (c *managedIdentityClient) createAuthRequest(ctx context.Context, id ManagedIDKind, scopes []string) (*policy.Request, error) { + switch c.msiType { + case msiTypeIMDS: + return c.createIMDSAuthRequest(ctx, id, scopes) + case msiTypeAppService: + return c.createAppServiceAuthRequest(ctx, id, scopes) + case msiTypeAzureArc: + // need to perform preliminary request to retreive the secret key challenge provided by the HIMDS service + key, err := c.getAzureArcSecretKey(ctx, scopes) + if err != nil { + msg := fmt.Sprintf("failed to retreive secret key from the identity endpoint: %v", err) + return nil, newAuthenticationFailedError(credNameManagedIdentity, msg, nil) + } + return c.createAzureArcAuthRequest(ctx, id, scopes, key) + case msiTypeServiceFabric: + return c.createServiceFabricAuthRequest(ctx, id, scopes) + case msiTypeCloudShell: + return c.createCloudShellAuthRequest(ctx, id, scopes) + default: + return nil, newCredentialUnavailableError(credNameManagedIdentity, "managed identity isn't supported in this environment") + } +} + +func (c *managedIdentityClient) createIMDSAuthRequest(ctx context.Context, id ManagedIDKind, scopes []string) (*policy.Request, error) { + request, err := runtime.NewRequest(ctx, http.MethodGet, c.endpoint) + if err != nil { + return nil, err + } + request.Raw().Header.Set(headerMetadata, "true") + q := request.Raw().URL.Query() + q.Add("api-version", imdsAPIVersion) + q.Add("resource", strings.Join(scopes, " ")) + if id != nil { + if id.idKind() == miResourceID { + q.Add(qpResID, id.String()) + } else { + q.Add(qpClientID, id.String()) + } + } + request.Raw().URL.RawQuery = q.Encode() + return request, nil +} + +func (c *managedIdentityClient) createAppServiceAuthRequest(ctx context.Context, id ManagedIDKind, scopes []string) (*policy.Request, error) { + request, err := runtime.NewRequest(ctx, http.MethodGet, c.endpoint) + if err != nil { + return nil, err + } + request.Raw().Header.Set("X-IDENTITY-HEADER", os.Getenv(identityHeader)) + q := request.Raw().URL.Query() + q.Add("api-version", "2019-08-01") + q.Add("resource", scopes[0]) + if id != nil { + if id.idKind() == miResourceID { + q.Add(qpResID, id.String()) + } else { + q.Add(qpClientID, id.String()) + } + } + request.Raw().URL.RawQuery = q.Encode() + return request, nil +} + +func (c *managedIdentityClient) createServiceFabricAuthRequest(ctx context.Context, id ManagedIDKind, scopes []string) (*policy.Request, error) { + request, err := runtime.NewRequest(ctx, http.MethodGet, c.endpoint) + if err != nil { + return nil, err + } + q := request.Raw().URL.Query() + request.Raw().Header.Set("Accept", "application/json") + request.Raw().Header.Set("Secret", os.Getenv(identityHeader)) + q.Add("api-version", serviceFabricAPIVersion) + q.Add("resource", strings.Join(scopes, " ")) + if id != nil { + log.Write(EventAuthentication, "WARNING: Service Fabric doesn't support selecting a user-assigned identity at runtime") + if id.idKind() == miResourceID { + q.Add(qpResID, id.String()) + } else { + q.Add(qpClientID, id.String()) + } + } + request.Raw().URL.RawQuery = q.Encode() + return request, nil +} + +func (c *managedIdentityClient) getAzureArcSecretKey(ctx context.Context, resources []string) (string, error) { + // create the request to retreive the secret key challenge provided by the HIMDS service + request, err := runtime.NewRequest(ctx, http.MethodGet, c.endpoint) + if err != nil { + return "", err + } + request.Raw().Header.Set(headerMetadata, "true") + q := request.Raw().URL.Query() + q.Add("api-version", azureArcAPIVersion) + q.Add("resource", strings.Join(resources, " ")) + request.Raw().URL.RawQuery = q.Encode() + // send the initial request to get the short-lived secret key + response, err := c.pipeline.Do(request) + if err != nil { + return "", err + } + // the endpoint is expected to return a 401 with the WWW-Authenticate header set to the location + // of the secret key file. Any other status code indicates an error in the request. + if response.StatusCode != 401 { + msg := fmt.Sprintf("expected a 401 response, received %d", response.StatusCode) + return "", newAuthenticationFailedError(credNameManagedIdentity, msg, response) + } + header := response.Header.Get("WWW-Authenticate") + if len(header) == 0 { + return "", errors.New("did not receive a value from WWW-Authenticate header") + } + // the WWW-Authenticate header is expected in the following format: Basic realm=/some/file/path.key + pos := strings.LastIndex(header, "=") + if pos == -1 { + return "", fmt.Errorf("did not receive a correct value from WWW-Authenticate header: %s", header) + } + key, err := ioutil.ReadFile(header[pos+1:]) + if err != nil { + return "", fmt.Errorf("could not read file (%s) contents: %v", header[pos+1:], err) + } + return string(key), nil +} + +func (c *managedIdentityClient) createAzureArcAuthRequest(ctx context.Context, id ManagedIDKind, resources []string, key string) (*policy.Request, error) { + request, err := runtime.NewRequest(ctx, http.MethodGet, c.endpoint) + if err != nil { + return nil, err + } + request.Raw().Header.Set(headerMetadata, "true") + request.Raw().Header.Set("Authorization", fmt.Sprintf("Basic %s", key)) + q := request.Raw().URL.Query() + q.Add("api-version", azureArcAPIVersion) + q.Add("resource", strings.Join(resources, " ")) + if id != nil { + log.Write(EventAuthentication, "WARNING: Azure Arc doesn't support user-assigned managed identities") + if id.idKind() == miResourceID { + q.Add(qpResID, id.String()) + } else { + q.Add(qpClientID, id.String()) + } + } + request.Raw().URL.RawQuery = q.Encode() + return request, nil +} + +func (c *managedIdentityClient) createCloudShellAuthRequest(ctx context.Context, id ManagedIDKind, scopes []string) (*policy.Request, error) { + request, err := runtime.NewRequest(ctx, http.MethodPost, c.endpoint) + if err != nil { + return nil, err + } + request.Raw().Header.Set(headerMetadata, "true") + data := url.Values{} + data.Set("resource", strings.Join(scopes, " ")) + dataEncoded := data.Encode() + body := streaming.NopCloser(strings.NewReader(dataEncoded)) + if err := request.SetBody(body, "application/x-www-form-urlencoded"); err != nil { + return nil, err + } + if id != nil { + log.Write(EventAuthentication, "WARNING: Cloud Shell doesn't support user-assigned managed identities") + q := request.Raw().URL.Query() + if id.idKind() == miResourceID { + q.Add(qpResID, id.String()) + } else { + q.Add(qpClientID, id.String()) + } + } + return request, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_credential.go new file mode 100644 index 000000000..f17ada1c3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/managed_identity_credential.go @@ -0,0 +1,105 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" +) + +const credNameManagedIdentity = "ManagedIdentityCredential" + +type managedIdentityIDKind int + +const ( + miClientID managedIdentityIDKind = 0 + miResourceID managedIdentityIDKind = 1 +) + +// ManagedIDKind identifies the ID of a managed identity as either a client or resource ID +type ManagedIDKind interface { + fmt.Stringer + idKind() managedIdentityIDKind +} + +// ClientID is the client ID of a user-assigned managed identity. +type ClientID string + +func (ClientID) idKind() managedIdentityIDKind { + return miClientID +} + +// String returns the string value of the ID. +func (c ClientID) String() string { + return string(c) +} + +// ResourceID is the resource ID of a user-assigned managed identity. +type ResourceID string + +func (ResourceID) idKind() managedIdentityIDKind { + return miResourceID +} + +// String returns the string value of the ID. +func (r ResourceID) String() string { + return string(r) +} + +// ManagedIdentityCredentialOptions contains optional parameters for ManagedIdentityCredential. +type ManagedIdentityCredentialOptions struct { + azcore.ClientOptions + + // ID is the ID of a managed identity the credential should authenticate. Set this field to use a specific identity + // instead of the hosting environment's default. The value may be the identity's client ID or resource ID, but note that + // some platforms don't accept resource IDs. + ID ManagedIDKind +} + +// ManagedIdentityCredential authenticates an Azure managed identity in any hosting environment supporting managed identities. +// This credential authenticates a system-assigned identity by default. Use ManagedIdentityCredentialOptions.ID to specify a +// user-assigned identity. See Azure Active Directory documentation for more information about managed identities: +// https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview +type ManagedIdentityCredential struct { + id ManagedIDKind + client *managedIdentityClient +} + +// NewManagedIdentityCredential creates a ManagedIdentityCredential. Pass nil to accept default options. +func NewManagedIdentityCredential(options *ManagedIdentityCredentialOptions) (*ManagedIdentityCredential, error) { + if options == nil { + options = &ManagedIdentityCredentialOptions{} + } + client, err := newManagedIdentityClient(options) + if err != nil { + return nil, err + } + return &ManagedIdentityCredential{id: options.ID, client: client}, nil +} + +// GetToken requests an access token from the hosting environment. This method is called automatically by Azure SDK clients. +func (c *ManagedIdentityCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) != 1 { + err := errors.New(credNameManagedIdentity + ": GetToken() requires exactly one scope") + return azcore.AccessToken{}, err + } + // managed identity endpoints require an AADv1 resource (i.e. token audience), not a v2 scope, so we remove "/.default" here + scopes := []string{strings.TrimSuffix(opts.Scopes[0], defaultSuffix)} + tk, err := c.client.authenticate(ctx, c.id, scopes) + if err != nil { + return azcore.AccessToken{}, err + } + logGetTokenSuccess(c, opts) + return tk, err +} + +var _ azcore.TokenCredential = (*ManagedIdentityCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/username_password_credential.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/username_password_credential.go new file mode 100644 index 000000000..8b02e7b47 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/username_password_credential.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +import ( + "context" + "errors" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" +) + +const credNameUserPassword = "UsernamePasswordCredential" + +// UsernamePasswordCredentialOptions contains optional parameters for UsernamePasswordCredential. +type UsernamePasswordCredentialOptions struct { + azcore.ClientOptions +} + +// UsernamePasswordCredential authenticates a user with a password. Microsoft doesn't recommend this kind of authentication, +// because it's less secure than other authentication flows. This credential is not interactive, so it isn't compatible +// with any form of multi-factor authentication, and the application must already have user or admin consent. +// This credential can only authenticate work and school accounts; it can't authenticate Microsoft accounts. +type UsernamePasswordCredential struct { + client publicClient + username string + password string + account public.Account +} + +// NewUsernamePasswordCredential creates a UsernamePasswordCredential. clientID is the ID of the application the user +// will authenticate to. Pass nil for options to accept defaults. +func NewUsernamePasswordCredential(tenantID string, clientID string, username string, password string, options *UsernamePasswordCredentialOptions) (*UsernamePasswordCredential, error) { + if !validTenantID(tenantID) { + return nil, errors.New(tenantIDValidationErr) + } + if options == nil { + options = &UsernamePasswordCredentialOptions{} + } + authorityHost, err := setAuthorityHost(options.Cloud) + if err != nil { + return nil, err + } + c, err := public.New(clientID, + public.WithAuthority(runtime.JoinPaths(authorityHost, tenantID)), + public.WithHTTPClient(newPipelineAdapter(&options.ClientOptions)), + ) + if err != nil { + return nil, err + } + return &UsernamePasswordCredential{username: username, password: password, client: c}, nil +} + +// GetToken requests an access token from Azure Active Directory. This method is called automatically by Azure SDK clients. +func (c *UsernamePasswordCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { + if len(opts.Scopes) == 0 { + return azcore.AccessToken{}, errors.New(credNameUserPassword + ": GetToken() requires at least one scope") + } + ar, err := c.client.AcquireTokenSilent(ctx, opts.Scopes, public.WithSilentAccount(c.account)) + if err == nil { + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err + } + ar, err = c.client.AcquireTokenByUsernamePassword(ctx, opts.Scopes, c.username, c.password) + if err != nil { + return azcore.AccessToken{}, newAuthenticationFailedErrorFromMSALError(credNameUserPassword, err) + } + c.account = ar.Account + logGetTokenSuccess(c, opts) + return azcore.AccessToken{Token: ar.AccessToken, ExpiresOn: ar.ExpiresOn.UTC()}, err +} + +var _ azcore.TokenCredential = (*UsernamePasswordCredential)(nil) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/version.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/version.go new file mode 100644 index 000000000..0fb125ace --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/version.go @@ -0,0 +1,15 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azidentity + +const ( + // UserAgent is the string to be used in the user agent string when making requests. + component = "azidentity" + + // Version is the semantic version (see http://semver.org) of this module. + version = "v1.1.0" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/LICENSE.txt new file mode 100644 index 000000000..48ea6616b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/diag.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/diag.go new file mode 100644 index 000000000..245af7d2b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/diag.go @@ -0,0 +1,51 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package diag + +import ( + "fmt" + "runtime" + "strings" +) + +// Caller returns the file and line number of a frame on the caller's stack. +// If the funtion fails an empty string is returned. +// skipFrames - the number of frames to skip when determining the caller. +// Passing a value of 0 will return the immediate caller of this function. +func Caller(skipFrames int) string { + if pc, file, line, ok := runtime.Caller(skipFrames + 1); ok { + // the skipFrames + 1 is to skip ourselves + frame := runtime.FuncForPC(pc) + return fmt.Sprintf("%s()\n\t%s:%d", frame.Name(), file, line) + } + return "" +} + +// StackTrace returns a formatted stack trace string. +// If the funtion fails an empty string is returned. +// skipFrames - the number of stack frames to skip before composing the trace string. +// totalFrames - the maximum number of stack frames to include in the trace string. +func StackTrace(skipFrames, totalFrames int) string { + pcCallers := make([]uintptr, totalFrames) + if frames := runtime.Callers(skipFrames, pcCallers); frames == 0 { + return "" + } + frames := runtime.CallersFrames(pcCallers) + sb := strings.Builder{} + for { + frame, more := frames.Next() + sb.WriteString(frame.Function) + sb.WriteString("()\n\t") + sb.WriteString(frame.File) + sb.WriteRune(':') + sb.WriteString(fmt.Sprintf("%d\n", frame.Line)) + if !more { + break + } + } + return sb.String() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/doc.go new file mode 100644 index 000000000..66bf13e5f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/diag/doc.go @@ -0,0 +1,7 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package diag diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/doc.go new file mode 100644 index 000000000..8c6eacb61 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/doc.go @@ -0,0 +1,7 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package errorinfo diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go new file mode 100644 index 000000000..ade7b348e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo/errorinfo.go @@ -0,0 +1,16 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package errorinfo + +// NonRetriable represents a non-transient error. This works in +// conjunction with the retry policy, indicating that the error condition +// is idempotent, so no retries will be attempted. +// Use errors.As() to access this interface in the error chain. +type NonRetriable interface { + error + NonRetriable() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/doc.go new file mode 100644 index 000000000..d7876d297 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/doc.go @@ -0,0 +1,7 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package log diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/log.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/log.go new file mode 100644 index 000000000..4f1dcf1b7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/log/log.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package log + +import ( + "fmt" + "os" + "time" +) + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// NOTE: The following are exported as public surface area from azcore. DO NOT MODIFY +/////////////////////////////////////////////////////////////////////////////////////////////////// + +// Event is used to group entries. Each group can be toggled on or off. +type Event string + +// SetEvents is used to control which events are written to +// the log. By default all log events are writen. +func SetEvents(cls ...Event) { + log.cls = cls +} + +// SetListener will set the Logger to write to the specified listener. +func SetListener(lst func(Event, string)) { + log.lst = lst +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// END PUBLIC SURFACE AREA +/////////////////////////////////////////////////////////////////////////////////////////////////// + +// Should returns true if the specified log event should be written to the log. +// By default all log events will be logged. Call SetEvents() to limit +// the log events for logging. +// If no listener has been set this will return false. +// Calling this method is useful when the message to log is computationally expensive +// and you want to avoid the overhead if its log event is not enabled. +func Should(cls Event) bool { + if log.lst == nil { + return false + } + if log.cls == nil || len(log.cls) == 0 { + return true + } + for _, c := range log.cls { + if c == cls { + return true + } + } + return false +} + +// Write invokes the underlying listener with the specified event and message. +// If the event shouldn't be logged or there is no listener then Write does nothing. +func Write(cls Event, message string) { + if !Should(cls) { + return + } + log.lst(cls, message) +} + +// Writef invokes the underlying listener with the specified event and formatted message. +// If the event shouldn't be logged or there is no listener then Writef does nothing. +func Writef(cls Event, format string, a ...interface{}) { + if !Should(cls) { + return + } + log.lst(cls, fmt.Sprintf(format, a...)) +} + +// TestResetEvents is used for TESTING PURPOSES ONLY. +func TestResetEvents() { + log.cls = nil +} + +// logger controls which events to log and writing to the underlying log. +type logger struct { + cls []Event + lst func(Event, string) +} + +// the process-wide logger +var log logger + +func init() { + initLogging() +} + +// split out for testing purposes +func initLogging() { + if cls := os.Getenv("AZURE_SDK_GO_LOGGING"); cls == "all" { + // cls could be enhanced to support a comma-delimited list of log events + log.lst = func(cls Event, msg string) { + // simple console logger, it writes to stderr in the following format: + // [time-stamp] Event: message + fmt.Fprintf(os.Stderr, "[%s] %s: %s\n", time.Now().Format(time.StampMicro), cls, msg) + } + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/temporal/resource.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/temporal/resource.go new file mode 100644 index 000000000..b23f3860c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/temporal/resource.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package temporal + +import ( + "sync" + "time" +) + +// AcquireResource abstracts a method for refreshing a temporal resource. +type AcquireResource[TResource, TState any] func(state TState) (newResource TResource, newExpiration time.Time, err error) + +// Resource is a temporal resource (usually a credential) that requires periodic refreshing. +type Resource[TResource, TState any] struct { + // cond is used to synchronize access to the shared resource embodied by the remaining fields + cond *sync.Cond + + // acquiring indicates that some thread/goroutine is in the process of acquiring/updating the resource + acquiring bool + + // resource contains the value of the shared resource + resource TResource + + // expiration indicates when the shared resource expires; it is 0 if the resource was never acquired + expiration time.Time + + // lastAttempt indicates when a thread/goroutine last attempted to acquire/update the resource + lastAttempt time.Time + + // acquireResource is the callback function that actually acquires the resource + acquireResource AcquireResource[TResource, TState] +} + +// NewResource creates a new Resource that uses the specified AcquireResource for refreshing. +func NewResource[TResource, TState any](ar AcquireResource[TResource, TState]) *Resource[TResource, TState] { + return &Resource[TResource, TState]{cond: sync.NewCond(&sync.Mutex{}), acquireResource: ar} +} + +// Get returns the underlying resource. +// If the resource is fresh, no refresh is performed. +func (er *Resource[TResource, TState]) Get(state TState) (TResource, error) { + // If the resource is expiring within this time window, update it eagerly. + // This allows other threads/goroutines to keep running by using the not-yet-expired + // resource value while one thread/goroutine updates the resource. + const window = 5 * time.Minute // This example updates the resource 5 minutes prior to expiration + const backoff = 30 * time.Second // Minimum wait time between eager update attempts + + now, acquire, expired, resource := time.Now(), false, false, er.resource + // acquire exclusive lock + er.cond.L.Lock() + for { + expired = er.expiration.IsZero() || er.expiration.Before(now) + if expired { + // The resource was never acquired or has expired + if !er.acquiring { + // If another thread/goroutine is not acquiring/updating the resource, this thread/goroutine will do it + er.acquiring, acquire = true, true + break + } + // Getting here means that this thread/goroutine will wait for the updated resource + } else if er.expiration.Add(-window).Before(now) { + // The resource is valid but is expiring within the time window + if !er.acquiring && er.lastAttempt.Add(backoff).Before(now) { + // If another thread/goroutine is not acquiring/renewing the resource, and none has attempted + // to do so within the last 30 seconds, this thread/goroutine will do it + er.acquiring, acquire = true, true + break + } + // This thread/goroutine will use the existing resource value while another updates it + resource = er.resource + break + } else { + // The resource is not close to expiring, this thread/goroutine should use its current value + resource = er.resource + break + } + // If we get here, wait for the new resource value to be acquired/updated + er.cond.Wait() + } + er.cond.L.Unlock() // Release the lock so no threads/goroutines are blocked + + var err error + if acquire { + // This thread/goroutine has been selected to acquire/update the resource + var expiration time.Time + var newValue TResource + er.lastAttempt = now + newValue, expiration, err = er.acquireResource(state) + + // Atomically, update the shared resource's new value & expiration. + er.cond.L.Lock() + if err == nil { + // Update resource & expiration, return the new value + resource = newValue + er.resource, er.expiration = resource, expiration + } else if !expired { + // An eager update failed. Discard the error and return the current--still valid--resource value + err = nil + } + er.acquiring = false // Indicate that no thread/goroutine is currently acquiring the resource + + // Wake up any waiting threads/goroutines since there is a resource they can ALL use + er.cond.L.Unlock() + er.cond.Broadcast() + } + return resource, err // Return the resource this thread/goroutine can use +} + +// Expire marks the resource as expired, ensuring it's refreshed on the next call to Get(). +func (er *Resource[TResource, TState]) Expire() { + er.cond.L.Lock() + defer er.cond.L.Unlock() + + // Reset the expiration as if we never got this resource to begin with + er.expiration = time.Time{} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/doc.go new file mode 100644 index 000000000..a3824bee8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/doc.go @@ -0,0 +1,7 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package uuid diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/uuid.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/uuid.go new file mode 100644 index 000000000..278ac9cd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/internal/uuid/uuid.go @@ -0,0 +1,76 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package uuid + +import ( + "crypto/rand" + "errors" + "fmt" + "strconv" +) + +// The UUID reserved variants. +const ( + reservedRFC4122 byte = 0x40 +) + +// A UUID representation compliant with specification in RFC4122 document. +type UUID [16]byte + +// New returns a new UUID using the RFC4122 algorithm. +func New() (UUID, error) { + u := UUID{} + // Set all bits to pseudo-random values. + // NOTE: this takes a process-wide lock + _, err := rand.Read(u[:]) + if err != nil { + return u, err + } + u[8] = (u[8] | reservedRFC4122) & 0x7F // u.setVariant(ReservedRFC4122) + + var version byte = 4 + u[6] = (u[6] & 0xF) | (version << 4) // u.setVersion(4) + return u, nil +} + +// String returns the UUID in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format. +func (u UUID) String() string { + return fmt.Sprintf("%x-%x-%x-%x-%x", u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) +} + +// Parse parses a string formatted as "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +// or "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" into a UUID. +func Parse(s string) (UUID, error) { + var uuid UUID + // ensure format + switch len(s) { + case 36: + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 38: + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + s = s[1:37] + default: + return uuid, errors.New("invalid UUID format") + } + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + // parse chunks + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + b, err := strconv.ParseUint(s[x:x+2], 16, 8) + if err != nil { + return uuid, fmt.Errorf("invalid UUID format: %s", err) + } + uuid[i] = byte(b) + } + return uuid, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/CHANGELOG.md new file mode 100644 index 000000000..a95789f7f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/CHANGELOG.md @@ -0,0 +1,198 @@ +# Release History + +## 4.0.0 (2022-10-04) +### Breaking Changes + +- Type of `GalleryImageVersionStorageProfile.Source` has been changed from `*GalleryArtifactVersionSource` to `*GalleryArtifactVersionFullSource` +- Type of `SharingProfile.CommunityGalleryInfo` has been changed from `interface{}` to `*CommunityGalleryInfo` +- Type of `VirtualMachineExtensionUpdateProperties.ProtectedSettingsFromKeyVault` has been changed from `interface{}` to `*KeyVaultSecretReference` +- Type of `GalleryOSDiskImage.Source` has been changed from `*GalleryArtifactVersionSource` to `*GalleryDiskImageSource` +- Type of `GalleryDiskImage.Source` has been changed from `*GalleryArtifactVersionSource` to `*GalleryDiskImageSource` +- Type of `GalleryDataDiskImage.Source` has been changed from `*GalleryArtifactVersionSource` to `*GalleryDiskImageSource` +- Type of `VirtualMachineScaleSetExtensionProperties.ProtectedSettingsFromKeyVault` has been changed from `interface{}` to `*KeyVaultSecretReference` +- Type of `VirtualMachineExtensionProperties.ProtectedSettingsFromKeyVault` has been changed from `interface{}` to `*KeyVaultSecretReference` +- Field `URI` of struct `GalleryArtifactVersionSource` has been removed + +### Features Added + +- New const `DiskControllerTypesSCSI` +- New const `PolicyViolationCategoryImageFlaggedUnsafe` +- New const `GalleryApplicationCustomActionParameterTypeConfigurationDataBlob` +- New const `PolicyViolationCategoryIPTheft` +- New const `PolicyViolationCategoryCopyrightValidation` +- New const `PolicyViolationCategoryOther` +- New const `GalleryApplicationCustomActionParameterTypeString` +- New const `DiskControllerTypesNVMe` +- New const `GalleryApplicationCustomActionParameterTypeLogOutputBlob` +- New type alias `DiskControllerTypes` +- New type alias `PolicyViolationCategory` +- New type alias `GalleryApplicationCustomActionParameterType` +- New function `PossiblePolicyViolationCategoryValues() []PolicyViolationCategory` +- New function `PossibleGalleryApplicationCustomActionParameterTypeValues() []GalleryApplicationCustomActionParameterType` +- New function `PossibleDiskControllerTypesValues() []DiskControllerTypes` +- New struct `GalleryApplicationCustomAction` +- New struct `GalleryApplicationCustomActionParameter` +- New struct `GalleryApplicationVersionSafetyProfile` +- New struct `GalleryArtifactSafetyProfileBase` +- New struct `GalleryArtifactVersionFullSource` +- New struct `GalleryDiskImageSource` +- New struct `GalleryImageVersionSafetyProfile` +- New struct `LatestGalleryImageVersion` +- New struct `PolicyViolation` +- New struct `PriorityMixPolicy` +- New field `DiskControllerType` in struct `VirtualMachineScaleSetUpdateStorageProfile` +- New field `HardwareProfile` in struct `VirtualMachineScaleSetUpdateVMProfile` +- New field `CustomActions` in struct `GalleryApplicationProperties` +- New field `DisableTCPStateTracking` in struct `VirtualMachineScaleSetNetworkConfigurationProperties` +- New field `DiskControllerType` in struct `StorageProfile` +- New field `OptimizedForFrequentAttach` in struct `DiskProperties` +- New field `BurstingEnabledTime` in struct `DiskProperties` +- New field `DiskControllerTypes` in struct `SupportedCapabilities` +- New field `DisableTCPStateTracking` in struct `VirtualMachineNetworkInterfaceConfigurationProperties` +- New field `EnableVMAgentPlatformUpdates` in struct `WindowsConfiguration` +- New field `PerformancePlus` in struct `CreationData` +- New field `IncrementalSnapshotFamilyID` in struct `SnapshotProperties` +- New field `OptimizedForFrequentAttach` in struct `DiskUpdateProperties` +- New field `DisableTCPStateTracking` in struct `VirtualMachineScaleSetUpdateNetworkConfigurationProperties` +- New field `ExcludeFromLatest` in struct `TargetRegion` +- New field `PrivacyStatementURI` in struct `SharedGalleryImageProperties` +- New field `Eula` in struct `SharedGalleryImageProperties` +- New field `SafetyProfile` in struct `GalleryApplicationVersionProperties` +- New field `SafetyProfile` in struct `GalleryImageVersionProperties` +- New field `EnableVMAgentPlatformUpdates` in struct `LinuxConfiguration` +- New field `CurrentCapacity` in struct `CapacityReservationUtilization` +- New field `PriorityMixPolicy` in struct `VirtualMachineScaleSetProperties` +- New field `CustomActions` in struct `GalleryApplicationVersionPublishingProfile` +- New field `PlatformFaultDomainCount` in struct `CapacityReservationProperties` +- New field `DiskControllerType` in struct `VirtualMachineScaleSetStorageProfile` + + +## 3.0.1 (2022-07-29) +### Other Changes +- Fix wrong module import for live test + +## 3.0.0 (2022-06-24) +### Breaking Changes + +- Function `*CloudServicesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, *CloudServicesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, CloudService, *CloudServicesClientBeginCreateOrUpdateOptions)` +- Function `*CloudServicesClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, *CloudServicesClientBeginUpdateOptions)` to `(context.Context, string, string, CloudServiceUpdate, *CloudServicesClientBeginUpdateOptions)` +- Function `*CloudServicesUpdateDomainClient.BeginWalkUpdateDomain` parameter(s) have been changed from `(context.Context, string, string, int32, *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions)` to `(context.Context, string, string, int32, UpdateDomain, *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions)` +- Type of `CloudServiceExtensionProperties.Settings` has been changed from `*string` to `interface{}` +- Type of `CloudServiceExtensionProperties.ProtectedSettings` has been changed from `*string` to `interface{}` +- Field `Parameters` of struct `CloudServicesClientBeginUpdateOptions` has been removed +- Field `Parameters` of struct `CloudServicesClientBeginCreateOrUpdateOptions` has been removed +- Field `Parameters` of struct `CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions` has been removed + +### Features Added + +- New const `CloudServiceSlotTypeProduction` +- New const `CloudServiceSlotTypeStaging` +- New function `*VirtualMachineImagesClient.ListByEdgeZone(context.Context, string, string, *VirtualMachineImagesClientListByEdgeZoneOptions) (VirtualMachineImagesClientListByEdgeZoneResponse, error)` +- New function `PossibleCloudServiceSlotTypeValues() []CloudServiceSlotType` +- New struct `SystemData` +- New struct `VMImagesInEdgeZoneListResult` +- New struct `VirtualMachineImagesClientListByEdgeZoneOptions` +- New struct `VirtualMachineImagesClientListByEdgeZoneResponse` +- New field `SystemData` in struct `CloudService` +- New field `SlotType` in struct `CloudServiceNetworkProfile` + + +## 2.0.0 (2022-06-02) +### Breaking Changes + +- Type of `GalleryProperties.ProvisioningState` has been changed from `*GalleryPropertiesProvisioningState` to `*GalleryProvisioningState` +- Type of `GalleryImageVersionProperties.ProvisioningState` has been changed from `*GalleryImageVersionPropertiesProvisioningState` to `*GalleryProvisioningState` +- Type of `GalleryImageProperties.ProvisioningState` has been changed from `*GalleryImagePropertiesProvisioningState` to `*GalleryProvisioningState` +- Type of `GalleryApplicationVersionProperties.ProvisioningState` has been changed from `*GalleryApplicationVersionPropertiesProvisioningState` to `*GalleryProvisioningState` +- Type of `VirtualMachineScaleSetIdentity.UserAssignedIdentities` has been changed from `map[string]*VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue` to `map[string]*UserAssignedIdentitiesValue` +- Const `GalleryImagePropertiesProvisioningStateFailed` has been removed +- Const `GalleryImagePropertiesProvisioningStateMigrating` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateCreating` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateMigrating` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateFailed` has been removed +- Const `GalleryPropertiesProvisioningStateMigrating` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateDeleting` has been removed +- Const `GalleryPropertiesProvisioningStateDeleting` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateCreating` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateSucceeded` has been removed +- Const `GalleryImagePropertiesProvisioningStateCreating` has been removed +- Const `GalleryImagePropertiesProvisioningStateUpdating` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateDeleting` has been removed +- Const `GalleryPropertiesProvisioningStateFailed` has been removed +- Const `SharingProfileGroupTypesCommunity` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateSucceeded` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateMigrating` has been removed +- Const `GalleryPropertiesProvisioningStateUpdating` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateFailed` has been removed +- Const `GalleryImagePropertiesProvisioningStateDeleting` has been removed +- Const `GalleryImageVersionPropertiesProvisioningStateUpdating` has been removed +- Const `GalleryPropertiesProvisioningStateCreating` has been removed +- Const `GalleryApplicationVersionPropertiesProvisioningStateUpdating` has been removed +- Const `GalleryImagePropertiesProvisioningStateSucceeded` has been removed +- Const `GalleryPropertiesProvisioningStateSucceeded` has been removed +- Function `PossibleGalleryPropertiesProvisioningStateValues` has been removed +- Function `PossibleGalleryImageVersionPropertiesProvisioningStateValues` has been removed +- Function `PossibleGalleryImagePropertiesProvisioningStateValues` has been removed +- Function `PossibleGalleryApplicationVersionPropertiesProvisioningStateValues` has been removed +- Struct `VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue` has been removed + +### Features Added + +- New const `GallerySharingPermissionTypesCommunity` +- New const `GalleryProvisioningStateUpdating` +- New const `SharedGalleryHostCachingReadOnly` +- New const `SharedGalleryHostCachingNone` +- New const `GalleryProvisioningStateSucceeded` +- New const `GalleryProvisioningStateFailed` +- New const `SharedGalleryHostCachingReadWrite` +- New const `GalleryProvisioningStateCreating` +- New const `DiskEncryptionSetIdentityTypeUserAssigned` +- New const `GalleryProvisioningStateMigrating` +- New const `DiskEncryptionSetIdentityTypeSystemAssignedUserAssigned` +- New const `CopyCompletionErrorReasonCopySourceNotFound` +- New const `GalleryProvisioningStateDeleting` +- New const `DiskStorageAccountTypesPremiumV2LRS` +- New function `PossibleCopyCompletionErrorReasonValues() []CopyCompletionErrorReason` +- New function `PossibleSharedGalleryHostCachingValues() []SharedGalleryHostCaching` +- New function `PossibleGalleryProvisioningStateValues() []GalleryProvisioningState` +- New function `EncryptionSetIdentity.MarshalJSON() ([]byte, error)` +- New function `*CommunityGalleryImagesClient.NewListPager(string, string, *CommunityGalleryImagesClientListOptions) *runtime.Pager[CommunityGalleryImagesClientListResponse]` +- New function `*CommunityGalleryImageVersionsClient.NewListPager(string, string, string, *CommunityGalleryImageVersionsClientListOptions) *runtime.Pager[CommunityGalleryImageVersionsClientListResponse]` +- New struct `CommunityGalleryImageList` +- New struct `CommunityGalleryImageVersionList` +- New struct `CommunityGalleryImageVersionsClientListOptions` +- New struct `CommunityGalleryImageVersionsClientListResponse` +- New struct `CommunityGalleryImagesClientListOptions` +- New struct `CommunityGalleryImagesClientListResponse` +- New struct `CopyCompletionError` +- New struct `SharedGalleryDataDiskImage` +- New struct `SharedGalleryDiskImage` +- New struct `SharedGalleryImageVersionStorageProfile` +- New struct `SharedGalleryOSDiskImage` +- New struct `UserArtifactSettings` +- New field `SharedGalleryImageID` in struct `ImageDiskReference` +- New field `CommunityGalleryImageID` in struct `ImageDiskReference` +- New field `AdvancedSettings` in struct `GalleryApplicationVersionPublishingProfile` +- New field `Settings` in struct `GalleryApplicationVersionPublishingProfile` +- New field `CopyCompletionError` in struct `SnapshotProperties` +- New field `ExcludeFromLatest` in struct `SharedGalleryImageVersionProperties` +- New field `StorageProfile` in struct `SharedGalleryImageVersionProperties` +- New field `ExcludeFromLatest` in struct `CommunityGalleryImageVersionProperties` +- New field `StorageProfile` in struct `CommunityGalleryImageVersionProperties` +- New field `Architecture` in struct `SharedGalleryImageProperties` +- New field `UserAssignedIdentities` in struct `EncryptionSetIdentity` +- New field `Eula` in struct `CommunityGalleryImageProperties` +- New field `PrivacyStatementURI` in struct `CommunityGalleryImageProperties` +- New field `Architecture` in struct `CommunityGalleryImageProperties` +- New field `FederatedClientID` in struct `DiskEncryptionSetUpdateProperties` +- New field `FederatedClientID` in struct `EncryptionSetProperties` +- New field `SecurityProfile` in struct `DiskRestorePointProperties` + + +## 1.0.0 (2022-05-16) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/README.md new file mode 100644 index 000000000..d547875ce --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/README.md @@ -0,0 +1,97 @@ +# Azure Compute Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3) + +The `armcompute` module provides operations for working with Azure Compute. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/compute/armcompute) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Compute module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Compute. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Compute modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client, err := armcompute.NewLogAnalyticsClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armcompute.NewLogAnalyticsClient(, cred, &options) +``` + +## More sample code + +- [Availability Set](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/availabilityset) +- [Virtual Machine](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/create_vm) +- [Dedicated Host](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/dedicated_host) +- [Disk](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/disk) +- [Gallery](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/gallery) +- [Proximity Placement Group](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/proximity) +- [Snapshot](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/snapshot) +- [Virtual Machine Scale Set](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/compute/vmscaleset) + +## Major Version Upgrade + +Go uses [semantic import versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning) to ensure a good backward compatibility for modules. For Azure Go management SDK, we usually upgrade module version according to cooresponding service's API version. Regarding it could be a complicated experience for major version upgrade, we will try our best to keep the SDK API stable and release new version in backward compatible way. However, if any unavoidable breaking changes and a new major version releases for SDK modules, you could use these commands under your module folder to upgrade: + +```sh +go install github.com/icholy/gomajor@latest +gomajor get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute@latest +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Compute` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/autorest.md new file mode 100644 index 000000000..3ece0fc20 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/20077475fad69cd39ee2408a9c9835bd36a53be3/specification/compute/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 4.0.0 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/availabilitysets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/availabilitysets_client.go new file mode 100644 index 000000000..3df6df4b9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/availabilitysets_client.go @@ -0,0 +1,464 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailabilitySetsClient contains the methods for the AvailabilitySets group. +// Don't use this type directly, use NewAvailabilitySetsClient() instead. +type AvailabilitySetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailabilitySetsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailabilitySetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update an availability set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// availabilitySetName - The name of the availability set. +// parameters - Parameters supplied to the Create Availability Set operation. +// options - AvailabilitySetsClientCreateOrUpdateOptions contains the optional parameters for the AvailabilitySetsClient.CreateOrUpdate +// method. +func (client *AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsClientCreateOrUpdateOptions) (AvailabilitySetsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) + if err != nil { + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if availabilitySetName == "" { + return nil, errors.New("parameter availabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availabilitySetName}", url.PathEscape(availabilitySetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *http.Response) (AvailabilitySetsClientCreateOrUpdateResponse, error) { + result := AvailabilitySetsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete an availability set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// availabilitySetName - The name of the availability set. +// options - AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method. +func (client *AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientDeleteOptions) (AvailabilitySetsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AvailabilitySetsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AvailabilitySetsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if availabilitySetName == "" { + return nil, errors.New("parameter availabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availabilitySetName}", url.PathEscape(availabilitySetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about an availability set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// availabilitySetName - The name of the availability set. +// options - AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method. +func (client *AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientGetOptions) (AvailabilitySetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if availabilitySetName == "" { + return nil, errors.New("parameter availabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availabilitySetName}", url.PathEscape(availabilitySetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (AvailabilitySetsClientGetResponse, error) { + result := AvailabilitySetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all availability sets in a resource group. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.List method. +func (client *AvailabilitySetsClient) NewListPager(resourceGroupName string, options *AvailabilitySetsClientListOptions) *runtime.Pager[AvailabilitySetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailabilitySetsClientListResponse]{ + More: func(page AvailabilitySetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailabilitySetsClientListResponse) (AvailabilitySetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailabilitySetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AvailabilitySetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailabilitySetsClient) listHandleResponse(resp *http.Response) (AvailabilitySetsClientListResponse, error) { + result := AvailabilitySetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { + return AvailabilitySetsClientListResponse{}, err + } + return result, nil +} + +// NewListAvailableSizesPager - Lists all available virtual machine sizes that can be used to create a new virtual machine +// in an existing availability set. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// availabilitySetName - The name of the availability set. +// options - AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.ListAvailableSizes +// method. +func (client *AvailabilitySetsClient) NewListAvailableSizesPager(resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientListAvailableSizesOptions) *runtime.Pager[AvailabilitySetsClientListAvailableSizesResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailabilitySetsClientListAvailableSizesResponse]{ + More: func(page AvailabilitySetsClientListAvailableSizesResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *AvailabilitySetsClientListAvailableSizesResponse) (AvailabilitySetsClientListAvailableSizesResponse, error) { + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, availabilitySetName, options) + if err != nil { + return AvailabilitySetsClientListAvailableSizesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + }) +} + +// listAvailableSizesCreateRequest creates the ListAvailableSizes request. +func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsClientListAvailableSizesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if availabilitySetName == "" { + return nil, errors.New("parameter availabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availabilitySetName}", url.PathEscape(availabilitySetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSizesHandleResponse handles the ListAvailableSizes response. +func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *http.Response) (AvailabilitySetsClientListAvailableSizesResponse, error) { + result := AvailabilitySetsClientListAvailableSizesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return AvailabilitySetsClientListAvailableSizesResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all availability sets in a subscription. +// Generated from API version 2022-08-01 +// options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.ListBySubscription +// method. +func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailabilitySetsClientListBySubscriptionResponse]{ + More: func(page AvailabilitySetsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailabilitySetsClientListBySubscriptionResponse) (AvailabilitySetsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailabilitySetsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AvailabilitySetsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *http.Response) (AvailabilitySetsClientListBySubscriptionResponse, error) { + result := AvailabilitySetsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { + return AvailabilitySetsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update an availability set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// availabilitySetName - The name of the availability set. +// parameters - Parameters supplied to the Update Availability Set operation. +// options - AvailabilitySetsClientUpdateOptions contains the optional parameters for the AvailabilitySetsClient.Update method. +func (client *AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsClientUpdateOptions) (AvailabilitySetsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) + if err != nil { + return AvailabilitySetsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailabilitySetsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if availabilitySetName == "" { + return nil, errors.New("parameter availabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availabilitySetName}", url.PathEscape(availabilitySetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *AvailabilitySetsClient) updateHandleResponse(resp *http.Response) (AvailabilitySetsClientUpdateResponse, error) { + result := AvailabilitySetsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/build.go new file mode 100644 index 000000000..f88d006f4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired resourcemanager/compute/armcompute + +package armcompute diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservationgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservationgroups_client.go new file mode 100644 index 000000000..614557862 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservationgroups_client.go @@ -0,0 +1,417 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CapacityReservationGroupsClient contains the methods for the CapacityReservationGroups group. +// Don't use this type directly, use NewCapacityReservationGroupsClient() instead. +type CapacityReservationGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapacityReservationGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CapacityReservationGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - The operation to create or update a capacity reservation group. When updating a capacity reservation group, +// only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// parameters - Parameters supplied to the Create capacity reservation Group. +// options - CapacityReservationGroupsClientCreateOrUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.CreateOrUpdate +// method. +func (client *CapacityReservationGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroup, options *CapacityReservationGroupsClientCreateOrUpdateOptions) (CapacityReservationGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroup, options *CapacityReservationGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (CapacityReservationGroupsClientCreateOrUpdateResponse, error) { + result := CapacityReservationGroupsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources +// are disassociated from the reservation group and all capacity reservations under +// the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// options - CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete +// method. +func (client *CapacityReservationGroupsClient) Delete(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsClientDeleteOptions) (CapacityReservationGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return CapacityReservationGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return CapacityReservationGroupsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation that retrieves information about a capacity reservation group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// options - CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get +// method. +func (client *CapacityReservationGroupsClient) Get(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsClientGetOptions) (CapacityReservationGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CapacityReservationGroupsClient) getHandleResponse(resp *http.Response) (CapacityReservationGroupsClientGetResponse, error) { + result := CapacityReservationGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all of the capacity reservation groups in the specified resource group. Use the nextLink +// property in the response to get the next page of capacity reservation groups. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.ListByResourceGroup +// method. +func (client *CapacityReservationGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *CapacityReservationGroupsClientListByResourceGroupOptions) *runtime.Pager[CapacityReservationGroupsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacityReservationGroupsClientListByResourceGroupResponse]{ + More: func(page CapacityReservationGroupsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacityReservationGroupsClientListByResourceGroupResponse) (CapacityReservationGroupsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CapacityReservationGroupsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CapacityReservationGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (CapacityReservationGroupsClientListByResourceGroupResponse, error) { + result := CapacityReservationGroupsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { + return CapacityReservationGroupsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all of the capacity reservation groups in the subscription. Use the nextLink property +// in the response to get the next page of capacity reservation groups. +// Generated from API version 2022-08-01 +// options - CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.ListBySubscription +// method. +func (client *CapacityReservationGroupsClient) NewListBySubscriptionPager(options *CapacityReservationGroupsClientListBySubscriptionOptions) *runtime.Pager[CapacityReservationGroupsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacityReservationGroupsClientListBySubscriptionResponse]{ + More: func(page CapacityReservationGroupsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacityReservationGroupsClientListBySubscriptionResponse) (CapacityReservationGroupsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CapacityReservationGroupsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CapacityReservationGroupsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (CapacityReservationGroupsClientListBySubscriptionResponse, error) { + result := CapacityReservationGroupsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { + return CapacityReservationGroupsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may +// be modified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// parameters - Parameters supplied to the Update capacity reservation Group operation. +// options - CapacityReservationGroupsClientUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.Update +// method. +func (client *CapacityReservationGroupsClient) Update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroupUpdate, options *CapacityReservationGroupsClientUpdateOptions) (CapacityReservationGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroupUpdate, options *CapacityReservationGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *CapacityReservationGroupsClient) updateHandleResponse(resp *http.Response) (CapacityReservationGroupsClientUpdateResponse, error) { + result := CapacityReservationGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservations_client.go new file mode 100644 index 000000000..ea05c90b1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/capacityreservations_client.go @@ -0,0 +1,406 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CapacityReservationsClient contains the methods for the CapacityReservations group. +// Don't use this type directly, use NewCapacityReservationsClient() instead. +type CapacityReservationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCapacityReservationsClient creates a new instance of CapacityReservationsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCapacityReservationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapacityReservationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CapacityReservationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set +// only during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// capacityReservationName - The name of the capacity reservation. +// parameters - Parameters supplied to the Create capacity reservation. +// options - CapacityReservationsClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginCreateOrUpdate +// method. +func (client *CapacityReservationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[CapacityReservationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CapacityReservationsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CapacityReservationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set only +// during capacity reservation creation. Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - The operation to delete a capacity reservation. This operation is allowed only when all the associated resources +// are disassociated from the capacity reservation. Please refer to +// https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// capacityReservationName - The name of the capacity reservation. +// options - CapacityReservationsClientBeginDeleteOptions contains the optional parameters for the CapacityReservationsClient.BeginDelete +// method. +func (client *CapacityReservationsClient) BeginDelete(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*runtime.Poller[CapacityReservationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CapacityReservationsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CapacityReservationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete a capacity reservation. This operation is allowed only when all the associated resources +// are disassociated from the capacity reservation. Please refer to +// https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation that retrieves information about the capacity reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// capacityReservationName - The name of the capacity reservation. +// options - CapacityReservationsClientGetOptions contains the optional parameters for the CapacityReservationsClient.Get +// method. +func (client *CapacityReservationsClient) Get(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientGetOptions) (CapacityReservationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return CapacityReservationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CapacityReservationsClient) getHandleResponse(resp *http.Response) (CapacityReservationsClientGetResponse, error) { + result := CapacityReservationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservation); err != nil { + return CapacityReservationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByCapacityReservationGroupPager - Lists all of the capacity reservations in the specified capacity reservation group. +// Use the nextLink property in the response to get the next page of capacity reservations. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// options - CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.ListByCapacityReservationGroup +// method. +func (client *CapacityReservationsClient) NewListByCapacityReservationGroupPager(resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationsClientListByCapacityReservationGroupOptions) *runtime.Pager[CapacityReservationsClientListByCapacityReservationGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacityReservationsClientListByCapacityReservationGroupResponse]{ + More: func(page CapacityReservationsClientListByCapacityReservationGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacityReservationsClientListByCapacityReservationGroupResponse) (CapacityReservationsClientListByCapacityReservationGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByCapacityReservationGroupCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CapacityReservationsClientListByCapacityReservationGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationsClientListByCapacityReservationGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationsClientListByCapacityReservationGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByCapacityReservationGroupHandleResponse(resp) + }, + }) +} + +// listByCapacityReservationGroupCreateRequest creates the ListByCapacityReservationGroup request. +func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationsClientListByCapacityReservationGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCapacityReservationGroupHandleResponse handles the ListByCapacityReservationGroup response. +func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleResponse(resp *http.Response) (CapacityReservationsClientListByCapacityReservationGroupResponse, error) { + result := CapacityReservationsClientListByCapacityReservationGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationListResult); err != nil { + return CapacityReservationsClientListByCapacityReservationGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a capacity reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// capacityReservationGroupName - The name of the capacity reservation group. +// capacityReservationName - The name of the capacity reservation. +// parameters - Parameters supplied to the Update capacity reservation operation. +// options - CapacityReservationsClientBeginUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginUpdate +// method. +func (client *CapacityReservationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*runtime.Poller[CapacityReservationsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CapacityReservationsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CapacityReservationsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update a capacity reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/ci.yml new file mode 100644 index 000000000..084ed1b49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/compute/armcompute/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/compute/armcompute/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/compute/armcompute' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceoperatingsystems_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceoperatingsystems_client.go new file mode 100644 index 000000000..aad607531 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceoperatingsystems_client.go @@ -0,0 +1,305 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudServiceOperatingSystemsClient contains the methods for the CloudServiceOperatingSystems group. +// Don't use this type directly, use NewCloudServiceOperatingSystemsClient() instead. +type CloudServiceOperatingSystemsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCloudServiceOperatingSystemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceOperatingSystemsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CloudServiceOperatingSystemsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetOSFamily - Gets properties of a guest operating system family that can be specified in the XML service configuration +// (.cscfg) for a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// location - Name of the location that the OS family pertains to. +// osFamilyName - Name of the OS family. +// options - CloudServiceOperatingSystemsClientGetOSFamilyOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSFamily +// method. +func (client *CloudServiceOperatingSystemsClient) GetOSFamily(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsClientGetOSFamilyOptions) (CloudServiceOperatingSystemsClientGetOSFamilyResponse, error) { + req, err := client.getOSFamilyCreateRequest(ctx, location, osFamilyName, options) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, runtime.NewResponseError(resp) + } + return client.getOSFamilyHandleResponse(resp) +} + +// getOSFamilyCreateRequest creates the GetOSFamily request. +func (client *CloudServiceOperatingSystemsClient) getOSFamilyCreateRequest(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsClientGetOSFamilyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if osFamilyName == "" { + return nil, errors.New("parameter osFamilyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osFamilyName}", url.PathEscape(osFamilyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOSFamilyHandleResponse handles the GetOSFamily response. +func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsClientGetOSFamilyResponse, error) { + result := CloudServiceOperatingSystemsClientGetOSFamilyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OSFamily); err != nil { + return CloudServiceOperatingSystemsClientGetOSFamilyResponse{}, err + } + return result, nil +} + +// GetOSVersion - Gets properties of a guest operating system version that can be specified in the XML service configuration +// (.cscfg) for a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// location - Name of the location that the OS version pertains to. +// osVersionName - Name of the OS version. +// options - CloudServiceOperatingSystemsClientGetOSVersionOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSVersion +// method. +func (client *CloudServiceOperatingSystemsClient) GetOSVersion(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsClientGetOSVersionOptions) (CloudServiceOperatingSystemsClientGetOSVersionResponse, error) { + req, err := client.getOSVersionCreateRequest(ctx, location, osVersionName, options) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, runtime.NewResponseError(resp) + } + return client.getOSVersionHandleResponse(resp) +} + +// getOSVersionCreateRequest creates the GetOSVersion request. +func (client *CloudServiceOperatingSystemsClient) getOSVersionCreateRequest(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsClientGetOSVersionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if osVersionName == "" { + return nil, errors.New("parameter osVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osVersionName}", url.PathEscape(osVersionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOSVersionHandleResponse handles the GetOSVersion response. +func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsClientGetOSVersionResponse, error) { + result := CloudServiceOperatingSystemsClientGetOSVersionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OSVersion); err != nil { + return CloudServiceOperatingSystemsClientGetOSVersionResponse{}, err + } + return result, nil +} + +// NewListOSFamiliesPager - Gets a list of all guest operating system families available to be specified in the XML service +// configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page +// of OS Families. Do this till nextLink is null to fetch all the OS Families. +// Generated from API version 2022-04-04 +// location - Name of the location that the OS families pertain to. +// options - CloudServiceOperatingSystemsClientListOSFamiliesOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.ListOSFamilies +// method. +func (client *CloudServiceOperatingSystemsClient) NewListOSFamiliesPager(location string, options *CloudServiceOperatingSystemsClientListOSFamiliesOptions) *runtime.Pager[CloudServiceOperatingSystemsClientListOSFamiliesResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServiceOperatingSystemsClientListOSFamiliesResponse]{ + More: func(page CloudServiceOperatingSystemsClientListOSFamiliesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServiceOperatingSystemsClientListOSFamiliesResponse) (CloudServiceOperatingSystemsClientListOSFamiliesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOSFamiliesCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServiceOperatingSystemsClientListOSFamiliesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientListOSFamiliesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsClientListOSFamiliesResponse{}, runtime.NewResponseError(resp) + } + return client.listOSFamiliesHandleResponse(resp) + }, + }) +} + +// listOSFamiliesCreateRequest creates the ListOSFamilies request. +func (client *CloudServiceOperatingSystemsClient) listOSFamiliesCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsClientListOSFamiliesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOSFamiliesHandleResponse handles the ListOSFamilies response. +func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsClientListOSFamiliesResponse, error) { + result := CloudServiceOperatingSystemsClientListOSFamiliesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OSFamilyListResult); err != nil { + return CloudServiceOperatingSystemsClientListOSFamiliesResponse{}, err + } + return result, nil +} + +// NewListOSVersionsPager - Gets a list of all guest operating system versions available to be specified in the XML service +// configuration (.cscfg) for a cloud service. Use nextLink property in the response to get the next page +// of OS versions. Do this till nextLink is null to fetch all the OS versions. +// Generated from API version 2022-04-04 +// location - Name of the location that the OS versions pertain to. +// options - CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.ListOSVersions +// method. +func (client *CloudServiceOperatingSystemsClient) NewListOSVersionsPager(location string, options *CloudServiceOperatingSystemsClientListOSVersionsOptions) *runtime.Pager[CloudServiceOperatingSystemsClientListOSVersionsResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServiceOperatingSystemsClientListOSVersionsResponse]{ + More: func(page CloudServiceOperatingSystemsClientListOSVersionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServiceOperatingSystemsClientListOSVersionsResponse) (CloudServiceOperatingSystemsClientListOSVersionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOSVersionsCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServiceOperatingSystemsClientListOSVersionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceOperatingSystemsClientListOSVersionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsClientListOSVersionsResponse{}, runtime.NewResponseError(resp) + } + return client.listOSVersionsHandleResponse(resp) + }, + }) +} + +// listOSVersionsCreateRequest creates the ListOSVersions request. +func (client *CloudServiceOperatingSystemsClient) listOSVersionsCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsClientListOSVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOSVersionsHandleResponse handles the ListOSVersions response. +func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsClientListOSVersionsResponse, error) { + result := CloudServiceOperatingSystemsClientListOSVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OSVersionListResult); err != nil { + return CloudServiceOperatingSystemsClientListOSVersionsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroleinstances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroleinstances_client.go new file mode 100644 index 000000000..489a8162e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroleinstances_client.go @@ -0,0 +1,589 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudServiceRoleInstancesClient contains the methods for the CloudServiceRoleInstances group. +// Don't use this type directly, use NewCloudServiceRoleInstancesClient() instead. +type CloudServiceRoleInstancesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCloudServiceRoleInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceRoleInstancesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CloudServiceRoleInstancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginDelete - Deletes a role instance from a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientBeginDeleteOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginDelete +// method. +func (client *CloudServiceRoleInstancesClient) BeginDelete(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginDeleteOptions) (*runtime.Poller[CloudServiceRoleInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServiceRoleInstancesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServiceRoleInstancesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a role instance from a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServiceRoleInstancesClient) deleteOperation(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CloudServiceRoleInstancesClient) deleteCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a role instance from a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientGetOptions contains the optional parameters for the CloudServiceRoleInstancesClient.Get +// method. +func (client *CloudServiceRoleInstancesClient) Get(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetOptions) (CloudServiceRoleInstancesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CloudServiceRoleInstancesClient) getCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudServiceRoleInstancesClient) getHandleResponse(resp *http.Response) (CloudServiceRoleInstancesClientGetResponse, error) { + result := CloudServiceRoleInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstance); err != nil { + return CloudServiceRoleInstancesClientGetResponse{}, err + } + return result, nil +} + +// GetInstanceView - Retrieves information about the run-time state of a role instance in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientGetInstanceViewOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetInstanceView +// method. +func (client *CloudServiceRoleInstancesClient) GetInstanceView(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetInstanceViewOptions) (CloudServiceRoleInstancesClientGetInstanceViewResponse, error) { + req, err := client.getInstanceViewCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, runtime.NewResponseError(resp) + } + return client.getInstanceViewHandleResponse(resp) +} + +// getInstanceViewCreateRequest creates the GetInstanceView request. +func (client *CloudServiceRoleInstancesClient) getInstanceViewCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInstanceViewHandleResponse handles the GetInstanceView response. +func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServiceRoleInstancesClientGetInstanceViewResponse, error) { + result := CloudServiceRoleInstancesClientGetInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceView); err != nil { + return CloudServiceRoleInstancesClientGetInstanceViewResponse{}, err + } + return result, nil +} + +// GetRemoteDesktopFile - Gets a remote desktop file for a role instance in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetRemoteDesktopFile +// method. +func (client *CloudServiceRoleInstancesClient) GetRemoteDesktopFile(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions) (CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse, error) { + req, err := client.getRemoteDesktopFileCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{}, runtime.NewResponseError(resp) + } + return CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse{Body: resp.Body}, nil +} + +// getRemoteDesktopFileCreateRequest creates the GetRemoteDesktopFile request. +func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + runtime.SkipBodyDownload(req) + req.Raw().Header["Accept"] = []string{"application/x-rdp"} + return req, nil +} + +// NewListPager - Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the +// next page of role instances. Do this till nextLink is null to fetch all the role instances. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientListOptions contains the optional parameters for the CloudServiceRoleInstancesClient.List +// method. +func (client *CloudServiceRoleInstancesClient) NewListPager(resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientListOptions) *runtime.Pager[CloudServiceRoleInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServiceRoleInstancesClientListResponse]{ + More: func(page CloudServiceRoleInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServiceRoleInstancesClientListResponse) (CloudServiceRoleInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServiceRoleInstancesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRoleInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CloudServiceRoleInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CloudServiceRoleInstancesClient) listHandleResponse(resp *http.Response) (CloudServiceRoleInstancesClientListResponse, error) { + result := CloudServiceRoleInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceListResult); err != nil { + return CloudServiceRoleInstancesClientListResponse{}, err + } + return result, nil +} + +// BeginRebuild - The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles +// or worker roles and initializes the storage resources that are used by them. If you do not +// want to initialize storage resources, you can use Reimage Role Instance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientBeginRebuildOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRebuild +// method. +func (client *CloudServiceRoleInstancesClient) BeginRebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRebuildOptions) (*runtime.Poller[CloudServiceRoleInstancesClientRebuildResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rebuild(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServiceRoleInstancesClientRebuildResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServiceRoleInstancesClientRebuildResponse](options.ResumeToken, client.pl, nil) + } +} + +// Rebuild - The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or +// worker roles and initializes the storage resources that are used by them. If you do not +// want to initialize storage resources, you can use Reimage Role Instance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServiceRoleInstancesClient) rebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRebuildOptions) (*http.Response, error) { + req, err := client.rebuildCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// rebuildCreateRequest creates the Rebuild request. +func (client *CloudServiceRoleInstancesClient) rebuildCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRebuildOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginReimage - The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles +// or worker roles. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientBeginReimageOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginReimage +// method. +func (client *CloudServiceRoleInstancesClient) BeginReimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginReimageOptions) (*runtime.Poller[CloudServiceRoleInstancesClientReimageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimage(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServiceRoleInstancesClientReimageResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServiceRoleInstancesClientReimageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reimage - The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or +// worker roles. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServiceRoleInstancesClient) reimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginReimageOptions) (*http.Response, error) { + req, err := client.reimageCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageCreateRequest creates the Reimage request. +func (client *CloudServiceRoleInstancesClient) reimageCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginReimageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRestart - The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleInstanceName - Name of the role instance. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRoleInstancesClientBeginRestartOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRestart +// method. +func (client *CloudServiceRoleInstancesClient) BeginRestart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRestartOptions) (*runtime.Poller[CloudServiceRoleInstancesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServiceRoleInstancesClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServiceRoleInstancesClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServiceRoleInstancesClient) restart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *CloudServiceRoleInstancesClient) restartCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart" + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroles_client.go new file mode 100644 index 000000000..561592977 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudserviceroles_client.go @@ -0,0 +1,187 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudServiceRolesClient contains the methods for the CloudServiceRoles group. +// Don't use this type directly, use NewCloudServiceRolesClient() instead. +type CloudServiceRolesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCloudServiceRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServiceRolesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CloudServiceRolesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a role from a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// roleName - Name of the role. +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRolesClientGetOptions contains the optional parameters for the CloudServiceRolesClient.Get method. +func (client *CloudServiceRolesClient) Get(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientGetOptions) (CloudServiceRolesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, roleName, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServiceRolesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRolesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRolesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CloudServiceRolesClient) getCreateRequest(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}" + if roleName == "" { + return nil, errors.New("parameter roleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleName}", url.PathEscape(roleName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudServiceRolesClient) getHandleResponse(resp *http.Response) (CloudServiceRolesClientGetResponse, error) { + result := CloudServiceRolesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRole); err != nil { + return CloudServiceRolesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page +// of roles. Do this till nextLink is null to fetch all the roles. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServiceRolesClientListOptions contains the optional parameters for the CloudServiceRolesClient.List method. +func (client *CloudServiceRolesClient) NewListPager(resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientListOptions) *runtime.Pager[CloudServiceRolesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServiceRolesClientListResponse]{ + More: func(page CloudServiceRolesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServiceRolesClientListResponse) (CloudServiceRolesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServiceRolesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServiceRolesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRolesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CloudServiceRolesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CloudServiceRolesClient) listHandleResponse(resp *http.Response) (CloudServiceRolesClientListResponse, error) { + result := CloudServiceRolesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRoleListResult); err != nil { + return CloudServiceRolesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservices_client.go new file mode 100644 index 000000000..957e905c9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservices_client.go @@ -0,0 +1,881 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CloudServicesClient contains the methods for the CloudServices group. +// Don't use this type directly, use NewCloudServicesClient() instead. +type CloudServicesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCloudServicesClient creates a new instance of CloudServicesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCloudServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CloudServicesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service +// creation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// parameters - The cloud service object. +// options - CloudServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudServicesClient.BeginCreateOrUpdate +// method. +func (client *CloudServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CloudServicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service creation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CloudServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudService, options *CloudServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginDeleteOptions contains the optional parameters for the CloudServicesClient.BeginDelete +// method. +func (client *CloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteOptions) (*runtime.Poller[CloudServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CloudServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteInstances - Deletes role instances in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginDeleteInstancesOptions contains the optional parameters for the CloudServicesClient.BeginDeleteInstances +// method. +func (client *CloudServicesClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteInstancesOptions) (*runtime.Poller[CloudServicesClientDeleteInstancesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteInstances(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientDeleteInstancesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientDeleteInstancesResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteInstances - Deletes role instances in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) deleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteInstancesOptions) (*http.Response, error) { + req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteInstancesCreateRequest creates the DeleteInstances request. +func (client *CloudServicesClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginDeleteInstancesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// Get - Display information about a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientGetOptions contains the optional parameters for the CloudServicesClient.Get method. +func (client *CloudServicesClient) Get(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetOptions) (CloudServicesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServicesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CloudServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CloudServicesClient) getHandleResponse(resp *http.Response) (CloudServicesClientGetResponse, error) { + result := CloudServicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudService); err != nil { + return CloudServicesClientGetResponse{}, err + } + return result, nil +} + +// GetInstanceView - Gets the status of a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientGetInstanceViewOptions contains the optional parameters for the CloudServicesClient.GetInstanceView +// method. +func (client *CloudServicesClient) GetInstanceView(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetInstanceViewOptions) (CloudServicesClientGetInstanceViewResponse, error) { + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return CloudServicesClientGetInstanceViewResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesClientGetInstanceViewResponse{}, runtime.NewResponseError(resp) + } + return client.getInstanceViewHandleResponse(resp) +} + +// getInstanceViewCreateRequest creates the GetInstanceView request. +func (client *CloudServicesClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientGetInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInstanceViewHandleResponse handles the GetInstanceView response. +func (client *CloudServicesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServicesClientGetInstanceViewResponse, error) { + result := CloudServicesClientGetInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceInstanceView); err != nil { + return CloudServicesClientGetInstanceViewResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the +// next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// options - CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.List method. +func (client *CloudServicesClient) NewListPager(resourceGroupName string, options *CloudServicesClientListOptions) *runtime.Pager[CloudServicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServicesClientListResponse]{ + More: func(page CloudServicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServicesClientListResponse) (CloudServicesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServicesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CloudServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *CloudServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CloudServicesClient) listHandleResponse(resp *http.Response) (CloudServicesClientListResponse, error) { + result := CloudServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { + return CloudServicesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use +// nextLink property in the response to get the next page of Cloud Services. Do this till nextLink +// is null to fetch all the Cloud Services. +// Generated from API version 2022-04-04 +// options - CloudServicesClientListAllOptions contains the optional parameters for the CloudServicesClient.ListAll method. +func (client *CloudServicesClient) NewListAllPager(options *CloudServicesClientListAllOptions) *runtime.Pager[CloudServicesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServicesClientListAllResponse]{ + More: func(page CloudServicesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServicesClientListAllResponse) (CloudServicesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServicesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *CloudServicesClient) listAllCreateRequest(ctx context.Context, options *CloudServicesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *CloudServicesClient) listAllHandleResponse(resp *http.Response) (CloudServicesClientListAllResponse, error) { + result := CloudServicesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { + return CloudServicesClientListAllResponse{}, err + } + return result, nil +} + +// BeginPowerOff - Power off the cloud service. Note that resources are still attached and you are getting charged for the +// resources. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginPowerOffOptions contains the optional parameters for the CloudServicesClient.BeginPowerOff +// method. +func (client *CloudServicesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginPowerOffOptions) (*runtime.Poller[CloudServicesClientPowerOffResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.powerOff(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientPowerOffResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientPowerOffResponse](options.ResumeToken, client.pl, nil) + } +} + +// PowerOff - Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) powerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginPowerOffOptions) (*http.Response, error) { + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// powerOffCreateRequest creates the PowerOff request. +func (client *CloudServicesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginPowerOffOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRebuild - Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes +// the storage resources that are used by them. If you do not want to initialize storage +// resources, you can use Reimage Role Instances. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginRebuildOptions contains the optional parameters for the CloudServicesClient.BeginRebuild +// method. +func (client *CloudServicesClient) BeginRebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRebuildOptions) (*runtime.Poller[CloudServicesClientRebuildResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rebuild(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientRebuildResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientRebuildResponse](options.ResumeToken, client.pl, nil) + } +} + +// Rebuild - Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes +// the storage resources that are used by them. If you do not want to initialize storage +// resources, you can use Reimage Role Instances. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) rebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRebuildOptions) (*http.Response, error) { + req, err := client.rebuildCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// rebuildCreateRequest creates the Rebuild request. +func (client *CloudServicesClient) rebuildCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRebuildOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginReimage - Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginReimageOptions contains the optional parameters for the CloudServicesClient.BeginReimage +// method. +func (client *CloudServicesClient) BeginReimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginReimageOptions) (*runtime.Poller[CloudServicesClientReimageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimage(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientReimageResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientReimageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reimage - Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) reimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginReimageOptions) (*http.Response, error) { + req, err := client.reimageCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageCreateRequest creates the Reimage request. +func (client *CloudServicesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginReimageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginRestart - Restarts one or more role instances in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginRestartOptions contains the optional parameters for the CloudServicesClient.BeginRestart +// method. +func (client *CloudServicesClient) BeginRestart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRestartOptions) (*runtime.Poller[CloudServicesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Restarts one or more role instances in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) restart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *CloudServicesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginStart - Starts the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesClientBeginStartOptions contains the optional parameters for the CloudServicesClient.BeginStart +// method. +func (client *CloudServicesClient) BeginStart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginStartOptions) (*runtime.Poller[CloudServicesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientStartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts the cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) start(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *CloudServicesClient) startCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// parameters - The cloud service object. +// options - CloudServicesClientBeginUpdateOptions contains the optional parameters for the CloudServicesClient.BeginUpdate +// method. +func (client *CloudServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*runtime.Poller[CloudServicesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesClient) update(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudServiceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CloudServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, parameters CloudServiceUpdate, options *CloudServicesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservicesupdatedomain_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservicesupdatedomain_client.go new file mode 100644 index 000000000..80fc3a5c0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/cloudservicesupdatedomain_client.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// CloudServicesUpdateDomainClient contains the methods for the CloudServicesUpdateDomain group. +// Don't use this type directly, use NewCloudServicesUpdateDomainClient() instead. +type CloudServicesUpdateDomainClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCloudServicesUpdateDomainClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CloudServicesUpdateDomainClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CloudServicesUpdateDomainClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// GetUpdateDomain - Gets the specified update domain of a cloud service. Use nextLink property in the response to get the +// next page of update domains. Do this till nextLink is null to fetch all the update domains. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// updateDomain - Specifies an integer value that identifies the update domain. Update domains are identified with a zero-based +// index: the first update domain has an ID of 0, the second has an ID of 1, and so on. +// options - CloudServicesUpdateDomainClientGetUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.GetUpdateDomain +// method. +func (client *CloudServicesUpdateDomainClient) GetUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainClientGetUpdateDomainOptions) (CloudServicesUpdateDomainClientGetUpdateDomainResponse, error) { + req, err := client.getUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, options) + if err != nil { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, runtime.NewResponseError(resp) + } + return client.getUpdateDomainHandleResponse(resp) +} + +// getUpdateDomainCreateRequest creates the GetUpdateDomain request. +func (client *CloudServicesUpdateDomainClient) getUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainClientGetUpdateDomainOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + urlPath = strings.ReplaceAll(urlPath, "{updateDomain}", url.PathEscape(strconv.FormatInt(int64(updateDomain), 10))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpdateDomainHandleResponse handles the GetUpdateDomain response. +func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleResponse(resp *http.Response) (CloudServicesUpdateDomainClientGetUpdateDomainResponse, error) { + result := CloudServicesUpdateDomainClientGetUpdateDomainResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomain); err != nil { + return CloudServicesUpdateDomainClientGetUpdateDomainResponse{}, err + } + return result, nil +} + +// NewListUpdateDomainsPager - Gets a list of all update domains in a cloud service. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// options - CloudServicesUpdateDomainClientListUpdateDomainsOptions contains the optional parameters for the CloudServicesUpdateDomainClient.ListUpdateDomains +// method. +func (client *CloudServicesUpdateDomainClient) NewListUpdateDomainsPager(resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainClientListUpdateDomainsOptions) *runtime.Pager[CloudServicesUpdateDomainClientListUpdateDomainsResponse] { + return runtime.NewPager(runtime.PagingHandler[CloudServicesUpdateDomainClientListUpdateDomainsResponse]{ + More: func(page CloudServicesUpdateDomainClientListUpdateDomainsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CloudServicesUpdateDomainClientListUpdateDomainsResponse) (CloudServicesUpdateDomainClientListUpdateDomainsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listUpdateDomainsCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CloudServicesUpdateDomainClientListUpdateDomainsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CloudServicesUpdateDomainClientListUpdateDomainsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesUpdateDomainClientListUpdateDomainsResponse{}, runtime.NewResponseError(resp) + } + return client.listUpdateDomainsHandleResponse(resp) + }, + }) +} + +// listUpdateDomainsCreateRequest creates the ListUpdateDomains request. +func (client *CloudServicesUpdateDomainClient) listUpdateDomainsCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainClientListUpdateDomainsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listUpdateDomainsHandleResponse handles the ListUpdateDomains response. +func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleResponse(resp *http.Response) (CloudServicesUpdateDomainClientListUpdateDomainsResponse, error) { + result := CloudServicesUpdateDomainClientListUpdateDomainsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomainListResult); err != nil { + return CloudServicesUpdateDomainClientListUpdateDomainsResponse{}, err + } + return result, nil +} + +// BeginWalkUpdateDomain - Updates the role instances in the specified update domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +// resourceGroupName - Name of the resource group. +// cloudServiceName - Name of the cloud service. +// updateDomain - Specifies an integer value that identifies the update domain. Update domains are identified with a zero-based +// index: the first update domain has an ID of 0, the second has an ID of 1, and so on. +// parameters - The update domain object. +// options - CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.BeginWalkUpdateDomain +// method. +func (client *CloudServicesUpdateDomainClient) BeginWalkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, parameters UpdateDomain, options *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions) (*runtime.Poller[CloudServicesUpdateDomainClientWalkUpdateDomainResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.walkUpdateDomain(ctx, resourceGroupName, cloudServiceName, updateDomain, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[CloudServicesUpdateDomainClientWalkUpdateDomainResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[CloudServicesUpdateDomainClientWalkUpdateDomainResponse](options.ResumeToken, client.pl, nil) + } +} + +// WalkUpdateDomain - Updates the role instances in the specified update domain. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-04 +func (client *CloudServicesUpdateDomainClient) walkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, parameters UpdateDomain, options *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions) (*http.Response, error) { + req, err := client.walkUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// walkUpdateDomainCreateRequest creates the WalkUpdateDomain request. +func (client *CloudServicesUpdateDomainClient) walkUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, parameters UpdateDomain, options *CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + urlPath = strings.ReplaceAll(urlPath, "{updateDomain}", url.PathEscape(strconv.FormatInt(int64(updateDomain), 10))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-04") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleries_client.go new file mode 100644 index 000000000..6430d1261 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleries_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleriesClient contains the methods for the CommunityGalleries group. +// Don't use this type directly, use NewCommunityGalleriesClient() instead. +type CommunityGalleriesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCommunityGalleriesClient creates a new instance of CommunityGalleriesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCommunityGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleriesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CommunityGalleriesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a community gallery by gallery public name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// publicGalleryName - The public name of the community gallery. +// options - CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method. +func (client *CommunityGalleriesClient) Get(ctx context.Context, location string, publicGalleryName string, options *CommunityGalleriesClientGetOptions) (CommunityGalleriesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, options) + if err != nil { + return CommunityGalleriesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleriesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleriesClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, options *CommunityGalleriesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleriesClient) getHandleResponse(resp *http.Response) (CommunityGalleriesClientGetResponse, error) { + result := CommunityGalleriesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGallery); err != nil { + return CommunityGalleriesClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimages_client.go new file mode 100644 index 000000000..23753e2d0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimages_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleryImagesClient contains the methods for the CommunityGalleryImages group. +// Don't use this type directly, use NewCommunityGalleryImagesClient() instead. +type CommunityGalleryImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCommunityGalleryImagesClient creates a new instance of CommunityGalleryImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCommunityGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleryImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CommunityGalleryImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a community gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// publicGalleryName - The public name of the community gallery. +// galleryImageName - The name of the community gallery image definition. +// options - CommunityGalleryImagesClientGetOptions contains the optional parameters for the CommunityGalleryImagesClient.Get +// method. +func (client *CommunityGalleryImagesClient) Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImagesClientGetOptions) (CommunityGalleryImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, options) + if err != nil { + return CommunityGalleryImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleryImagesClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleryImagesClient) getHandleResponse(resp *http.Response) (CommunityGalleryImagesClientGetResponse, error) { + result := CommunityGalleryImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImage); err != nil { + return CommunityGalleryImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List community gallery images inside a gallery. +// Generated from API version 2022-03-03 +// location - Resource location. +// publicGalleryName - The public name of the community gallery. +// options - CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.List +// method. +func (client *CommunityGalleryImagesClient) NewListPager(location string, publicGalleryName string, options *CommunityGalleryImagesClientListOptions) *runtime.Pager[CommunityGalleryImagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CommunityGalleryImagesClientListResponse]{ + More: func(page CommunityGalleryImagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CommunityGalleryImagesClientListResponse) (CommunityGalleryImagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, publicGalleryName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CommunityGalleryImagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CommunityGalleryImagesClient) listCreateRequest(ctx context.Context, location string, publicGalleryName string, options *CommunityGalleryImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CommunityGalleryImagesClient) listHandleResponse(resp *http.Response) (CommunityGalleryImagesClientListResponse, error) { + result := CommunityGalleryImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImageList); err != nil { + return CommunityGalleryImagesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimageversions_client.go new file mode 100644 index 000000000..fef38441b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/communitygalleryimageversions_client.go @@ -0,0 +1,200 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleryImageVersionsClient contains the methods for the CommunityGalleryImageVersions group. +// Don't use this type directly, use NewCommunityGalleryImageVersionsClient() instead. +type CommunityGalleryImageVersionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCommunityGalleryImageVersionsClient creates a new instance of CommunityGalleryImageVersionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCommunityGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunityGalleryImageVersionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CommunityGalleryImageVersionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a community gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// publicGalleryName - The public name of the community gallery. +// galleryImageName - The name of the community gallery image definition. +// galleryImageVersionName - The name of the community gallery image version. Needs to follow semantic version name pattern: +// The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. +// Format: .. +// options - CommunityGalleryImageVersionsClientGetOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.Get +// method. +func (client *CommunityGalleryImageVersionsClient) Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *CommunityGalleryImageVersionsClientGetOptions) (CommunityGalleryImageVersionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImageVersionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleryImageVersionsClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *CommunityGalleryImageVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleryImageVersionsClient) getHandleResponse(resp *http.Response) (CommunityGalleryImageVersionsClientGetResponse, error) { + result := CommunityGalleryImageVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImageVersion); err != nil { + return CommunityGalleryImageVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List community gallery image versions inside an image. +// Generated from API version 2022-03-03 +// location - Resource location. +// publicGalleryName - The public name of the community gallery. +// galleryImageName - The name of the community gallery image definition. +// options - CommunityGalleryImageVersionsClientListOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.List +// method. +func (client *CommunityGalleryImageVersionsClient) NewListPager(location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImageVersionsClientListOptions) *runtime.Pager[CommunityGalleryImageVersionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CommunityGalleryImageVersionsClientListResponse]{ + More: func(page CommunityGalleryImageVersionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CommunityGalleryImageVersionsClientListResponse) (CommunityGalleryImageVersionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, publicGalleryName, galleryImageName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CommunityGalleryImageVersionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImageVersionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImageVersionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CommunityGalleryImageVersionsClient) listCreateRequest(ctx context.Context, location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImageVersionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CommunityGalleryImageVersionsClient) listHandleResponse(resp *http.Response) (CommunityGalleryImageVersionsClientListResponse, error) { + result := CommunityGalleryImageVersionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImageVersionList); err != nil { + return CommunityGalleryImageVersionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/constants.go new file mode 100644 index 000000000..df1e6e5bb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/constants.go @@ -0,0 +1,2545 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +const ( + moduleName = "armcompute" + moduleVersion = "v4.0.0" +) + +type AccessLevel string + +const ( + AccessLevelNone AccessLevel = "None" + AccessLevelRead AccessLevel = "Read" + AccessLevelWrite AccessLevel = "Write" +) + +// PossibleAccessLevelValues returns the possible values for the AccessLevel const type. +func PossibleAccessLevelValues() []AccessLevel { + return []AccessLevel{ + AccessLevelNone, + AccessLevelRead, + AccessLevelWrite, + } +} + +// AggregatedReplicationState - This is the aggregated replication status based on all the regional replication status flags. +type AggregatedReplicationState string + +const ( + AggregatedReplicationStateCompleted AggregatedReplicationState = "Completed" + AggregatedReplicationStateFailed AggregatedReplicationState = "Failed" + AggregatedReplicationStateInProgress AggregatedReplicationState = "InProgress" + AggregatedReplicationStateUnknown AggregatedReplicationState = "Unknown" +) + +// PossibleAggregatedReplicationStateValues returns the possible values for the AggregatedReplicationState const type. +func PossibleAggregatedReplicationStateValues() []AggregatedReplicationState { + return []AggregatedReplicationState{ + AggregatedReplicationStateCompleted, + AggregatedReplicationStateFailed, + AggregatedReplicationStateInProgress, + AggregatedReplicationStateUnknown, + } +} + +// Architecture - The architecture of the image. Applicable to OS disks only. +type Architecture string + +const ( + ArchitectureArm64 Architecture = "Arm64" + ArchitectureX64 Architecture = "x64" +) + +// PossibleArchitectureValues returns the possible values for the Architecture const type. +func PossibleArchitectureValues() []Architecture { + return []Architecture{ + ArchitectureArm64, + ArchitectureX64, + } +} + +// ArchitectureTypes - Specifies the Architecture Type +type ArchitectureTypes string + +const ( + ArchitectureTypesArm64 ArchitectureTypes = "Arm64" + ArchitectureTypesX64 ArchitectureTypes = "x64" +) + +// PossibleArchitectureTypesValues returns the possible values for the ArchitectureTypes const type. +func PossibleArchitectureTypesValues() []ArchitectureTypes { + return []ArchitectureTypes{ + ArchitectureTypesArm64, + ArchitectureTypesX64, + } +} + +// AvailabilitySetSKUTypes - Specifies the sku of an Availability Set. Use 'Aligned' for virtual machines with managed disks +// and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. +type AvailabilitySetSKUTypes string + +const ( + AvailabilitySetSKUTypesAligned AvailabilitySetSKUTypes = "Aligned" + AvailabilitySetSKUTypesClassic AvailabilitySetSKUTypes = "Classic" +) + +// PossibleAvailabilitySetSKUTypesValues returns the possible values for the AvailabilitySetSKUTypes const type. +func PossibleAvailabilitySetSKUTypesValues() []AvailabilitySetSKUTypes { + return []AvailabilitySetSKUTypes{ + AvailabilitySetSKUTypesAligned, + AvailabilitySetSKUTypesClassic, + } +} + +// CachingTypes - Specifies the caching requirements. +// Possible values are: +// None +// ReadOnly +// ReadWrite +// Default: None for Standard storage. ReadOnly for Premium storage +type CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +// PossibleCachingTypesValues returns the possible values for the CachingTypes const type. +func PossibleCachingTypesValues() []CachingTypes { + return []CachingTypes{ + CachingTypesNone, + CachingTypesReadOnly, + CachingTypesReadWrite, + } +} + +type CapacityReservationGroupInstanceViewTypes string + +const ( + CapacityReservationGroupInstanceViewTypesInstanceView CapacityReservationGroupInstanceViewTypes = "instanceView" +) + +// PossibleCapacityReservationGroupInstanceViewTypesValues returns the possible values for the CapacityReservationGroupInstanceViewTypes const type. +func PossibleCapacityReservationGroupInstanceViewTypesValues() []CapacityReservationGroupInstanceViewTypes { + return []CapacityReservationGroupInstanceViewTypes{ + CapacityReservationGroupInstanceViewTypesInstanceView, + } +} + +type CapacityReservationInstanceViewTypes string + +const ( + CapacityReservationInstanceViewTypesInstanceView CapacityReservationInstanceViewTypes = "instanceView" +) + +// PossibleCapacityReservationInstanceViewTypesValues returns the possible values for the CapacityReservationInstanceViewTypes const type. +func PossibleCapacityReservationInstanceViewTypesValues() []CapacityReservationInstanceViewTypes { + return []CapacityReservationInstanceViewTypes{ + CapacityReservationInstanceViewTypesInstanceView, + } +} + +// CloudServiceSlotType - Slot type for the cloud service. Possible values are +// Production +// Staging +// If not specified, the default value is Production. +type CloudServiceSlotType string + +const ( + CloudServiceSlotTypeProduction CloudServiceSlotType = "Production" + CloudServiceSlotTypeStaging CloudServiceSlotType = "Staging" +) + +// PossibleCloudServiceSlotTypeValues returns the possible values for the CloudServiceSlotType const type. +func PossibleCloudServiceSlotTypeValues() []CloudServiceSlotType { + return []CloudServiceSlotType{ + CloudServiceSlotTypeProduction, + CloudServiceSlotTypeStaging, + } +} + +// CloudServiceUpgradeMode - Update mode for the cloud service. Role instances are allocated to update domains when the service +// is deployed. Updates can be initiated manually in each update domain or initiated automatically in +// all update domains. Possible Values are +// Auto +// Manual +// Simultaneous +// If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If +// set to Auto, the update is automatically applied to each update domain in +// sequence. +type CloudServiceUpgradeMode string + +const ( + CloudServiceUpgradeModeAuto CloudServiceUpgradeMode = "Auto" + CloudServiceUpgradeModeManual CloudServiceUpgradeMode = "Manual" + CloudServiceUpgradeModeSimultaneous CloudServiceUpgradeMode = "Simultaneous" +) + +// PossibleCloudServiceUpgradeModeValues returns the possible values for the CloudServiceUpgradeMode const type. +func PossibleCloudServiceUpgradeModeValues() []CloudServiceUpgradeMode { + return []CloudServiceUpgradeMode{ + CloudServiceUpgradeModeAuto, + CloudServiceUpgradeModeManual, + CloudServiceUpgradeModeSimultaneous, + } +} + +// ConfidentialVMEncryptionType - confidential VM encryption types +type ConfidentialVMEncryptionType string + +const ( + ConfidentialVMEncryptionTypeEncryptedVMGuestStateOnlyWithPmk ConfidentialVMEncryptionType = "EncryptedVMGuestStateOnlyWithPmk" + ConfidentialVMEncryptionTypeEncryptedWithCmk ConfidentialVMEncryptionType = "EncryptedWithCmk" + ConfidentialVMEncryptionTypeEncryptedWithPmk ConfidentialVMEncryptionType = "EncryptedWithPmk" +) + +// PossibleConfidentialVMEncryptionTypeValues returns the possible values for the ConfidentialVMEncryptionType const type. +func PossibleConfidentialVMEncryptionTypeValues() []ConfidentialVMEncryptionType { + return []ConfidentialVMEncryptionType{ + ConfidentialVMEncryptionTypeEncryptedVMGuestStateOnlyWithPmk, + ConfidentialVMEncryptionTypeEncryptedWithCmk, + ConfidentialVMEncryptionTypeEncryptedWithPmk, + } +} + +// ConsistencyModeTypes - ConsistencyMode of the RestorePoint. Can be specified in the input while creating a restore point. +// For now, only CrashConsistent is accepted as a valid input. Please refer to +// https://aka.ms/RestorePoints for more details. +type ConsistencyModeTypes string + +const ( + ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent" + ConsistencyModeTypesCrashConsistent ConsistencyModeTypes = "CrashConsistent" + ConsistencyModeTypesFileSystemConsistent ConsistencyModeTypes = "FileSystemConsistent" +) + +// PossibleConsistencyModeTypesValues returns the possible values for the ConsistencyModeTypes const type. +func PossibleConsistencyModeTypesValues() []ConsistencyModeTypes { + return []ConsistencyModeTypes{ + ConsistencyModeTypesApplicationConsistent, + ConsistencyModeTypesCrashConsistent, + ConsistencyModeTypesFileSystemConsistent, + } +} + +// CopyCompletionErrorReason - Indicates the error code if the background copy of a resource created via the CopyStart operation +// fails. +type CopyCompletionErrorReason string + +const ( + // CopyCompletionErrorReasonCopySourceNotFound - Indicates that the source snapshot was deleted while the background copy + // of the resource created via CopyStart operation was in progress. + CopyCompletionErrorReasonCopySourceNotFound CopyCompletionErrorReason = "CopySourceNotFound" +) + +// PossibleCopyCompletionErrorReasonValues returns the possible values for the CopyCompletionErrorReason const type. +func PossibleCopyCompletionErrorReasonValues() []CopyCompletionErrorReason { + return []CopyCompletionErrorReason{ + CopyCompletionErrorReasonCopySourceNotFound, + } +} + +// DataAccessAuthMode - Additional authentication requirements when exporting or uploading to a disk or snapshot. +type DataAccessAuthMode string + +const ( + // DataAccessAuthModeAzureActiveDirectory - When export/upload URL is used, the system checks if the user has an identity + // in Azure Active Directory and has necessary permissions to export/upload the data. Please refer to aka.ms/DisksAzureADAuth. + DataAccessAuthModeAzureActiveDirectory DataAccessAuthMode = "AzureActiveDirectory" + // DataAccessAuthModeNone - No additional authentication would be performed when accessing export/upload URL. + DataAccessAuthModeNone DataAccessAuthMode = "None" +) + +// PossibleDataAccessAuthModeValues returns the possible values for the DataAccessAuthMode const type. +func PossibleDataAccessAuthModeValues() []DataAccessAuthMode { + return []DataAccessAuthMode{ + DataAccessAuthModeAzureActiveDirectory, + DataAccessAuthModeNone, + } +} + +// DedicatedHostLicenseTypes - Specifies the software license type that will be applied to the VMs deployed on the dedicated +// host. +// Possible values are: +// None +// WindowsServerHybrid +// WindowsServerPerpetual +// Default: None +type DedicatedHostLicenseTypes string + +const ( + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" +) + +// PossibleDedicatedHostLicenseTypesValues returns the possible values for the DedicatedHostLicenseTypes const type. +func PossibleDedicatedHostLicenseTypesValues() []DedicatedHostLicenseTypes { + return []DedicatedHostLicenseTypes{ + DedicatedHostLicenseTypesNone, + DedicatedHostLicenseTypesWindowsServerHybrid, + DedicatedHostLicenseTypesWindowsServerPerpetual, + } +} + +// DeleteOptions - Specify what happens to the network interface when the VM is deleted +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +// PossibleDeleteOptionsValues returns the possible values for the DeleteOptions const type. +func PossibleDeleteOptionsValues() []DeleteOptions { + return []DeleteOptions{ + DeleteOptionsDelete, + DeleteOptionsDetach, + } +} + +// DiffDiskOptions - Specifies the ephemeral disk option for operating system disk. +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +// PossibleDiffDiskOptionsValues returns the possible values for the DiffDiskOptions const type. +func PossibleDiffDiskOptionsValues() []DiffDiskOptions { + return []DiffDiskOptions{ + DiffDiskOptionsLocal, + } +} + +// DiffDiskPlacement - Specifies the ephemeral disk placement for operating system disk. This property can be used by user +// in the request to choose the location i.e, cache disk or resource disk space for Ephemeral OS disk +// provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS disk size requirements +// for Windows VM at +// https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at +// https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +// PossibleDiffDiskPlacementValues returns the possible values for the DiffDiskPlacement const type. +func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { + return []DiffDiskPlacement{ + DiffDiskPlacementCacheDisk, + DiffDiskPlacementResourceDisk, + } +} + +// DiskControllerTypes - Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property +// is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 +// (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned +// as part of VM sku capabilities in the response of Microsoft.Compute SKUs +// api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . +// For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes. +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +// PossibleDiskControllerTypesValues returns the possible values for the DiskControllerTypes const type. +func PossibleDiskControllerTypesValues() []DiskControllerTypes { + return []DiskControllerTypes{ + DiskControllerTypesNVMe, + DiskControllerTypesSCSI, + } +} + +// DiskCreateOption - This enumerates the possible sources of a disk's creation. +type DiskCreateOption string + +const ( + // DiskCreateOptionAttach - Disk will be attached to a VM. + DiskCreateOptionAttach DiskCreateOption = "Attach" + // DiskCreateOptionCopy - Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId. + DiskCreateOptionCopy DiskCreateOption = "Copy" + // DiskCreateOptionCopyStart - Create a new disk by using a deep copy process, where the resource creation is considered complete + // only after all data has been copied from the source. + DiskCreateOptionCopyStart DiskCreateOption = "CopyStart" + // DiskCreateOptionEmpty - Create an empty data disk of a size given by diskSizeGB. + DiskCreateOptionEmpty DiskCreateOption = "Empty" + // DiskCreateOptionFromImage - Create a new disk from a platform image specified by the given imageReference or galleryImageReference. + DiskCreateOptionFromImage DiskCreateOption = "FromImage" + // DiskCreateOptionImport - Create a disk by importing from a blob specified by a sourceUri in a storage account specified + // by storageAccountId. + DiskCreateOptionImport DiskCreateOption = "Import" + // DiskCreateOptionImportSecure - Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported + // disk by importing additional blob for VM guest state specified by securityDataUri in storage account specified by storageAccountId + DiskCreateOptionImportSecure DiskCreateOption = "ImportSecure" + // DiskCreateOptionRestore - Create a new disk by copying from a backup recovery point. + DiskCreateOptionRestore DiskCreateOption = "Restore" + // DiskCreateOptionUpload - Create a new disk by obtaining a write token and using it to directly upload the contents of the + // disk. + DiskCreateOptionUpload DiskCreateOption = "Upload" + // DiskCreateOptionUploadPreparedSecure - Similar to Upload create option. Create a new Trusted Launch VM or Confidential + // VM supported disk and upload using write token in both disk and VM guest state + DiskCreateOptionUploadPreparedSecure DiskCreateOption = "UploadPreparedSecure" +) + +// PossibleDiskCreateOptionValues returns the possible values for the DiskCreateOption const type. +func PossibleDiskCreateOptionValues() []DiskCreateOption { + return []DiskCreateOption{ + DiskCreateOptionAttach, + DiskCreateOptionCopy, + DiskCreateOptionCopyStart, + DiskCreateOptionEmpty, + DiskCreateOptionFromImage, + DiskCreateOptionImport, + DiskCreateOptionImportSecure, + DiskCreateOptionRestore, + DiskCreateOptionUpload, + DiskCreateOptionUploadPreparedSecure, + } +} + +// DiskCreateOptionTypes - Specifies how the virtual machine should be created. +// Possible values are: +// Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. +// FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform +// image, you also use the imageReference element described above. If you are +// using a marketplace image, you also use the plan element previously described. +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" +) + +// PossibleDiskCreateOptionTypesValues returns the possible values for the DiskCreateOptionTypes const type. +func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { + return []DiskCreateOptionTypes{ + DiskCreateOptionTypesAttach, + DiskCreateOptionTypesEmpty, + DiskCreateOptionTypesFromImage, + } +} + +// DiskDeleteOptionTypes - Specifies the behavior of the managed disk when the VM gets deleted i.e whether the managed disk +// is deleted or detached. Supported values: +// Delete If this value is used, the managed disk is deleted when VM gets deleted. +// Detach If this value is used, the managed disk is retained after VM gets deleted. +// Minimum api-version: 2021-03-01 +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +// PossibleDiskDeleteOptionTypesValues returns the possible values for the DiskDeleteOptionTypes const type. +func PossibleDiskDeleteOptionTypesValues() []DiskDeleteOptionTypes { + return []DiskDeleteOptionTypes{ + DiskDeleteOptionTypesDelete, + DiskDeleteOptionTypesDetach, + } +} + +// DiskDetachOptionTypes - Specifies the detach behavior to be used while detaching a disk or which is already in the process +// of detachment from the virtual machine. Supported values: ForceDetach. +// detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk +// did not complete due to an unexpected failure from the virtual machine and the +// disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes +// might not have been flushed when using this detach behavior. +// This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update +// toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +// PossibleDiskDetachOptionTypesValues returns the possible values for the DiskDetachOptionTypes const type. +func PossibleDiskDetachOptionTypesValues() []DiskDetachOptionTypes { + return []DiskDetachOptionTypes{ + DiskDetachOptionTypesForceDetach, + } +} + +// DiskEncryptionSetIdentityType - The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported +// for new creations. Disk Encryption Sets can be updated with Identity type None during migration of +// subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. +type DiskEncryptionSetIdentityType string + +const ( + DiskEncryptionSetIdentityTypeNone DiskEncryptionSetIdentityType = "None" + DiskEncryptionSetIdentityTypeSystemAssigned DiskEncryptionSetIdentityType = "SystemAssigned" + DiskEncryptionSetIdentityTypeSystemAssignedUserAssigned DiskEncryptionSetIdentityType = "SystemAssigned, UserAssigned" + DiskEncryptionSetIdentityTypeUserAssigned DiskEncryptionSetIdentityType = "UserAssigned" +) + +// PossibleDiskEncryptionSetIdentityTypeValues returns the possible values for the DiskEncryptionSetIdentityType const type. +func PossibleDiskEncryptionSetIdentityTypeValues() []DiskEncryptionSetIdentityType { + return []DiskEncryptionSetIdentityType{ + DiskEncryptionSetIdentityTypeNone, + DiskEncryptionSetIdentityTypeSystemAssigned, + DiskEncryptionSetIdentityTypeSystemAssignedUserAssigned, + DiskEncryptionSetIdentityTypeUserAssigned, + } +} + +// DiskEncryptionSetType - The type of key used to encrypt the data of the disk. +type DiskEncryptionSetType string + +const ( + // DiskEncryptionSetTypeConfidentialVMEncryptedWithCustomerKey - Confidential VM supported disk and VM guest state would be + // encrypted with customer managed key. + DiskEncryptionSetTypeConfidentialVMEncryptedWithCustomerKey DiskEncryptionSetType = "ConfidentialVmEncryptedWithCustomerKey" + // DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey - Resource using diskEncryptionSet would be encrypted at rest with + // Customer managed key that can be changed and revoked by a customer. + DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey DiskEncryptionSetType = "EncryptionAtRestWithCustomerKey" + // DiskEncryptionSetTypeEncryptionAtRestWithPlatformAndCustomerKeys - Resource using diskEncryptionSet would be encrypted + // at rest with two layers of encryption. One of the keys is Customer managed and the other key is Platform managed. + DiskEncryptionSetTypeEncryptionAtRestWithPlatformAndCustomerKeys DiskEncryptionSetType = "EncryptionAtRestWithPlatformAndCustomerKeys" +) + +// PossibleDiskEncryptionSetTypeValues returns the possible values for the DiskEncryptionSetType const type. +func PossibleDiskEncryptionSetTypeValues() []DiskEncryptionSetType { + return []DiskEncryptionSetType{ + DiskEncryptionSetTypeConfidentialVMEncryptedWithCustomerKey, + DiskEncryptionSetTypeEncryptionAtRestWithCustomerKey, + DiskEncryptionSetTypeEncryptionAtRestWithPlatformAndCustomerKeys, + } +} + +// DiskSecurityTypes - Specifies the SecurityType of the VM. Applicable for OS disks only. +type DiskSecurityTypes string + +const ( + // DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey - Indicates Confidential VM disk with both OS disk and VM guest + // state encrypted with a customer managed key + DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey DiskSecurityTypes = "ConfidentialVM_DiskEncryptedWithCustomerKey" + // DiskSecurityTypesConfidentialVMDiskEncryptedWithPlatformKey - Indicates Confidential VM disk with both OS disk and VM guest + // state encrypted with a platform managed key + DiskSecurityTypesConfidentialVMDiskEncryptedWithPlatformKey DiskSecurityTypes = "ConfidentialVM_DiskEncryptedWithPlatformKey" + // DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey - Indicates Confidential VM disk with only VM guest + // state encrypted + DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey DiskSecurityTypes = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey" + // DiskSecurityTypesTrustedLaunch - Trusted Launch provides security features such as secure boot and virtual Trusted Platform + // Module (vTPM) + DiskSecurityTypesTrustedLaunch DiskSecurityTypes = "TrustedLaunch" +) + +// PossibleDiskSecurityTypesValues returns the possible values for the DiskSecurityTypes const type. +func PossibleDiskSecurityTypesValues() []DiskSecurityTypes { + return []DiskSecurityTypes{ + DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey, + DiskSecurityTypesConfidentialVMDiskEncryptedWithPlatformKey, + DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey, + DiskSecurityTypesTrustedLaunch, + } +} + +// DiskState - This enumerates the possible state of the disk. +type DiskState string + +const ( + // DiskStateActiveSAS - The disk currently has an Active SAS Uri associated with it. + DiskStateActiveSAS DiskState = "ActiveSAS" + // DiskStateActiveSASFrozen - The disk is attached to a VM in hibernated state and has an active SAS URI associated with it. + DiskStateActiveSASFrozen DiskState = "ActiveSASFrozen" + // DiskStateActiveUpload - A disk is created for upload and a write token has been issued for uploading to it. + DiskStateActiveUpload DiskState = "ActiveUpload" + // DiskStateAttached - The disk is currently attached to a running VM. + DiskStateAttached DiskState = "Attached" + // DiskStateFrozen - The disk is attached to a VM which is in hibernated state. + DiskStateFrozen DiskState = "Frozen" + // DiskStateReadyToUpload - A disk is ready to be created by upload by requesting a write token. + DiskStateReadyToUpload DiskState = "ReadyToUpload" + // DiskStateReserved - The disk is attached to a stopped-deallocated VM. + DiskStateReserved DiskState = "Reserved" + // DiskStateUnattached - The disk is not being used and can be attached to a VM. + DiskStateUnattached DiskState = "Unattached" +) + +// PossibleDiskStateValues returns the possible values for the DiskState const type. +func PossibleDiskStateValues() []DiskState { + return []DiskState{ + DiskStateActiveSAS, + DiskStateActiveSASFrozen, + DiskStateActiveUpload, + DiskStateAttached, + DiskStateFrozen, + DiskStateReadyToUpload, + DiskStateReserved, + DiskStateUnattached, + } +} + +// DiskStorageAccountTypes - The sku name. +type DiskStorageAccountTypes string + +const ( + // DiskStorageAccountTypesPremiumLRS - Premium SSD locally redundant storage. Best for production and performance sensitive + // workloads. + DiskStorageAccountTypesPremiumLRS DiskStorageAccountTypes = "Premium_LRS" + // DiskStorageAccountTypesPremiumV2LRS - Premium SSD v2 locally redundant storage. Best for production and performance-sensitive + // workloads that consistently require low latency and high IOPS and throughput. + DiskStorageAccountTypesPremiumV2LRS DiskStorageAccountTypes = "PremiumV2_LRS" + // DiskStorageAccountTypesPremiumZRS - Premium SSD zone redundant storage. Best for the production workloads that need storage + // resiliency against zone failures. + DiskStorageAccountTypesPremiumZRS DiskStorageAccountTypes = "Premium_ZRS" + // DiskStorageAccountTypesStandardLRS - Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent + // access. + DiskStorageAccountTypesStandardLRS DiskStorageAccountTypes = "Standard_LRS" + // DiskStorageAccountTypesStandardSSDLRS - Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + // applications and dev/test. + DiskStorageAccountTypesStandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS" + // DiskStorageAccountTypesStandardSSDZRS - Standard SSD zone redundant storage. Best for web servers, lightly used enterprise + // applications and dev/test that need storage resiliency against zone failures. + DiskStorageAccountTypesStandardSSDZRS DiskStorageAccountTypes = "StandardSSD_ZRS" + // DiskStorageAccountTypesUltraSSDLRS - Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, + // top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. + DiskStorageAccountTypesUltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS" +) + +// PossibleDiskStorageAccountTypesValues returns the possible values for the DiskStorageAccountTypes const type. +func PossibleDiskStorageAccountTypesValues() []DiskStorageAccountTypes { + return []DiskStorageAccountTypes{ + DiskStorageAccountTypesPremiumLRS, + DiskStorageAccountTypesPremiumV2LRS, + DiskStorageAccountTypesPremiumZRS, + DiskStorageAccountTypesStandardLRS, + DiskStorageAccountTypesStandardSSDLRS, + DiskStorageAccountTypesStandardSSDZRS, + DiskStorageAccountTypesUltraSSDLRS, + } +} + +// EncryptionType - The type of key used to encrypt the data of the disk. +type EncryptionType string + +const ( + // EncryptionTypeEncryptionAtRestWithCustomerKey - Disk is encrypted at rest with Customer managed key that can be changed + // and revoked by a customer. + EncryptionTypeEncryptionAtRestWithCustomerKey EncryptionType = "EncryptionAtRestWithCustomerKey" + // EncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys - Disk is encrypted at rest with 2 layers of encryption. One + // of the keys is Customer managed and the other key is Platform managed. + EncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys EncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + // EncryptionTypeEncryptionAtRestWithPlatformKey - Disk is encrypted at rest with Platform managed key. It is the default + // encryption type. This is not a valid encryption type for disk encryption sets. + EncryptionTypeEncryptionAtRestWithPlatformKey EncryptionType = "EncryptionAtRestWithPlatformKey" +) + +// PossibleEncryptionTypeValues returns the possible values for the EncryptionType const type. +func PossibleEncryptionTypeValues() []EncryptionType { + return []EncryptionType{ + EncryptionTypeEncryptionAtRestWithCustomerKey, + EncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + EncryptionTypeEncryptionAtRestWithPlatformKey, + } +} + +// ExecutionState - Script execution status. +type ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +// PossibleExecutionStateValues returns the possible values for the ExecutionState const type. +func PossibleExecutionStateValues() []ExecutionState { + return []ExecutionState{ + ExecutionStateCanceled, + ExecutionStateFailed, + ExecutionStatePending, + ExecutionStateRunning, + ExecutionStateSucceeded, + ExecutionStateTimedOut, + ExecutionStateUnknown, + } +} + +type ExpandTypesForGetCapacityReservationGroups string + +const ( + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef ExpandTypesForGetCapacityReservationGroups = "virtualMachineScaleSetVMs/$ref" + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef ExpandTypesForGetCapacityReservationGroups = "virtualMachines/$ref" +) + +// PossibleExpandTypesForGetCapacityReservationGroupsValues returns the possible values for the ExpandTypesForGetCapacityReservationGroups const type. +func PossibleExpandTypesForGetCapacityReservationGroupsValues() []ExpandTypesForGetCapacityReservationGroups { + return []ExpandTypesForGetCapacityReservationGroups{ + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef, + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef, + } +} + +type ExpandTypesForGetVMScaleSets string + +const ( + ExpandTypesForGetVMScaleSetsUserData ExpandTypesForGetVMScaleSets = "userData" +) + +// PossibleExpandTypesForGetVMScaleSetsValues returns the possible values for the ExpandTypesForGetVMScaleSets const type. +func PossibleExpandTypesForGetVMScaleSetsValues() []ExpandTypesForGetVMScaleSets { + return []ExpandTypesForGetVMScaleSets{ + ExpandTypesForGetVMScaleSetsUserData, + } +} + +// ExtendedLocationType - The type of the extended location. +type ExtendedLocationType string + +const ( + ExtendedLocationTypeEdgeZone ExtendedLocationType = "EdgeZone" +) + +// PossibleExtendedLocationTypeValues returns the possible values for the ExtendedLocationType const type. +func PossibleExtendedLocationTypeValues() []ExtendedLocationType { + return []ExtendedLocationType{ + ExtendedLocationTypeEdgeZone, + } +} + +// ExtendedLocationTypes - The type of extendedLocation. +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesEdgeZone, + } +} + +// GalleryApplicationCustomActionParameterType - Specifies the type of the custom action parameter. Possible values are: String, +// ConfigurationDataBlob or LogOutputBlob +type GalleryApplicationCustomActionParameterType string + +const ( + GalleryApplicationCustomActionParameterTypeString GalleryApplicationCustomActionParameterType = "String" + GalleryApplicationCustomActionParameterTypeConfigurationDataBlob GalleryApplicationCustomActionParameterType = "ConfigurationDataBlob" + GalleryApplicationCustomActionParameterTypeLogOutputBlob GalleryApplicationCustomActionParameterType = "LogOutputBlob" +) + +// PossibleGalleryApplicationCustomActionParameterTypeValues returns the possible values for the GalleryApplicationCustomActionParameterType const type. +func PossibleGalleryApplicationCustomActionParameterTypeValues() []GalleryApplicationCustomActionParameterType { + return []GalleryApplicationCustomActionParameterType{ + GalleryApplicationCustomActionParameterTypeString, + GalleryApplicationCustomActionParameterTypeConfigurationDataBlob, + GalleryApplicationCustomActionParameterTypeLogOutputBlob, + } +} + +type GalleryExpandParams string + +const ( + GalleryExpandParamsSharingProfileGroups GalleryExpandParams = "SharingProfile/Groups" +) + +// PossibleGalleryExpandParamsValues returns the possible values for the GalleryExpandParams const type. +func PossibleGalleryExpandParamsValues() []GalleryExpandParams { + return []GalleryExpandParams{ + GalleryExpandParamsSharingProfileGroups, + } +} + +// GalleryExtendedLocationType - It is type of the extended location. +type GalleryExtendedLocationType string + +const ( + GalleryExtendedLocationTypeEdgeZone GalleryExtendedLocationType = "EdgeZone" + GalleryExtendedLocationTypeUnknown GalleryExtendedLocationType = "Unknown" +) + +// PossibleGalleryExtendedLocationTypeValues returns the possible values for the GalleryExtendedLocationType const type. +func PossibleGalleryExtendedLocationTypeValues() []GalleryExtendedLocationType { + return []GalleryExtendedLocationType{ + GalleryExtendedLocationTypeEdgeZone, + GalleryExtendedLocationTypeUnknown, + } +} + +// GalleryProvisioningState - The provisioning state, which only appears in the response. +type GalleryProvisioningState string + +const ( + GalleryProvisioningStateCreating GalleryProvisioningState = "Creating" + GalleryProvisioningStateDeleting GalleryProvisioningState = "Deleting" + GalleryProvisioningStateFailed GalleryProvisioningState = "Failed" + GalleryProvisioningStateMigrating GalleryProvisioningState = "Migrating" + GalleryProvisioningStateSucceeded GalleryProvisioningState = "Succeeded" + GalleryProvisioningStateUpdating GalleryProvisioningState = "Updating" +) + +// PossibleGalleryProvisioningStateValues returns the possible values for the GalleryProvisioningState const type. +func PossibleGalleryProvisioningStateValues() []GalleryProvisioningState { + return []GalleryProvisioningState{ + GalleryProvisioningStateCreating, + GalleryProvisioningStateDeleting, + GalleryProvisioningStateFailed, + GalleryProvisioningStateMigrating, + GalleryProvisioningStateSucceeded, + GalleryProvisioningStateUpdating, + } +} + +// GallerySharingPermissionTypes - This property allows you to specify the permission of sharing gallery. +// Possible values are: +// Private +// Groups +// Community +type GallerySharingPermissionTypes string + +const ( + GallerySharingPermissionTypesCommunity GallerySharingPermissionTypes = "Community" + GallerySharingPermissionTypesGroups GallerySharingPermissionTypes = "Groups" + GallerySharingPermissionTypesPrivate GallerySharingPermissionTypes = "Private" +) + +// PossibleGallerySharingPermissionTypesValues returns the possible values for the GallerySharingPermissionTypes const type. +func PossibleGallerySharingPermissionTypesValues() []GallerySharingPermissionTypes { + return []GallerySharingPermissionTypes{ + GallerySharingPermissionTypesCommunity, + GallerySharingPermissionTypesGroups, + GallerySharingPermissionTypesPrivate, + } +} + +// HostCaching - The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' +type HostCaching string + +const ( + HostCachingNone HostCaching = "None" + HostCachingReadOnly HostCaching = "ReadOnly" + HostCachingReadWrite HostCaching = "ReadWrite" +) + +// PossibleHostCachingValues returns the possible values for the HostCaching const type. +func PossibleHostCachingValues() []HostCaching { + return []HostCaching{ + HostCachingNone, + HostCachingReadOnly, + HostCachingReadWrite, + } +} + +// HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only. +type HyperVGeneration string + +const ( + HyperVGenerationV1 HyperVGeneration = "V1" + HyperVGenerationV2 HyperVGeneration = "V2" +) + +// PossibleHyperVGenerationValues returns the possible values for the HyperVGeneration const type. +func PossibleHyperVGenerationValues() []HyperVGeneration { + return []HyperVGeneration{ + HyperVGenerationV1, + HyperVGenerationV2, + } +} + +// HyperVGenerationType - Specifies the HyperVGeneration Type associated with a resource +type HyperVGenerationType string + +const ( + HyperVGenerationTypeV1 HyperVGenerationType = "V1" + HyperVGenerationTypeV2 HyperVGenerationType = "V2" +) + +// PossibleHyperVGenerationTypeValues returns the possible values for the HyperVGenerationType const type. +func PossibleHyperVGenerationTypeValues() []HyperVGenerationType { + return []HyperVGenerationType{ + HyperVGenerationTypeV1, + HyperVGenerationTypeV2, + } +} + +// HyperVGenerationTypes - Specifies the HyperVGeneration Type +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesV1 HyperVGenerationTypes = "V1" + HyperVGenerationTypesV2 HyperVGenerationTypes = "V2" +) + +// PossibleHyperVGenerationTypesValues returns the possible values for the HyperVGenerationTypes const type. +func PossibleHyperVGenerationTypesValues() []HyperVGenerationTypes { + return []HyperVGenerationTypes{ + HyperVGenerationTypesV1, + HyperVGenerationTypesV2, + } +} + +// IPVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or +// IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. +type IPVersion string + +const ( + IPVersionIPv4 IPVersion = "IPv4" + IPVersionIPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns the possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{ + IPVersionIPv4, + IPVersionIPv6, + } +} + +// IPVersions - Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 +// or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. +type IPVersions string + +const ( + IPVersionsIPv4 IPVersions = "IPv4" + IPVersionsIPv6 IPVersions = "IPv6" +) + +// PossibleIPVersionsValues returns the possible values for the IPVersions const type. +func PossibleIPVersionsValues() []IPVersions { + return []IPVersions{ + IPVersionsIPv4, + IPVersionsIPv6, + } +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +// PossibleInstanceViewTypesValues returns the possible values for the InstanceViewTypes const type. +func PossibleInstanceViewTypesValues() []InstanceViewTypes { + return []InstanceViewTypes{ + InstanceViewTypesInstanceView, + InstanceViewTypesUserData, + } +} + +// IntervalInMins - Interval value in minutes used to create LogAnalytics call rate logs. +type IntervalInMins string + +const ( + IntervalInMinsThreeMins IntervalInMins = "ThreeMins" + IntervalInMinsFiveMins IntervalInMins = "FiveMins" + IntervalInMinsThirtyMins IntervalInMins = "ThirtyMins" + IntervalInMinsSixtyMins IntervalInMins = "SixtyMins" +) + +// PossibleIntervalInMinsValues returns the possible values for the IntervalInMins const type. +func PossibleIntervalInMinsValues() []IntervalInMins { + return []IntervalInMins{ + IntervalInMinsThreeMins, + IntervalInMinsFiveMins, + IntervalInMinsThirtyMins, + IntervalInMinsSixtyMins, + } +} + +// LinuxPatchAssessmentMode - Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. +// Possible values are: +// ImageDefault - You control the timing of patch assessments on a virtual machine. +// AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +// PossibleLinuxPatchAssessmentModeValues returns the possible values for the LinuxPatchAssessmentMode const type. +func PossibleLinuxPatchAssessmentModeValues() []LinuxPatchAssessmentMode { + return []LinuxPatchAssessmentMode{ + LinuxPatchAssessmentModeAutomaticByPlatform, + LinuxPatchAssessmentModeImageDefault, + } +} + +// LinuxVMGuestPatchAutomaticByPlatformRebootSetting - Specifies the reboot setting for all AutomaticByPlatform patch installation +// operations. +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +// PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues returns the possible values for the LinuxVMGuestPatchAutomaticByPlatformRebootSetting const type. +func PossibleLinuxVMGuestPatchAutomaticByPlatformRebootSettingValues() []LinuxVMGuestPatchAutomaticByPlatformRebootSetting { + return []LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } +} + +// LinuxVMGuestPatchMode - Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated +// to virtual machine scale set with OrchestrationMode as Flexible. +// Possible values are: +// ImageDefault - The virtual machine's default patching configuration is used. +// AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent +// must be true +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +// PossibleLinuxVMGuestPatchModeValues returns the possible values for the LinuxVMGuestPatchMode const type. +func PossibleLinuxVMGuestPatchModeValues() []LinuxVMGuestPatchMode { + return []LinuxVMGuestPatchMode{ + LinuxVMGuestPatchModeAutomaticByPlatform, + LinuxVMGuestPatchModeImageDefault, + } +} + +// MaintenanceOperationResultCodeTypes - The Last Maintenance Operation Result Code. +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" +) + +// PossibleMaintenanceOperationResultCodeTypesValues returns the possible values for the MaintenanceOperationResultCodeTypes const type. +func PossibleMaintenanceOperationResultCodeTypesValues() []MaintenanceOperationResultCodeTypes { + return []MaintenanceOperationResultCodeTypes{ + MaintenanceOperationResultCodeTypesNone, + MaintenanceOperationResultCodeTypesRetryLater, + MaintenanceOperationResultCodeTypesMaintenanceAborted, + MaintenanceOperationResultCodeTypesMaintenanceCompleted, + } +} + +// NetworkAPIVersion - specifies the Microsoft.Network API version used when creating networking resources in the Network +// Interface Configurations +type NetworkAPIVersion string + +const ( + NetworkAPIVersionTwoThousandTwenty1101 NetworkAPIVersion = "2020-11-01" +) + +// PossibleNetworkAPIVersionValues returns the possible values for the NetworkAPIVersion const type. +func PossibleNetworkAPIVersionValues() []NetworkAPIVersion { + return []NetworkAPIVersion{ + NetworkAPIVersionTwoThousandTwenty1101, + } +} + +// NetworkAccessPolicy - Policy for accessing the disk via network. +type NetworkAccessPolicy string + +const ( + // NetworkAccessPolicyAllowAll - The disk can be exported or uploaded to from any network. + NetworkAccessPolicyAllowAll NetworkAccessPolicy = "AllowAll" + // NetworkAccessPolicyAllowPrivate - The disk can be exported or uploaded to using a DiskAccess resource's private endpoints. + NetworkAccessPolicyAllowPrivate NetworkAccessPolicy = "AllowPrivate" + // NetworkAccessPolicyDenyAll - The disk cannot be exported. + NetworkAccessPolicyDenyAll NetworkAccessPolicy = "DenyAll" +) + +// PossibleNetworkAccessPolicyValues returns the possible values for the NetworkAccessPolicy const type. +func PossibleNetworkAccessPolicyValues() []NetworkAccessPolicy { + return []NetworkAccessPolicy{ + NetworkAccessPolicyAllowAll, + NetworkAccessPolicyAllowPrivate, + NetworkAccessPolicyDenyAll, + } +} + +// OperatingSystemStateTypes - This property allows the user to specify whether the virtual machines created under this image +// are 'Generalized' or 'Specialized'. +type OperatingSystemStateTypes string + +const ( + OperatingSystemStateTypesGeneralized OperatingSystemStateTypes = "Generalized" + OperatingSystemStateTypesSpecialized OperatingSystemStateTypes = "Specialized" +) + +// PossibleOperatingSystemStateTypesValues returns the possible values for the OperatingSystemStateTypes const type. +func PossibleOperatingSystemStateTypesValues() []OperatingSystemStateTypes { + return []OperatingSystemStateTypes{ + OperatingSystemStateTypesGeneralized, + OperatingSystemStateTypesSpecialized, + } +} + +// OperatingSystemType - Gets the Operating System type. +type OperatingSystemType string + +const ( + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +// PossibleOperatingSystemTypeValues returns the possible values for the OperatingSystemType const type. +func PossibleOperatingSystemTypeValues() []OperatingSystemType { + return []OperatingSystemType{ + OperatingSystemTypeLinux, + OperatingSystemTypeWindows, + } +} + +// OperatingSystemTypes - This property allows you to specify the supported type of the OS that application is built for. +// Possible values are: +// Windows +// Linux +type OperatingSystemTypes string + +const ( + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" +) + +// PossibleOperatingSystemTypesValues returns the possible values for the OperatingSystemTypes const type. +func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{ + OperatingSystemTypesWindows, + OperatingSystemTypesLinux, + } +} + +// OrchestrationMode - Specifies the orchestration mode for the virtual machine scale set. +type OrchestrationMode string + +const ( + OrchestrationModeFlexible OrchestrationMode = "Flexible" + OrchestrationModeUniform OrchestrationMode = "Uniform" +) + +// PossibleOrchestrationModeValues returns the possible values for the OrchestrationMode const type. +func PossibleOrchestrationModeValues() []OrchestrationMode { + return []OrchestrationMode{ + OrchestrationModeFlexible, + OrchestrationModeUniform, + } +} + +// OrchestrationServiceNames - The name of the service. +type OrchestrationServiceNames string + +const ( + OrchestrationServiceNamesAutomaticRepairs OrchestrationServiceNames = "AutomaticRepairs" +) + +// PossibleOrchestrationServiceNamesValues returns the possible values for the OrchestrationServiceNames const type. +func PossibleOrchestrationServiceNamesValues() []OrchestrationServiceNames { + return []OrchestrationServiceNames{ + OrchestrationServiceNamesAutomaticRepairs, + } +} + +// OrchestrationServiceState - The current state of the service. +type OrchestrationServiceState string + +const ( + OrchestrationServiceStateNotRunning OrchestrationServiceState = "NotRunning" + OrchestrationServiceStateRunning OrchestrationServiceState = "Running" + OrchestrationServiceStateSuspended OrchestrationServiceState = "Suspended" +) + +// PossibleOrchestrationServiceStateValues returns the possible values for the OrchestrationServiceState const type. +func PossibleOrchestrationServiceStateValues() []OrchestrationServiceState { + return []OrchestrationServiceState{ + OrchestrationServiceStateNotRunning, + OrchestrationServiceStateRunning, + OrchestrationServiceStateSuspended, + } +} + +// OrchestrationServiceStateAction - The action to be performed. +type OrchestrationServiceStateAction string + +const ( + OrchestrationServiceStateActionResume OrchestrationServiceStateAction = "Resume" + OrchestrationServiceStateActionSuspend OrchestrationServiceStateAction = "Suspend" +) + +// PossibleOrchestrationServiceStateActionValues returns the possible values for the OrchestrationServiceStateAction const type. +func PossibleOrchestrationServiceStateActionValues() []OrchestrationServiceStateAction { + return []OrchestrationServiceStateAction{ + OrchestrationServiceStateActionResume, + OrchestrationServiceStateActionSuspend, + } +} + +// PatchAssessmentState - Describes the availability of a given patch. +type PatchAssessmentState string + +const ( + PatchAssessmentStateAvailable PatchAssessmentState = "Available" + PatchAssessmentStateUnknown PatchAssessmentState = "Unknown" +) + +// PossiblePatchAssessmentStateValues returns the possible values for the PatchAssessmentState const type. +func PossiblePatchAssessmentStateValues() []PatchAssessmentState { + return []PatchAssessmentState{ + PatchAssessmentStateAvailable, + PatchAssessmentStateUnknown, + } +} + +// PatchInstallationState - The state of the patch after the installation operation completed. +type PatchInstallationState string + +const ( + PatchInstallationStateExcluded PatchInstallationState = "Excluded" + PatchInstallationStateFailed PatchInstallationState = "Failed" + PatchInstallationStateInstalled PatchInstallationState = "Installed" + PatchInstallationStateNotSelected PatchInstallationState = "NotSelected" + PatchInstallationStatePending PatchInstallationState = "Pending" + PatchInstallationStateUnknown PatchInstallationState = "Unknown" +) + +// PossiblePatchInstallationStateValues returns the possible values for the PatchInstallationState const type. +func PossiblePatchInstallationStateValues() []PatchInstallationState { + return []PatchInstallationState{ + PatchInstallationStateExcluded, + PatchInstallationStateFailed, + PatchInstallationStateInstalled, + PatchInstallationStateNotSelected, + PatchInstallationStatePending, + PatchInstallationStateUnknown, + } +} + +// PatchOperationStatus - The overall success or failure status of the operation. It remains "InProgress" until the operation +// completes. At that point it will become "Unknown", "Failed", "Succeeded", or +// "CompletedWithWarnings." +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +// PossiblePatchOperationStatusValues returns the possible values for the PatchOperationStatus const type. +func PossiblePatchOperationStatusValues() []PatchOperationStatus { + return []PatchOperationStatus{ + PatchOperationStatusCompletedWithWarnings, + PatchOperationStatusFailed, + PatchOperationStatusInProgress, + PatchOperationStatusSucceeded, + PatchOperationStatusUnknown, + } +} + +// PolicyViolationCategory - Describes the nature of the policy violation. +type PolicyViolationCategory string + +const ( + PolicyViolationCategoryCopyrightValidation PolicyViolationCategory = "CopyrightValidation" + PolicyViolationCategoryIPTheft PolicyViolationCategory = "IpTheft" + PolicyViolationCategoryImageFlaggedUnsafe PolicyViolationCategory = "ImageFlaggedUnsafe" + PolicyViolationCategoryOther PolicyViolationCategory = "Other" +) + +// PossiblePolicyViolationCategoryValues returns the possible values for the PolicyViolationCategory const type. +func PossiblePolicyViolationCategoryValues() []PolicyViolationCategory { + return []PolicyViolationCategory{ + PolicyViolationCategoryCopyrightValidation, + PolicyViolationCategoryIPTheft, + PolicyViolationCategoryImageFlaggedUnsafe, + PolicyViolationCategoryOther, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// ProtocolTypes - Specifies the protocol of WinRM listener. +// Possible values are: +// http +// https +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +// PossibleProtocolTypesValues returns the possible values for the ProtocolTypes const type. +func PossibleProtocolTypesValues() []ProtocolTypes { + return []ProtocolTypes{ + ProtocolTypesHTTP, + ProtocolTypesHTTPS, + } +} + +// ProximityPlacementGroupType - Specifies the type of the proximity placement group. +// Possible values are: +// Standard : Co-locate resources within an Azure region or Availability Zone. +// Ultra : For future use. +type ProximityPlacementGroupType string + +const ( + ProximityPlacementGroupTypeStandard ProximityPlacementGroupType = "Standard" + ProximityPlacementGroupTypeUltra ProximityPlacementGroupType = "Ultra" +) + +// PossibleProximityPlacementGroupTypeValues returns the possible values for the ProximityPlacementGroupType const type. +func PossibleProximityPlacementGroupTypeValues() []ProximityPlacementGroupType { + return []ProximityPlacementGroupType{ + ProximityPlacementGroupTypeStandard, + ProximityPlacementGroupTypeUltra, + } +} + +// PublicIPAddressSKUName - Specify public IP sku name +type PublicIPAddressSKUName string + +const ( + PublicIPAddressSKUNameBasic PublicIPAddressSKUName = "Basic" + PublicIPAddressSKUNameStandard PublicIPAddressSKUName = "Standard" +) + +// PossiblePublicIPAddressSKUNameValues returns the possible values for the PublicIPAddressSKUName const type. +func PossiblePublicIPAddressSKUNameValues() []PublicIPAddressSKUName { + return []PublicIPAddressSKUName{ + PublicIPAddressSKUNameBasic, + PublicIPAddressSKUNameStandard, + } +} + +// PublicIPAddressSKUTier - Specify public IP sku tier +type PublicIPAddressSKUTier string + +const ( + PublicIPAddressSKUTierGlobal PublicIPAddressSKUTier = "Global" + PublicIPAddressSKUTierRegional PublicIPAddressSKUTier = "Regional" +) + +// PossiblePublicIPAddressSKUTierValues returns the possible values for the PublicIPAddressSKUTier const type. +func PossiblePublicIPAddressSKUTierValues() []PublicIPAddressSKUTier { + return []PublicIPAddressSKUTier{ + PublicIPAddressSKUTierGlobal, + PublicIPAddressSKUTierRegional, + } +} + +// PublicIPAllocationMethod - Specify the public IP allocation type +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +// PossiblePublicIPAllocationMethodValues returns the possible values for the PublicIPAllocationMethod const type. +func PossiblePublicIPAllocationMethodValues() []PublicIPAllocationMethod { + return []PublicIPAllocationMethod{ + PublicIPAllocationMethodDynamic, + PublicIPAllocationMethodStatic, + } +} + +// PublicNetworkAccess - Policy for controlling export on the disk. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled - You cannot access the underlying data of the disk publicly on the internet even when NetworkAccessPolicy + // is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy + // is set to AllowPrivate. + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled - You can generate a SAS URI to access the underlying data of the disk publicly on the internet + // when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET + // when NetworkAccessPolicy is set to AllowPrivate. + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// RepairAction - Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy virtual machines +// in the scale set. Default value is replace. +type RepairAction string + +const ( + RepairActionReimage RepairAction = "Reimage" + RepairActionReplace RepairAction = "Replace" + RepairActionRestart RepairAction = "Restart" +) + +// PossibleRepairActionValues returns the possible values for the RepairAction const type. +func PossibleRepairActionValues() []RepairAction { + return []RepairAction{ + RepairActionReimage, + RepairActionReplace, + RepairActionRestart, + } +} + +// ReplicationMode - Optional parameter which specifies the mode to be used for replication. This property is not updatable. +type ReplicationMode string + +const ( + ReplicationModeFull ReplicationMode = "Full" + ReplicationModeShallow ReplicationMode = "Shallow" +) + +// PossibleReplicationModeValues returns the possible values for the ReplicationMode const type. +func PossibleReplicationModeValues() []ReplicationMode { + return []ReplicationMode{ + ReplicationModeFull, + ReplicationModeShallow, + } +} + +// ReplicationState - This is the regional replication state. +type ReplicationState string + +const ( + ReplicationStateCompleted ReplicationState = "Completed" + ReplicationStateFailed ReplicationState = "Failed" + ReplicationStateReplicating ReplicationState = "Replicating" + ReplicationStateUnknown ReplicationState = "Unknown" +) + +// PossibleReplicationStateValues returns the possible values for the ReplicationState const type. +func PossibleReplicationStateValues() []ReplicationState { + return []ReplicationState{ + ReplicationStateCompleted, + ReplicationStateFailed, + ReplicationStateReplicating, + ReplicationStateUnknown, + } +} + +type ReplicationStatusTypes string + +const ( + ReplicationStatusTypesReplicationStatus ReplicationStatusTypes = "ReplicationStatus" +) + +// PossibleReplicationStatusTypesValues returns the possible values for the ReplicationStatusTypes const type. +func PossibleReplicationStatusTypesValues() []ReplicationStatusTypes { + return []ReplicationStatusTypes{ + ReplicationStatusTypesReplicationStatus, + } +} + +// ResourceIdentityType - The type of identity used for the virtual machine scale set. 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 virtual machine scale set. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeNone ResourceIdentityType = "None" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeNone, + } +} + +// ResourceSKUCapacityScaleType - The scale type applicable to the sku. +type ResourceSKUCapacityScaleType string + +const ( + ResourceSKUCapacityScaleTypeAutomatic ResourceSKUCapacityScaleType = "Automatic" + ResourceSKUCapacityScaleTypeManual ResourceSKUCapacityScaleType = "Manual" + ResourceSKUCapacityScaleTypeNone ResourceSKUCapacityScaleType = "None" +) + +// PossibleResourceSKUCapacityScaleTypeValues returns the possible values for the ResourceSKUCapacityScaleType const type. +func PossibleResourceSKUCapacityScaleTypeValues() []ResourceSKUCapacityScaleType { + return []ResourceSKUCapacityScaleType{ + ResourceSKUCapacityScaleTypeAutomatic, + ResourceSKUCapacityScaleTypeManual, + ResourceSKUCapacityScaleTypeNone, + } +} + +// ResourceSKURestrictionsReasonCode - The reason for restriction. +type ResourceSKURestrictionsReasonCode string + +const ( + ResourceSKURestrictionsReasonCodeQuotaID ResourceSKURestrictionsReasonCode = "QuotaId" + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription ResourceSKURestrictionsReasonCode = "NotAvailableForSubscription" +) + +// PossibleResourceSKURestrictionsReasonCodeValues returns the possible values for the ResourceSKURestrictionsReasonCode const type. +func PossibleResourceSKURestrictionsReasonCodeValues() []ResourceSKURestrictionsReasonCode { + return []ResourceSKURestrictionsReasonCode{ + ResourceSKURestrictionsReasonCodeQuotaID, + ResourceSKURestrictionsReasonCodeNotAvailableForSubscription, + } +} + +// ResourceSKURestrictionsType - The type of restrictions. +type ResourceSKURestrictionsType string + +const ( + ResourceSKURestrictionsTypeLocation ResourceSKURestrictionsType = "Location" + ResourceSKURestrictionsTypeZone ResourceSKURestrictionsType = "Zone" +) + +// PossibleResourceSKURestrictionsTypeValues returns the possible values for the ResourceSKURestrictionsType const type. +func PossibleResourceSKURestrictionsTypeValues() []ResourceSKURestrictionsType { + return []ResourceSKURestrictionsType{ + ResourceSKURestrictionsTypeLocation, + ResourceSKURestrictionsTypeZone, + } +} + +type RestorePointCollectionExpandOptions string + +const ( + RestorePointCollectionExpandOptionsRestorePoints RestorePointCollectionExpandOptions = "restorePoints" +) + +// PossibleRestorePointCollectionExpandOptionsValues returns the possible values for the RestorePointCollectionExpandOptions const type. +func PossibleRestorePointCollectionExpandOptionsValues() []RestorePointCollectionExpandOptions { + return []RestorePointCollectionExpandOptions{ + RestorePointCollectionExpandOptionsRestorePoints, + } +} + +type RestorePointExpandOptions string + +const ( + RestorePointExpandOptionsInstanceView RestorePointExpandOptions = "instanceView" +) + +// PossibleRestorePointExpandOptionsValues returns the possible values for the RestorePointExpandOptions const type. +func PossibleRestorePointExpandOptionsValues() []RestorePointExpandOptions { + return []RestorePointExpandOptions{ + RestorePointExpandOptionsInstanceView, + } +} + +// RollingUpgradeActionType - The last action performed on the rolling upgrade. +type RollingUpgradeActionType string + +const ( + RollingUpgradeActionTypeStart RollingUpgradeActionType = "Start" + RollingUpgradeActionTypeCancel RollingUpgradeActionType = "Cancel" +) + +// PossibleRollingUpgradeActionTypeValues returns the possible values for the RollingUpgradeActionType const type. +func PossibleRollingUpgradeActionTypeValues() []RollingUpgradeActionType { + return []RollingUpgradeActionType{ + RollingUpgradeActionTypeStart, + RollingUpgradeActionTypeCancel, + } +} + +// RollingUpgradeStatusCode - Code indicating the current status of the upgrade. +type RollingUpgradeStatusCode string + +const ( + RollingUpgradeStatusCodeRollingForward RollingUpgradeStatusCode = "RollingForward" + RollingUpgradeStatusCodeCancelled RollingUpgradeStatusCode = "Cancelled" + RollingUpgradeStatusCodeCompleted RollingUpgradeStatusCode = "Completed" + RollingUpgradeStatusCodeFaulted RollingUpgradeStatusCode = "Faulted" +) + +// PossibleRollingUpgradeStatusCodeValues returns the possible values for the RollingUpgradeStatusCode const type. +func PossibleRollingUpgradeStatusCodeValues() []RollingUpgradeStatusCode { + return []RollingUpgradeStatusCode{ + RollingUpgradeStatusCodeRollingForward, + RollingUpgradeStatusCodeCancelled, + RollingUpgradeStatusCodeCompleted, + RollingUpgradeStatusCodeFaulted, + } +} + +// SecurityEncryptionTypes - Specifies the EncryptionType of the managed disk. +// It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly +// for encryption of just the VMGuestState blob. +// NOTE: It can be set for only Confidential VMs. +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +// PossibleSecurityEncryptionTypesValues returns the possible values for the SecurityEncryptionTypes const type. +func PossibleSecurityEncryptionTypesValues() []SecurityEncryptionTypes { + return []SecurityEncryptionTypes{ + SecurityEncryptionTypesDiskWithVMGuestState, + SecurityEncryptionTypesVMGuestStateOnly, + } +} + +// SecurityTypes - Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. +// Default: UefiSettings will not be enabled unless this property is set. +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +// PossibleSecurityTypesValues returns the possible values for the SecurityTypes const type. +func PossibleSecurityTypesValues() []SecurityTypes { + return []SecurityTypes{ + SecurityTypesConfidentialVM, + SecurityTypesTrustedLaunch, + } +} + +type SelectPermissions string + +const ( + SelectPermissionsPermissions SelectPermissions = "Permissions" +) + +// PossibleSelectPermissionsValues returns the possible values for the SelectPermissions const type. +func PossibleSelectPermissionsValues() []SelectPermissions { + return []SelectPermissions{ + SelectPermissionsPermissions, + } +} + +// SettingNames - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands +// and AutoLogon. +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +// PossibleSettingNamesValues returns the possible values for the SettingNames const type. +func PossibleSettingNamesValues() []SettingNames { + return []SettingNames{ + SettingNamesAutoLogon, + SettingNamesFirstLogonCommands, + } +} + +// SharedGalleryHostCaching - The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' +type SharedGalleryHostCaching string + +const ( + SharedGalleryHostCachingNone SharedGalleryHostCaching = "None" + SharedGalleryHostCachingReadOnly SharedGalleryHostCaching = "ReadOnly" + SharedGalleryHostCachingReadWrite SharedGalleryHostCaching = "ReadWrite" +) + +// PossibleSharedGalleryHostCachingValues returns the possible values for the SharedGalleryHostCaching const type. +func PossibleSharedGalleryHostCachingValues() []SharedGalleryHostCaching { + return []SharedGalleryHostCaching{ + SharedGalleryHostCachingNone, + SharedGalleryHostCachingReadOnly, + SharedGalleryHostCachingReadWrite, + } +} + +type SharedToValues string + +const ( + SharedToValuesTenant SharedToValues = "tenant" +) + +// PossibleSharedToValuesValues returns the possible values for the SharedToValues const type. +func PossibleSharedToValuesValues() []SharedToValues { + return []SharedToValues{ + SharedToValuesTenant, + } +} + +// SharingProfileGroupTypes - This property allows you to specify the type of sharing group. +// Possible values are: +// Subscriptions +// AADTenants +type SharingProfileGroupTypes string + +const ( + SharingProfileGroupTypesAADTenants SharingProfileGroupTypes = "AADTenants" + SharingProfileGroupTypesSubscriptions SharingProfileGroupTypes = "Subscriptions" +) + +// PossibleSharingProfileGroupTypesValues returns the possible values for the SharingProfileGroupTypes const type. +func PossibleSharingProfileGroupTypesValues() []SharingProfileGroupTypes { + return []SharingProfileGroupTypes{ + SharingProfileGroupTypesAADTenants, + SharingProfileGroupTypesSubscriptions, + } +} + +// SharingState - The sharing state of the gallery, which only appears in the response. +type SharingState string + +const ( + SharingStateFailed SharingState = "Failed" + SharingStateInProgress SharingState = "InProgress" + SharingStateSucceeded SharingState = "Succeeded" + SharingStateUnknown SharingState = "Unknown" +) + +// PossibleSharingStateValues returns the possible values for the SharingState const type. +func PossibleSharingStateValues() []SharingState { + return []SharingState{ + SharingStateFailed, + SharingStateInProgress, + SharingStateSucceeded, + SharingStateUnknown, + } +} + +// SharingUpdateOperationTypes - This property allows you to specify the operation type of gallery sharing update. +// Possible values are: +// Add +// Remove +// Reset +type SharingUpdateOperationTypes string + +const ( + SharingUpdateOperationTypesAdd SharingUpdateOperationTypes = "Add" + SharingUpdateOperationTypesEnableCommunity SharingUpdateOperationTypes = "EnableCommunity" + SharingUpdateOperationTypesRemove SharingUpdateOperationTypes = "Remove" + SharingUpdateOperationTypesReset SharingUpdateOperationTypes = "Reset" +) + +// PossibleSharingUpdateOperationTypesValues returns the possible values for the SharingUpdateOperationTypes const type. +func PossibleSharingUpdateOperationTypesValues() []SharingUpdateOperationTypes { + return []SharingUpdateOperationTypes{ + SharingUpdateOperationTypesAdd, + SharingUpdateOperationTypesEnableCommunity, + SharingUpdateOperationTypesRemove, + SharingUpdateOperationTypesReset, + } +} + +// SnapshotStorageAccountTypes - The sku name. +type SnapshotStorageAccountTypes string + +const ( + // SnapshotStorageAccountTypesPremiumLRS - Premium SSD locally redundant storage + SnapshotStorageAccountTypesPremiumLRS SnapshotStorageAccountTypes = "Premium_LRS" + // SnapshotStorageAccountTypesStandardLRS - Standard HDD locally redundant storage + SnapshotStorageAccountTypesStandardLRS SnapshotStorageAccountTypes = "Standard_LRS" + // SnapshotStorageAccountTypesStandardZRS - Standard zone redundant storage + SnapshotStorageAccountTypesStandardZRS SnapshotStorageAccountTypes = "Standard_ZRS" +) + +// PossibleSnapshotStorageAccountTypesValues returns the possible values for the SnapshotStorageAccountTypes const type. +func PossibleSnapshotStorageAccountTypesValues() []SnapshotStorageAccountTypes { + return []SnapshotStorageAccountTypes{ + SnapshotStorageAccountTypesPremiumLRS, + SnapshotStorageAccountTypesStandardLRS, + SnapshotStorageAccountTypesStandardZRS, + } +} + +// StatusLevelTypes - The level code. +type StatusLevelTypes string + +const ( + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" + StatusLevelTypesError StatusLevelTypes = "Error" +) + +// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{ + StatusLevelTypesInfo, + StatusLevelTypesWarning, + StatusLevelTypesError, + } +} + +// StorageAccountType - Specifies the storage account type to be used to store the image. This property is not updatable. +type StorageAccountType string + +const ( + StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" + StorageAccountTypeStandardZRS StorageAccountType = "Standard_ZRS" +) + +// PossibleStorageAccountTypeValues returns the possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{ + StorageAccountTypePremiumLRS, + StorageAccountTypeStandardLRS, + StorageAccountTypeStandardZRS, + } +} + +// StorageAccountTypes - Specifies the storage account type for the managed disk. Managed OS disk storage account type can +// only be set when you create the scale set. NOTE: UltraSSDLRS can only be used with data disks. It +// cannot be used with OS Disk. StandardLRS uses Standard HDD. StandardSSDLRS uses Standard SSD. PremiumLRS uses Premium SSD. +// UltraSSDLRS uses Ultra disk. PremiumZRS uses Premium SSD zone redundant +// storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. For more information regarding disks supported for Windows +// Virtual Machines, refer to +// https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for Linux Virtual Machines, refer to https://docs.microsoft.com/azure/virtual-machines/linux/disks-types +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumV2LRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +// PossibleStorageAccountTypesValues returns the possible values for the StorageAccountTypes const type. +func PossibleStorageAccountTypesValues() []StorageAccountTypes { + return []StorageAccountTypes{ + StorageAccountTypesPremiumLRS, + StorageAccountTypesPremiumV2LRS, + StorageAccountTypesPremiumZRS, + StorageAccountTypesStandardLRS, + StorageAccountTypesStandardSSDLRS, + StorageAccountTypesStandardSSDZRS, + StorageAccountTypesUltraSSDLRS, + } +} + +// UpgradeMode - Specifies the mode of an upgrade to virtual machines in the scale set. +// Possible values are: +// Manual - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade +// action. +// Automatic - All virtual machines in the scale set are automatically updated at the same time. +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" + UpgradeModeRolling UpgradeMode = "Rolling" +) + +// PossibleUpgradeModeValues returns the possible values for the UpgradeMode const type. +func PossibleUpgradeModeValues() []UpgradeMode { + return []UpgradeMode{ + UpgradeModeAutomatic, + UpgradeModeManual, + UpgradeModeRolling, + } +} + +// UpgradeOperationInvoker - Invoker of the Upgrade Operation +type UpgradeOperationInvoker string + +const ( + UpgradeOperationInvokerUnknown UpgradeOperationInvoker = "Unknown" + UpgradeOperationInvokerUser UpgradeOperationInvoker = "User" + UpgradeOperationInvokerPlatform UpgradeOperationInvoker = "Platform" +) + +// PossibleUpgradeOperationInvokerValues returns the possible values for the UpgradeOperationInvoker const type. +func PossibleUpgradeOperationInvokerValues() []UpgradeOperationInvoker { + return []UpgradeOperationInvoker{ + UpgradeOperationInvokerUnknown, + UpgradeOperationInvokerUser, + UpgradeOperationInvokerPlatform, + } +} + +// UpgradeState - Code indicating the current status of the upgrade. +type UpgradeState string + +const ( + UpgradeStateRollingForward UpgradeState = "RollingForward" + UpgradeStateCancelled UpgradeState = "Cancelled" + UpgradeStateCompleted UpgradeState = "Completed" + UpgradeStateFaulted UpgradeState = "Faulted" +) + +// PossibleUpgradeStateValues returns the possible values for the UpgradeState const type. +func PossibleUpgradeStateValues() []UpgradeState { + return []UpgradeState{ + UpgradeStateRollingForward, + UpgradeStateCancelled, + UpgradeStateCompleted, + UpgradeStateFaulted, + } +} + +// VMDiskTypes - VM disk types which are disallowed. +type VMDiskTypes string + +const ( + VMDiskTypesNone VMDiskTypes = "None" + VMDiskTypesUnmanaged VMDiskTypes = "Unmanaged" +) + +// PossibleVMDiskTypesValues returns the possible values for the VMDiskTypes const type. +func PossibleVMDiskTypesValues() []VMDiskTypes { + return []VMDiskTypes{ + VMDiskTypesNone, + VMDiskTypesUnmanaged, + } +} + +type VMGuestPatchClassificationLinux string + +const ( + VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" + VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" + VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" +) + +// PossibleVMGuestPatchClassificationLinuxValues returns the possible values for the VMGuestPatchClassificationLinux const type. +func PossibleVMGuestPatchClassificationLinuxValues() []VMGuestPatchClassificationLinux { + return []VMGuestPatchClassificationLinux{ + VMGuestPatchClassificationLinuxCritical, + VMGuestPatchClassificationLinuxOther, + VMGuestPatchClassificationLinuxSecurity, + } +} + +type VMGuestPatchClassificationWindows string + +const ( + VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" + VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" + VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" + VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" + VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" + VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" + VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" + VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" +) + +// PossibleVMGuestPatchClassificationWindowsValues returns the possible values for the VMGuestPatchClassificationWindows const type. +func PossibleVMGuestPatchClassificationWindowsValues() []VMGuestPatchClassificationWindows { + return []VMGuestPatchClassificationWindows{ + VMGuestPatchClassificationWindowsCritical, + VMGuestPatchClassificationWindowsDefinition, + VMGuestPatchClassificationWindowsFeaturePack, + VMGuestPatchClassificationWindowsSecurity, + VMGuestPatchClassificationWindowsServicePack, + VMGuestPatchClassificationWindowsTools, + VMGuestPatchClassificationWindowsUpdateRollUp, + VMGuestPatchClassificationWindowsUpdates, + } +} + +// VMGuestPatchRebootBehavior - Describes the reboot requirements of the patch. +type VMGuestPatchRebootBehavior string + +const ( + VMGuestPatchRebootBehaviorAlwaysRequiresReboot VMGuestPatchRebootBehavior = "AlwaysRequiresReboot" + VMGuestPatchRebootBehaviorCanRequestReboot VMGuestPatchRebootBehavior = "CanRequestReboot" + VMGuestPatchRebootBehaviorNeverReboots VMGuestPatchRebootBehavior = "NeverReboots" + VMGuestPatchRebootBehaviorUnknown VMGuestPatchRebootBehavior = "Unknown" +) + +// PossibleVMGuestPatchRebootBehaviorValues returns the possible values for the VMGuestPatchRebootBehavior const type. +func PossibleVMGuestPatchRebootBehaviorValues() []VMGuestPatchRebootBehavior { + return []VMGuestPatchRebootBehavior{ + VMGuestPatchRebootBehaviorAlwaysRequiresReboot, + VMGuestPatchRebootBehaviorCanRequestReboot, + VMGuestPatchRebootBehaviorNeverReboots, + VMGuestPatchRebootBehaviorUnknown, + } +} + +// VMGuestPatchRebootSetting - Defines when it is acceptable to reboot a VM during a software update operation. +type VMGuestPatchRebootSetting string + +const ( + VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" + VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" + VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" +) + +// PossibleVMGuestPatchRebootSettingValues returns the possible values for the VMGuestPatchRebootSetting const type. +func PossibleVMGuestPatchRebootSettingValues() []VMGuestPatchRebootSetting { + return []VMGuestPatchRebootSetting{ + VMGuestPatchRebootSettingAlways, + VMGuestPatchRebootSettingIfRequired, + VMGuestPatchRebootSettingNever, + } +} + +// VMGuestPatchRebootStatus - The reboot state of the VM following completion of the operation. +type VMGuestPatchRebootStatus string + +const ( + VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" + VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" + VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" + VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" + VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" + VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" +) + +// PossibleVMGuestPatchRebootStatusValues returns the possible values for the VMGuestPatchRebootStatus const type. +func PossibleVMGuestPatchRebootStatusValues() []VMGuestPatchRebootStatus { + return []VMGuestPatchRebootStatus{ + VMGuestPatchRebootStatusCompleted, + VMGuestPatchRebootStatusFailed, + VMGuestPatchRebootStatusNotNeeded, + VMGuestPatchRebootStatusRequired, + VMGuestPatchRebootStatusStarted, + VMGuestPatchRebootStatusUnknown, + } +} + +// VirtualMachineEvictionPolicyTypes - Specifies the eviction policy for the Azure Spot VM/VMSS +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +// PossibleVirtualMachineEvictionPolicyTypesValues returns the possible values for the VirtualMachineEvictionPolicyTypes const type. +func PossibleVirtualMachineEvictionPolicyTypesValues() []VirtualMachineEvictionPolicyTypes { + return []VirtualMachineEvictionPolicyTypes{ + VirtualMachineEvictionPolicyTypesDeallocate, + VirtualMachineEvictionPolicyTypesDelete, + } +} + +// VirtualMachinePriorityTypes - Specifies the priority for a standalone virtual machine or the virtual machines in the scale +// set. +// 'Low' enum will be deprecated in the future, please use 'Spot' as the enum to deploy Azure Spot VM/VMSS. +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +// PossibleVirtualMachinePriorityTypesValues returns the possible values for the VirtualMachinePriorityTypes const type. +func PossibleVirtualMachinePriorityTypesValues() []VirtualMachinePriorityTypes { + return []VirtualMachinePriorityTypes{ + VirtualMachinePriorityTypesLow, + VirtualMachinePriorityTypesRegular, + VirtualMachinePriorityTypesSpot, + } +} + +// VirtualMachineScaleSetSKUScaleType - The scale type applicable to the sku. +type VirtualMachineScaleSetSKUScaleType string + +const ( + VirtualMachineScaleSetSKUScaleTypeAutomatic VirtualMachineScaleSetSKUScaleType = "Automatic" + VirtualMachineScaleSetSKUScaleTypeNone VirtualMachineScaleSetSKUScaleType = "None" +) + +// PossibleVirtualMachineScaleSetSKUScaleTypeValues returns the possible values for the VirtualMachineScaleSetSKUScaleType const type. +func PossibleVirtualMachineScaleSetSKUScaleTypeValues() []VirtualMachineScaleSetSKUScaleType { + return []VirtualMachineScaleSetSKUScaleType{ + VirtualMachineScaleSetSKUScaleTypeAutomatic, + VirtualMachineScaleSetSKUScaleTypeNone, + } +} + +type VirtualMachineScaleSetScaleInRules string + +const ( + VirtualMachineScaleSetScaleInRulesDefault VirtualMachineScaleSetScaleInRules = "Default" + VirtualMachineScaleSetScaleInRulesNewestVM VirtualMachineScaleSetScaleInRules = "NewestVM" + VirtualMachineScaleSetScaleInRulesOldestVM VirtualMachineScaleSetScaleInRules = "OldestVM" +) + +// PossibleVirtualMachineScaleSetScaleInRulesValues returns the possible values for the VirtualMachineScaleSetScaleInRules const type. +func PossibleVirtualMachineScaleSetScaleInRulesValues() []VirtualMachineScaleSetScaleInRules { + return []VirtualMachineScaleSetScaleInRules{ + VirtualMachineScaleSetScaleInRulesDefault, + VirtualMachineScaleSetScaleInRulesNewestVM, + VirtualMachineScaleSetScaleInRulesOldestVM, + } +} + +// VirtualMachineSizeTypes - Specifies the size of the virtual machine. +// The enum data type is currently deprecated and will be removed by December 23rd 2023. +// Recommended way to get the list of available sizes is using these APIs: +// List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes] +// List all available virtual machine sizes in a region [https://docs.microsoft.com/rest/api/compute/resourceskus/list] +// List all available virtual machine sizes for resizing [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. +// For more information about virtual machine sizes, see Sizes for +// virtual machines [https://docs.microsoft.com/azure/virtual-machines/sizes]. +// The available VM sizes depend on region and availability set. +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicA0 VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesBasicA1 VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicA2 VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicA3 VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicA4 VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesStandardA0 VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardA1 VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardA10 VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardA11 VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardA1V2 VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardA2 VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardA2MV2 VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardA2V2 VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardA3 VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardA4 VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardA4MV2 VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardA4V2 VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardA5 VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardA6 VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardA7 VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardA8 VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardA8MV2 VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardA8V2 VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardA9 VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardB1Ms VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardB1S VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardB2Ms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardB2S VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardB4Ms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardB8Ms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardD1 VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardD11 VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardD12 VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardD13 VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardD14 VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardD16SV3 VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardD16V3 VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardD2 VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardD2SV3 VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardD2V3 VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardD3 VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardD32SV3 VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardD32V3 VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardD4 VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardD4SV3 VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardD4V3 VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardD64SV3 VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardD64V3 VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardD8SV3 VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardD8V3 VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDS1 VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDS11 VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDS12 VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDS13 VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDS132V2 VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDS134V2 VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDS14 VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDS144V2 VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDS148V2 VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDS2 VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDS3 VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDS4 VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardE16SV3 VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardE16V3 VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardE2SV3 VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardE2V3 VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardE3216V3 VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardE328SV3 VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardE32SV3 VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardE32V3 VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardE4SV3 VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardE4V3 VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardE6416SV3 VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardE6432SV3 VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardE64SV3 VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardE64V3 VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardE8SV3 VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardE8V3 VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardF1 VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardF16 VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardF16S VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardF16SV2 VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardF1S VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardF2 VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardF2S VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardF2SV2 VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardF32SV2 VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardF4 VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardF4S VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardF4SV2 VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardF64SV2 VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardF72SV2 VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardF8 VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardF8S VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardF8SV2 VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardG1 VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardG2 VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardG3 VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardG4 VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardG5 VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGS1 VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGS2 VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGS3 VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGS4 VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGS44 VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGS48 VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGS5 VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGS516 VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGS58 VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardH16 VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardH16M VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardH16Mr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardH16R VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardH8 VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardH8M VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardL16S VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardL32S VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardL4S VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardL8S VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardM12832Ms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardM12864Ms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardM128Ms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardM128S VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardM6416Ms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardM6432Ms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardM64Ms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardM64S VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNC12 VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNC12SV2 VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNC12SV3 VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNC24 VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNC24R VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNC24RsV2 VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNC24RsV3 VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNC24SV2 VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNC24SV3 VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNC6 VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNC6SV2 VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNC6SV3 VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardND12S VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardND24Rs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardND24S VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardND6S VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNV12 VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNV24 VirtualMachineSizeTypes = "Standard_NV24" + VirtualMachineSizeTypesStandardNV6 VirtualMachineSizeTypes = "Standard_NV6" +) + +// PossibleVirtualMachineSizeTypesValues returns the possible values for the VirtualMachineSizeTypes const type. +func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { + return []VirtualMachineSizeTypes{ + VirtualMachineSizeTypesBasicA0, + VirtualMachineSizeTypesBasicA1, + VirtualMachineSizeTypesBasicA2, + VirtualMachineSizeTypesBasicA3, + VirtualMachineSizeTypesBasicA4, + VirtualMachineSizeTypesStandardA0, + VirtualMachineSizeTypesStandardA1, + VirtualMachineSizeTypesStandardA10, + VirtualMachineSizeTypesStandardA11, + VirtualMachineSizeTypesStandardA1V2, + VirtualMachineSizeTypesStandardA2, + VirtualMachineSizeTypesStandardA2MV2, + VirtualMachineSizeTypesStandardA2V2, + VirtualMachineSizeTypesStandardA3, + VirtualMachineSizeTypesStandardA4, + VirtualMachineSizeTypesStandardA4MV2, + VirtualMachineSizeTypesStandardA4V2, + VirtualMachineSizeTypesStandardA5, + VirtualMachineSizeTypesStandardA6, + VirtualMachineSizeTypesStandardA7, + VirtualMachineSizeTypesStandardA8, + VirtualMachineSizeTypesStandardA8MV2, + VirtualMachineSizeTypesStandardA8V2, + VirtualMachineSizeTypesStandardA9, + VirtualMachineSizeTypesStandardB1Ms, + VirtualMachineSizeTypesStandardB1S, + VirtualMachineSizeTypesStandardB2Ms, + VirtualMachineSizeTypesStandardB2S, + VirtualMachineSizeTypesStandardB4Ms, + VirtualMachineSizeTypesStandardB8Ms, + VirtualMachineSizeTypesStandardD1, + VirtualMachineSizeTypesStandardD11, + VirtualMachineSizeTypesStandardD11V2, + VirtualMachineSizeTypesStandardD12, + VirtualMachineSizeTypesStandardD12V2, + VirtualMachineSizeTypesStandardD13, + VirtualMachineSizeTypesStandardD13V2, + VirtualMachineSizeTypesStandardD14, + VirtualMachineSizeTypesStandardD14V2, + VirtualMachineSizeTypesStandardD15V2, + VirtualMachineSizeTypesStandardD16SV3, + VirtualMachineSizeTypesStandardD16V3, + VirtualMachineSizeTypesStandardD1V2, + VirtualMachineSizeTypesStandardD2, + VirtualMachineSizeTypesStandardD2SV3, + VirtualMachineSizeTypesStandardD2V2, + VirtualMachineSizeTypesStandardD2V3, + VirtualMachineSizeTypesStandardD3, + VirtualMachineSizeTypesStandardD32SV3, + VirtualMachineSizeTypesStandardD32V3, + VirtualMachineSizeTypesStandardD3V2, + VirtualMachineSizeTypesStandardD4, + VirtualMachineSizeTypesStandardD4SV3, + VirtualMachineSizeTypesStandardD4V2, + VirtualMachineSizeTypesStandardD4V3, + VirtualMachineSizeTypesStandardD5V2, + VirtualMachineSizeTypesStandardD64SV3, + VirtualMachineSizeTypesStandardD64V3, + VirtualMachineSizeTypesStandardD8SV3, + VirtualMachineSizeTypesStandardD8V3, + VirtualMachineSizeTypesStandardDS1, + VirtualMachineSizeTypesStandardDS11, + VirtualMachineSizeTypesStandardDS11V2, + VirtualMachineSizeTypesStandardDS12, + VirtualMachineSizeTypesStandardDS12V2, + VirtualMachineSizeTypesStandardDS13, + VirtualMachineSizeTypesStandardDS132V2, + VirtualMachineSizeTypesStandardDS134V2, + VirtualMachineSizeTypesStandardDS13V2, + VirtualMachineSizeTypesStandardDS14, + VirtualMachineSizeTypesStandardDS144V2, + VirtualMachineSizeTypesStandardDS148V2, + VirtualMachineSizeTypesStandardDS14V2, + VirtualMachineSizeTypesStandardDS15V2, + VirtualMachineSizeTypesStandardDS1V2, + VirtualMachineSizeTypesStandardDS2, + VirtualMachineSizeTypesStandardDS2V2, + VirtualMachineSizeTypesStandardDS3, + VirtualMachineSizeTypesStandardDS3V2, + VirtualMachineSizeTypesStandardDS4, + VirtualMachineSizeTypesStandardDS4V2, + VirtualMachineSizeTypesStandardDS5V2, + VirtualMachineSizeTypesStandardE16SV3, + VirtualMachineSizeTypesStandardE16V3, + VirtualMachineSizeTypesStandardE2SV3, + VirtualMachineSizeTypesStandardE2V3, + VirtualMachineSizeTypesStandardE3216V3, + VirtualMachineSizeTypesStandardE328SV3, + VirtualMachineSizeTypesStandardE32SV3, + VirtualMachineSizeTypesStandardE32V3, + VirtualMachineSizeTypesStandardE4SV3, + VirtualMachineSizeTypesStandardE4V3, + VirtualMachineSizeTypesStandardE6416SV3, + VirtualMachineSizeTypesStandardE6432SV3, + VirtualMachineSizeTypesStandardE64SV3, + VirtualMachineSizeTypesStandardE64V3, + VirtualMachineSizeTypesStandardE8SV3, + VirtualMachineSizeTypesStandardE8V3, + VirtualMachineSizeTypesStandardF1, + VirtualMachineSizeTypesStandardF16, + VirtualMachineSizeTypesStandardF16S, + VirtualMachineSizeTypesStandardF16SV2, + VirtualMachineSizeTypesStandardF1S, + VirtualMachineSizeTypesStandardF2, + VirtualMachineSizeTypesStandardF2S, + VirtualMachineSizeTypesStandardF2SV2, + VirtualMachineSizeTypesStandardF32SV2, + VirtualMachineSizeTypesStandardF4, + VirtualMachineSizeTypesStandardF4S, + VirtualMachineSizeTypesStandardF4SV2, + VirtualMachineSizeTypesStandardF64SV2, + VirtualMachineSizeTypesStandardF72SV2, + VirtualMachineSizeTypesStandardF8, + VirtualMachineSizeTypesStandardF8S, + VirtualMachineSizeTypesStandardF8SV2, + VirtualMachineSizeTypesStandardG1, + VirtualMachineSizeTypesStandardG2, + VirtualMachineSizeTypesStandardG3, + VirtualMachineSizeTypesStandardG4, + VirtualMachineSizeTypesStandardG5, + VirtualMachineSizeTypesStandardGS1, + VirtualMachineSizeTypesStandardGS2, + VirtualMachineSizeTypesStandardGS3, + VirtualMachineSizeTypesStandardGS4, + VirtualMachineSizeTypesStandardGS44, + VirtualMachineSizeTypesStandardGS48, + VirtualMachineSizeTypesStandardGS5, + VirtualMachineSizeTypesStandardGS516, + VirtualMachineSizeTypesStandardGS58, + VirtualMachineSizeTypesStandardH16, + VirtualMachineSizeTypesStandardH16M, + VirtualMachineSizeTypesStandardH16Mr, + VirtualMachineSizeTypesStandardH16R, + VirtualMachineSizeTypesStandardH8, + VirtualMachineSizeTypesStandardH8M, + VirtualMachineSizeTypesStandardL16S, + VirtualMachineSizeTypesStandardL32S, + VirtualMachineSizeTypesStandardL4S, + VirtualMachineSizeTypesStandardL8S, + VirtualMachineSizeTypesStandardM12832Ms, + VirtualMachineSizeTypesStandardM12864Ms, + VirtualMachineSizeTypesStandardM128Ms, + VirtualMachineSizeTypesStandardM128S, + VirtualMachineSizeTypesStandardM6416Ms, + VirtualMachineSizeTypesStandardM6432Ms, + VirtualMachineSizeTypesStandardM64Ms, + VirtualMachineSizeTypesStandardM64S, + VirtualMachineSizeTypesStandardNC12, + VirtualMachineSizeTypesStandardNC12SV2, + VirtualMachineSizeTypesStandardNC12SV3, + VirtualMachineSizeTypesStandardNC24, + VirtualMachineSizeTypesStandardNC24R, + VirtualMachineSizeTypesStandardNC24RsV2, + VirtualMachineSizeTypesStandardNC24RsV3, + VirtualMachineSizeTypesStandardNC24SV2, + VirtualMachineSizeTypesStandardNC24SV3, + VirtualMachineSizeTypesStandardNC6, + VirtualMachineSizeTypesStandardNC6SV2, + VirtualMachineSizeTypesStandardNC6SV3, + VirtualMachineSizeTypesStandardND12S, + VirtualMachineSizeTypesStandardND24Rs, + VirtualMachineSizeTypesStandardND24S, + VirtualMachineSizeTypesStandardND6S, + VirtualMachineSizeTypesStandardNV12, + VirtualMachineSizeTypesStandardNV24, + VirtualMachineSizeTypesStandardNV6, + } +} + +// WindowsPatchAssessmentMode - Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. +// Possible values are: +// ImageDefault - You control the timing of patch assessments on a virtual machine. +// AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +// PossibleWindowsPatchAssessmentModeValues returns the possible values for the WindowsPatchAssessmentMode const type. +func PossibleWindowsPatchAssessmentModeValues() []WindowsPatchAssessmentMode { + return []WindowsPatchAssessmentMode{ + WindowsPatchAssessmentModeAutomaticByPlatform, + WindowsPatchAssessmentModeImageDefault, + } +} + +// WindowsVMGuestPatchAutomaticByPlatformRebootSetting - Specifies the reboot setting for all AutomaticByPlatform patch installation +// operations. +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +// PossibleWindowsVMGuestPatchAutomaticByPlatformRebootSettingValues returns the possible values for the WindowsVMGuestPatchAutomaticByPlatformRebootSetting const type. +func PossibleWindowsVMGuestPatchAutomaticByPlatformRebootSettingValues() []WindowsVMGuestPatchAutomaticByPlatformRebootSetting { + return []WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } +} + +// WindowsVMGuestPatchMode - Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated +// to virtual machine scale set with OrchestrationMode as Flexible. +// Possible values are: +// Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the +// VM. In this mode, automatic updates are disabled; the property +// WindowsConfiguration.enableAutomaticUpdates must be false +// AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates +// must be true. +// AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and +// WindowsConfiguration.enableAutomaticUpdates must be true +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +// PossibleWindowsVMGuestPatchModeValues returns the possible values for the WindowsVMGuestPatchMode const type. +func PossibleWindowsVMGuestPatchModeValues() []WindowsVMGuestPatchMode { + return []WindowsVMGuestPatchMode{ + WindowsVMGuestPatchModeAutomaticByOS, + WindowsVMGuestPatchModeAutomaticByPlatform, + WindowsVMGuestPatchModeManual, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhostgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhostgroups_client.go new file mode 100644 index 000000000..113ed3eef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhostgroups_client.go @@ -0,0 +1,406 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DedicatedHostGroupsClient contains the methods for the DedicatedHostGroups group. +// Don't use this type directly, use NewDedicatedHostGroupsClient() instead. +type DedicatedHostGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDedicatedHostGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedHostGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DedicatedHostGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please +// see Dedicated Host Documentation [https://go.microsoft.com/fwlink/?linkid=2082596] +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// parameters - Parameters supplied to the Create Dedicated Host Group. +// options - DedicatedHostGroupsClientCreateOrUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.CreateOrUpdate +// method. +func (client *DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsClientCreateOrUpdateOptions) (DedicatedHostGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) + if err != nil { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (DedicatedHostGroupsClientCreateOrUpdateResponse, error) { + result := DedicatedHostGroupsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a dedicated host group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// options - DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete +// method. +func (client *DedicatedHostGroupsClient) Delete(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsClientDeleteOptions) (DedicatedHostGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, options) + if err != nil { + return DedicatedHostGroupsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DedicatedHostGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DedicatedHostGroupsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a dedicated host group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// options - DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method. +func (client *DedicatedHostGroupsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsClientGetOptions) (DedicatedHostGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, options) + if err != nil { + return DedicatedHostGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DedicatedHostGroupsClient) getHandleResponse(resp *http.Response) (DedicatedHostGroupsClientGetResponse, error) { + result := DedicatedHostGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all of the dedicated host groups in the specified resource group. Use the nextLink +// property in the response to get the next page of dedicated host groups. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.ListByResourceGroup +// method. +func (client *DedicatedHostGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *DedicatedHostGroupsClientListByResourceGroupOptions) *runtime.Pager[DedicatedHostGroupsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DedicatedHostGroupsClientListByResourceGroupResponse]{ + More: func(page DedicatedHostGroupsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DedicatedHostGroupsClientListByResourceGroupResponse) (DedicatedHostGroupsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedHostGroupsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DedicatedHostGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedHostGroupsClientListByResourceGroupResponse, error) { + result := DedicatedHostGroupsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { + return DedicatedHostGroupsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all of the dedicated host groups in the subscription. Use the nextLink property in the +// response to get the next page of dedicated host groups. +// Generated from API version 2022-08-01 +// options - DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.ListBySubscription +// method. +func (client *DedicatedHostGroupsClient) NewListBySubscriptionPager(options *DedicatedHostGroupsClientListBySubscriptionOptions) *runtime.Pager[DedicatedHostGroupsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[DedicatedHostGroupsClientListBySubscriptionResponse]{ + More: func(page DedicatedHostGroupsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DedicatedHostGroupsClientListBySubscriptionResponse) (DedicatedHostGroupsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedHostGroupsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DedicatedHostGroupsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (DedicatedHostGroupsClientListBySubscriptionResponse, error) { + result := DedicatedHostGroupsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { + return DedicatedHostGroupsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update an dedicated host group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// parameters - Parameters supplied to the Update Dedicated Host Group operation. +// options - DedicatedHostGroupsClientUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.Update +// method. +func (client *DedicatedHostGroupsClient) Update(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsClientUpdateOptions) (DedicatedHostGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) + if err != nil { + return DedicatedHostGroupsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *DedicatedHostGroupsClient) updateHandleResponse(resp *http.Response) (DedicatedHostGroupsClientUpdateResponse, error) { + result := DedicatedHostGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhosts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhosts_client.go new file mode 100644 index 000000000..f420efbf6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/dedicatedhosts_client.go @@ -0,0 +1,471 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DedicatedHostsClient contains the methods for the DedicatedHosts group. +// Don't use this type directly, use NewDedicatedHostsClient() instead. +type DedicatedHostsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDedicatedHostsClient creates a new instance of DedicatedHostsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDedicatedHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DedicatedHostsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DedicatedHostsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// hostName - The name of the dedicated host . +// parameters - Parameters supplied to the Create Dedicated Host. +// options - DedicatedHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginCreateOrUpdate +// method. +func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DedicatedHostsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DedicatedHostsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DedicatedHostsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Delete a dedicated host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// hostName - The name of the dedicated host. +// options - DedicatedHostsClientBeginDeleteOptions contains the optional parameters for the DedicatedHostsClient.BeginDelete +// method. +func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*runtime.Poller[DedicatedHostsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DedicatedHostsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DedicatedHostsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a dedicated host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a dedicated host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// hostName - The name of the dedicated host. +// options - DedicatedHostsClientGetOptions contains the optional parameters for the DedicatedHostsClient.Get method. +func (client *DedicatedHostsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientGetOptions) (DedicatedHostsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return DedicatedHostsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (DedicatedHostsClientGetResponse, error) { + result := DedicatedHostsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHost); err != nil { + return DedicatedHostsClientGetResponse{}, err + } + return result, nil +} + +// NewListByHostGroupPager - Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property +// in the response to get the next page of dedicated hosts. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// options - DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.ListByHostGroup +// method. +func (client *DedicatedHostsClient) NewListByHostGroupPager(resourceGroupName string, hostGroupName string, options *DedicatedHostsClientListByHostGroupOptions) *runtime.Pager[DedicatedHostsClientListByHostGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DedicatedHostsClientListByHostGroupResponse]{ + More: func(page DedicatedHostsClientListByHostGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DedicatedHostsClientListByHostGroupResponse) (DedicatedHostsClientListByHostGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByHostGroupCreateRequest(ctx, resourceGroupName, hostGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DedicatedHostsClientListByHostGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DedicatedHostsClientListByHostGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostsClientListByHostGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByHostGroupHandleResponse(resp) + }, + }) +} + +// listByHostGroupCreateRequest creates the ListByHostGroup request. +func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostsClientListByHostGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByHostGroupHandleResponse handles the ListByHostGroup response. +func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *http.Response) (DedicatedHostsClientListByHostGroupResponse, error) { + result := DedicatedHostsClientListByHostGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostListResult); err != nil { + return DedicatedHostsClientListByHostGroupResponse{}, err + } + return result, nil +} + +// BeginRestart - Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted +// and is running. To determine the health of VMs deployed on the dedicated host after the +// restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview +// for more details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// hostName - The name of the dedicated host. +// options - DedicatedHostsClientBeginRestartOptions contains the optional parameters for the DedicatedHostsClient.BeginRestart +// method. +func (client *DedicatedHostsClient) BeginRestart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*runtime.Poller[DedicatedHostsClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DedicatedHostsClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DedicatedHostsClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and +// is running. To determine the health of VMs deployed on the dedicated host after the +// restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview +// for more details. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *DedicatedHostsClient) restart(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *DedicatedHostsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update an dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// hostGroupName - The name of the dedicated host group. +// hostName - The name of the dedicated host . +// parameters - Parameters supplied to the Update Dedicated Host operation. +// options - DedicatedHostsClientBeginUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginUpdate +// method. +func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*runtime.Poller[DedicatedHostsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DedicatedHostsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DedicatedHostsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update an dedicated host . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hostGroupName == "" { + return nil, errors.New("parameter hostGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostGroupName}", url.PathEscape(hostGroupName)) + if hostName == "" { + return nil, errors.New("parameter hostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hostName}", url.PathEscape(hostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskaccesses_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskaccesses_client.go new file mode 100644 index 000000000..d15256296 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskaccesses_client.go @@ -0,0 +1,772 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DiskAccessesClient contains the methods for the DiskAccesses group. +// Don't use this type directly, use NewDiskAccessesClient() instead. +type DiskAccessesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDiskAccessesClient creates a new instance of DiskAccessesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDiskAccessesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskAccessesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DiskAccessesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a disk access resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// diskAccess - disk access object supplied in the body of the Put disk access operation. +// options - DiskAccessesClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginCreateOrUpdate +// method. +func (client *DiskAccessesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesClientBeginCreateOrUpdateOptions) (*runtime.Poller[DiskAccessesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskAccessesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskAccessesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a disk access resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskAccessesClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DiskAccessesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, diskAccess) +} + +// BeginDelete - Deletes a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// options - DiskAccessesClientBeginDeleteOptions contains the optional parameters for the DiskAccessesClient.BeginDelete +// method. +func (client *DiskAccessesClient) BeginDelete(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientBeginDeleteOptions) (*runtime.Poller[DiskAccessesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskAccessesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskAccessesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskAccessesClient) deleteOperation(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DiskAccessesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteAPrivateEndpointConnection - Deletes a private endpoint connection under a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// privateEndpointConnectionName - The name of the private endpoint connection. +// options - DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginDeleteAPrivateEndpointConnection +// method. +func (client *DiskAccessesClient) BeginDeleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions) (*runtime.Poller[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteAPrivateEndpointConnection(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskAccessesClientDeleteAPrivateEndpointConnectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteAPrivateEndpointConnection - Deletes a private endpoint connection under a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskAccessesClient) deleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions) (*http.Response, error) { + req, err := client.deleteAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteAPrivateEndpointConnectionCreateRequest creates the DeleteAPrivateEndpointConnection request. +func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// options - DiskAccessesClientGetOptions contains the optional parameters for the DiskAccessesClient.Get method. +func (client *DiskAccessesClient) Get(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetOptions) (DiskAccessesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return DiskAccessesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DiskAccessesClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DiskAccessesClient) getHandleResponse(resp *http.Response) (DiskAccessesClientGetResponse, error) { + result := DiskAccessesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccess); err != nil { + return DiskAccessesClientGetResponse{}, err + } + return result, nil +} + +// GetAPrivateEndpointConnection - Gets information about a private endpoint connection under a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// privateEndpointConnectionName - The name of the private endpoint connection. +// options - DiskAccessesClientGetAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.GetAPrivateEndpointConnection +// method. +func (client *DiskAccessesClient) GetAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientGetAPrivateEndpointConnectionOptions) (DiskAccessesClientGetAPrivateEndpointConnectionResponse, error) { + req, err := client.getAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) + if err != nil { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, runtime.NewResponseError(resp) + } + return client.getAPrivateEndpointConnectionHandleResponse(resp) +} + +// getAPrivateEndpointConnectionCreateRequest creates the GetAPrivateEndpointConnection request. +func (client *DiskAccessesClient) getAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesClientGetAPrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAPrivateEndpointConnectionHandleResponse handles the GetAPrivateEndpointConnection response. +func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleResponse(resp *http.Response) (DiskAccessesClientGetAPrivateEndpointConnectionResponse, error) { + result := DiskAccessesClientGetAPrivateEndpointConnectionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return DiskAccessesClientGetAPrivateEndpointConnectionResponse{}, err + } + return result, nil +} + +// GetPrivateLinkResources - Gets the private link resources possible under disk access resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// options - DiskAccessesClientGetPrivateLinkResourcesOptions contains the optional parameters for the DiskAccessesClient.GetPrivateLinkResources +// method. +func (client *DiskAccessesClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetPrivateLinkResourcesOptions) (DiskAccessesClientGetPrivateLinkResourcesResponse, error) { + req, err := client.getPrivateLinkResourcesCreateRequest(ctx, resourceGroupName, diskAccessName, options) + if err != nil { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, runtime.NewResponseError(resp) + } + return client.getPrivateLinkResourcesHandleResponse(resp) +} + +// getPrivateLinkResourcesCreateRequest creates the GetPrivateLinkResources request. +func (client *DiskAccessesClient) getPrivateLinkResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientGetPrivateLinkResourcesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPrivateLinkResourcesHandleResponse handles the GetPrivateLinkResources response. +func (client *DiskAccessesClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (DiskAccessesClientGetPrivateLinkResourcesResponse, error) { + result := DiskAccessesClientGetPrivateLinkResourcesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return DiskAccessesClientGetPrivateLinkResourcesResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the disk access resources under a subscription. +// Generated from API version 2022-07-02 +// options - DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.List method. +func (client *DiskAccessesClient) NewListPager(options *DiskAccessesClientListOptions) *runtime.Pager[DiskAccessesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskAccessesClientListResponse]{ + More: func(page DiskAccessesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskAccessesClientListResponse) (DiskAccessesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskAccessesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DiskAccessesClient) listCreateRequest(ctx context.Context, options *DiskAccessesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DiskAccessesClient) listHandleResponse(resp *http.Response) (DiskAccessesClientListResponse, error) { + result := DiskAccessesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { + return DiskAccessesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the disk access resources under a resource group. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// options - DiskAccessesClientListByResourceGroupOptions contains the optional parameters for the DiskAccessesClient.ListByResourceGroup +// method. +func (client *DiskAccessesClient) NewListByResourceGroupPager(resourceGroupName string, options *DiskAccessesClientListByResourceGroupOptions) *runtime.Pager[DiskAccessesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskAccessesClientListByResourceGroupResponse]{ + More: func(page DiskAccessesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskAccessesClientListByResourceGroupResponse) (DiskAccessesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskAccessesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskAccessesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DiskAccessesClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskAccessesClientListByResourceGroupResponse, error) { + result := DiskAccessesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { + return DiskAccessesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListPrivateEndpointConnectionsPager - List information about private endpoint connections under a disk access resource +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// options - DiskAccessesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the DiskAccessesClient.ListPrivateEndpointConnections +// method. +func (client *DiskAccessesClient) NewListPrivateEndpointConnectionsPager(resourceGroupName string, diskAccessName string, options *DiskAccessesClientListPrivateEndpointConnectionsOptions) *runtime.Pager[DiskAccessesClientListPrivateEndpointConnectionsResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskAccessesClientListPrivateEndpointConnectionsResponse]{ + More: func(page DiskAccessesClientListPrivateEndpointConnectionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskAccessesClientListPrivateEndpointConnectionsResponse) (DiskAccessesClientListPrivateEndpointConnectionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listPrivateEndpointConnectionsCreateRequest(ctx, resourceGroupName, diskAccessName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskAccessesClientListPrivateEndpointConnectionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskAccessesClientListPrivateEndpointConnectionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesClientListPrivateEndpointConnectionsResponse{}, runtime.NewResponseError(resp) + } + return client.listPrivateEndpointConnectionsHandleResponse(resp) + }, + }) +} + +// listPrivateEndpointConnectionsCreateRequest creates the ListPrivateEndpointConnections request. +func (client *DiskAccessesClient) listPrivateEndpointConnectionsCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesClientListPrivateEndpointConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPrivateEndpointConnectionsHandleResponse handles the ListPrivateEndpointConnections response. +func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleResponse(resp *http.Response) (DiskAccessesClientListPrivateEndpointConnectionsResponse, error) { + result := DiskAccessesClientListPrivateEndpointConnectionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return DiskAccessesClientListPrivateEndpointConnectionsResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates (patches) a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// diskAccess - disk access object supplied in the body of the Patch disk access operation. +// options - DiskAccessesClientBeginUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginUpdate +// method. +func (client *DiskAccessesClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesClientBeginUpdateOptions) (*runtime.Poller[DiskAccessesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskAccessesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskAccessesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates (patches) a disk access resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskAccessesClient) update(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DiskAccessesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, diskAccess) +} + +// BeginUpdateAPrivateEndpointConnection - Approve or reject a private endpoint connection under disk access resource, this +// can't be used to create a new private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskAccessName - The name of the disk access resource that is being created. The name can't be changed after the disk encryption +// set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The +// maximum name length is 80 characters. +// privateEndpointConnectionName - The name of the private endpoint connection. +// privateEndpointConnection - private endpoint connection object supplied in the body of the Put private endpoint connection +// operation. +// options - DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginUpdateAPrivateEndpointConnection +// method. +func (client *DiskAccessesClient) BeginUpdateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions) (*runtime.Poller[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateAPrivateEndpointConnection(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskAccessesClientUpdateAPrivateEndpointConnectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateAPrivateEndpointConnection - Approve or reject a private endpoint connection under disk access resource, this can't +// be used to create a new private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskAccessesClient) updateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions) (*http.Response, error) { + req, err := client.updateAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateAPrivateEndpointConnectionCreateRequest creates the UpdateAPrivateEndpointConnection request. +func (client *DiskAccessesClient) updateAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskAccessName == "" { + return nil, errors.New("parameter diskAccessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, privateEndpointConnection) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskencryptionsets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskencryptionsets_client.go new file mode 100644 index 000000000..b0cd01767 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskencryptionsets_client.go @@ -0,0 +1,505 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DiskEncryptionSetsClient contains the methods for the DiskEncryptionSets group. +// Don't use this type directly, use NewDiskEncryptionSetsClient() instead. +type DiskEncryptionSetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDiskEncryptionSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskEncryptionSetsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DiskEncryptionSetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a disk encryption set +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the +// disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum +// name length is 80 characters. +// diskEncryptionSet - disk encryption set object supplied in the body of the Put disk encryption set operation. +// options - DiskEncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginCreateOrUpdate +// method. +func (client *DiskEncryptionSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DiskEncryptionSetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskEncryptionSetsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskEncryptionSetsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a disk encryption set +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskEncryptionSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DiskEncryptionSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskEncryptionSetName == "" { + return nil, errors.New("parameter diskEncryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, diskEncryptionSet) +} + +// BeginDelete - Deletes a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the +// disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum +// name length is 80 characters. +// options - DiskEncryptionSetsClientBeginDeleteOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginDelete +// method. +func (client *DiskEncryptionSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientBeginDeleteOptions) (*runtime.Poller[DiskEncryptionSetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, diskEncryptionSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskEncryptionSetsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskEncryptionSetsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskEncryptionSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DiskEncryptionSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskEncryptionSetName == "" { + return nil, errors.New("parameter diskEncryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the +// disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum +// name length is 80 characters. +// options - DiskEncryptionSetsClientGetOptions contains the optional parameters for the DiskEncryptionSetsClient.Get method. +func (client *DiskEncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientGetOptions) (DiskEncryptionSetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + if err != nil { + return DiskEncryptionSetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskEncryptionSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskEncryptionSetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DiskEncryptionSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskEncryptionSetName == "" { + return nil, errors.New("parameter diskEncryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DiskEncryptionSetsClient) getHandleResponse(resp *http.Response) (DiskEncryptionSetsClientGetResponse, error) { + result := DiskEncryptionSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSet); err != nil { + return DiskEncryptionSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the disk encryption sets under a subscription. +// Generated from API version 2022-07-02 +// options - DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.List method. +func (client *DiskEncryptionSetsClient) NewListPager(options *DiskEncryptionSetsClientListOptions) *runtime.Pager[DiskEncryptionSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskEncryptionSetsClientListResponse]{ + More: func(page DiskEncryptionSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskEncryptionSetsClientListResponse) (DiskEncryptionSetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskEncryptionSetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskEncryptionSetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskEncryptionSetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DiskEncryptionSetsClient) listCreateRequest(ctx context.Context, options *DiskEncryptionSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DiskEncryptionSetsClient) listHandleResponse(resp *http.Response) (DiskEncryptionSetsClientListResponse, error) { + result := DiskEncryptionSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { + return DiskEncryptionSetsClientListResponse{}, err + } + return result, nil +} + +// NewListAssociatedResourcesPager - Lists all resources that are encrypted with this disk encryption set. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the +// disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum +// name length is 80 characters. +// options - DiskEncryptionSetsClientListAssociatedResourcesOptions contains the optional parameters for the DiskEncryptionSetsClient.ListAssociatedResources +// method. +func (client *DiskEncryptionSetsClient) NewListAssociatedResourcesPager(resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientListAssociatedResourcesOptions) *runtime.Pager[DiskEncryptionSetsClientListAssociatedResourcesResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskEncryptionSetsClientListAssociatedResourcesResponse]{ + More: func(page DiskEncryptionSetsClientListAssociatedResourcesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskEncryptionSetsClientListAssociatedResourcesResponse) (DiskEncryptionSetsClientListAssociatedResourcesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAssociatedResourcesCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskEncryptionSetsClientListAssociatedResourcesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskEncryptionSetsClientListAssociatedResourcesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskEncryptionSetsClientListAssociatedResourcesResponse{}, runtime.NewResponseError(resp) + } + return client.listAssociatedResourcesHandleResponse(resp) + }, + }) +} + +// listAssociatedResourcesCreateRequest creates the ListAssociatedResources request. +func (client *DiskEncryptionSetsClient) listAssociatedResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsClientListAssociatedResourcesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskEncryptionSetName == "" { + return nil, errors.New("parameter diskEncryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAssociatedResourcesHandleResponse handles the ListAssociatedResources response. +func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleResponse(resp *http.Response) (DiskEncryptionSetsClientListAssociatedResourcesResponse, error) { + result := DiskEncryptionSetsClientListAssociatedResourcesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceURIList); err != nil { + return DiskEncryptionSetsClientListAssociatedResourcesResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the disk encryption sets under a resource group. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// options - DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.ListByResourceGroup +// method. +func (client *DiskEncryptionSetsClient) NewListByResourceGroupPager(resourceGroupName string, options *DiskEncryptionSetsClientListByResourceGroupOptions) *runtime.Pager[DiskEncryptionSetsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskEncryptionSetsClientListByResourceGroupResponse]{ + More: func(page DiskEncryptionSetsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskEncryptionSetsClientListByResourceGroupResponse) (DiskEncryptionSetsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskEncryptionSetsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskEncryptionSetsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskEncryptionSetsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DiskEncryptionSetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskEncryptionSetsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DiskEncryptionSetsClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskEncryptionSetsClientListByResourceGroupResponse, error) { + result := DiskEncryptionSetsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { + return DiskEncryptionSetsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates (patches) a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskEncryptionSetName - The name of the disk encryption set that is being created. The name can't be changed after the +// disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum +// name length is 80 characters. +// diskEncryptionSet - disk encryption set object supplied in the body of the Patch disk encryption set operation. +// options - DiskEncryptionSetsClientBeginUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginUpdate +// method. +func (client *DiskEncryptionSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*runtime.Poller[DiskEncryptionSetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DiskEncryptionSetsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DiskEncryptionSetsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates (patches) a disk encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskEncryptionSetsClient) update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskEncryptionSetName == "" { + return nil, errors.New("parameter diskEncryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, diskEncryptionSet) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskrestorepoint_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskrestorepoint_client.go new file mode 100644 index 000000000..def372d78 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/diskrestorepoint_client.go @@ -0,0 +1,348 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DiskRestorePointClient contains the methods for the DiskRestorePoint group. +// Don't use this type directly, use NewDiskRestorePointClient() instead. +type DiskRestorePointClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDiskRestorePointClient creates a new instance of DiskRestorePointClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDiskRestorePointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiskRestorePointClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DiskRestorePointClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get disk restorePoint resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection that the disk restore point belongs. +// vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs. +// diskRestorePointName - The name of the disk restore point created. +// options - DiskRestorePointClientGetOptions contains the optional parameters for the DiskRestorePointClient.Get method. +func (client *DiskRestorePointClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientGetOptions) (DiskRestorePointClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return DiskRestorePointClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskRestorePointClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskRestorePointClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DiskRestorePointClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + if diskRestorePointName == "" { + return nil, errors.New("parameter diskRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DiskRestorePointClient) getHandleResponse(resp *http.Response) (DiskRestorePointClientGetResponse, error) { + result := DiskRestorePointClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePoint); err != nil { + return DiskRestorePointClientGetResponse{}, err + } + return result, nil +} + +// BeginGrantAccess - Grants access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection that the disk restore point belongs. +// vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs. +// diskRestorePointName - The name of the disk restore point created. +// grantAccessData - Access data object supplied in the body of the get disk access operation. +// options - DiskRestorePointClientBeginGrantAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginGrantAccess +// method. +func (client *DiskRestorePointClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointClientBeginGrantAccessOptions) (*runtime.Poller[DiskRestorePointClientGrantAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.grantAccess(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DiskRestorePointClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DiskRestorePointClientGrantAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// GrantAccess - Grants access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskRestorePointClient) grantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointClientBeginGrantAccessOptions) (*http.Response, error) { + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// grantAccessCreateRequest creates the GrantAccess request. +func (client *DiskRestorePointClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointClientBeginGrantAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + if diskRestorePointName == "" { + return nil, errors.New("parameter diskRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, grantAccessData) +} + +// NewListByRestorePointPager - Lists diskRestorePoints under a vmRestorePoint. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection that the disk restore point belongs. +// vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs. +// options - DiskRestorePointClientListByRestorePointOptions contains the optional parameters for the DiskRestorePointClient.ListByRestorePoint +// method. +func (client *DiskRestorePointClient) NewListByRestorePointPager(resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointClientListByRestorePointOptions) *runtime.Pager[DiskRestorePointClientListByRestorePointResponse] { + return runtime.NewPager(runtime.PagingHandler[DiskRestorePointClientListByRestorePointResponse]{ + More: func(page DiskRestorePointClientListByRestorePointResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DiskRestorePointClientListByRestorePointResponse) (DiskRestorePointClientListByRestorePointResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByRestorePointCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DiskRestorePointClientListByRestorePointResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DiskRestorePointClientListByRestorePointResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskRestorePointClientListByRestorePointResponse{}, runtime.NewResponseError(resp) + } + return client.listByRestorePointHandleResponse(resp) + }, + }) +} + +// listByRestorePointCreateRequest creates the ListByRestorePoint request. +func (client *DiskRestorePointClient) listByRestorePointCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointClientListByRestorePointOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByRestorePointHandleResponse handles the ListByRestorePoint response. +func (client *DiskRestorePointClient) listByRestorePointHandleResponse(resp *http.Response) (DiskRestorePointClientListByRestorePointResponse, error) { + result := DiskRestorePointClientListByRestorePointResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePointList); err != nil { + return DiskRestorePointClientListByRestorePointResponse{}, err + } + return result, nil +} + +// BeginRevokeAccess - Revokes access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection that the disk restore point belongs. +// vmRestorePointName - The name of the vm restore point that the disk disk restore point belongs. +// diskRestorePointName - The name of the disk restore point created. +// options - DiskRestorePointClientBeginRevokeAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginRevokeAccess +// method. +func (client *DiskRestorePointClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientBeginRevokeAccessOptions) (*runtime.Poller[DiskRestorePointClientRevokeAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revokeAccess(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DiskRestorePointClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DiskRestorePointClientRevokeAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// RevokeAccess - Revokes access to a diskRestorePoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DiskRestorePointClient) revokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientBeginRevokeAccessOptions) (*http.Response, error) { + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// revokeAccessCreateRequest creates the RevokeAccess request. +func (client *DiskRestorePointClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointClientBeginRevokeAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + if diskRestorePointName == "" { + return nil, errors.New("parameter diskRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/disks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/disks_client.go new file mode 100644 index 000000000..c6976316a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/disks_client.go @@ -0,0 +1,563 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DisksClient contains the methods for the Disks group. +// Don't use this type directly, use NewDisksClient() instead. +type DisksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDisksClient creates a new instance of DisksClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDisksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DisksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DisksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// disk - Disk object supplied in the body of the Put disk operation. +// options - DisksClientBeginCreateOrUpdateOptions contains the optional parameters for the DisksClient.BeginCreateOrUpdate +// method. +func (client *DisksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[DisksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DisksClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DisksClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DisksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, disk) +} + +// BeginDelete - Deletes a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// options - DisksClientBeginDeleteOptions contains the optional parameters for the DisksClient.BeginDelete method. +func (client *DisksClient) BeginDelete(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginDeleteOptions) (*runtime.Poller[DisksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DisksClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DisksClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DisksClient) deleteOperation(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DisksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets information about a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// options - DisksClientGetOptions contains the optional parameters for the DisksClient.Get method. +func (client *DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientGetOptions) (DisksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return DisksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DisksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DisksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DisksClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DisksClient) getHandleResponse(resp *http.Response) (DisksClientGetResponse, error) { + result := DisksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Disk); err != nil { + return DisksClientGetResponse{}, err + } + return result, nil +} + +// BeginGrantAccess - Grants access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// grantAccessData - Access data object supplied in the body of the get disk access operation. +// options - DisksClientBeginGrantAccessOptions contains the optional parameters for the DisksClient.BeginGrantAccess method. +func (client *DisksClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksClientBeginGrantAccessOptions) (*runtime.Poller[DisksClientGrantAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.grantAccess(ctx, resourceGroupName, diskName, grantAccessData, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DisksClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DisksClientGrantAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// GrantAccess - Grants access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DisksClient) grantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksClientBeginGrantAccessOptions) (*http.Response, error) { + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, diskName, grantAccessData, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// grantAccessCreateRequest creates the GrantAccess request. +func (client *DisksClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksClientBeginGrantAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, grantAccessData) +} + +// NewListPager - Lists all the disks under a subscription. +// Generated from API version 2022-07-02 +// options - DisksClientListOptions contains the optional parameters for the DisksClient.List method. +func (client *DisksClient) NewListPager(options *DisksClientListOptions) *runtime.Pager[DisksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DisksClientListResponse]{ + More: func(page DisksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DisksClientListResponse) (DisksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DisksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DisksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DisksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DisksClient) listCreateRequest(ctx context.Context, options *DisksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DisksClient) listHandleResponse(resp *http.Response) (DisksClientListResponse, error) { + result := DisksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { + return DisksClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the disks under a resource group. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// options - DisksClientListByResourceGroupOptions contains the optional parameters for the DisksClient.ListByResourceGroup +// method. +func (client *DisksClient) NewListByResourceGroupPager(resourceGroupName string, options *DisksClientListByResourceGroupOptions) *runtime.Pager[DisksClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DisksClientListByResourceGroupResponse]{ + More: func(page DisksClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DisksClientListByResourceGroupResponse) (DisksClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DisksClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DisksClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DisksClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DisksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DisksClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DisksClient) listByResourceGroupHandleResponse(resp *http.Response) (DisksClientListByResourceGroupResponse, error) { + result := DisksClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { + return DisksClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginRevokeAccess - Revokes access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// options - DisksClientBeginRevokeAccessOptions contains the optional parameters for the DisksClient.BeginRevokeAccess method. +func (client *DisksClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginRevokeAccessOptions) (*runtime.Poller[DisksClientRevokeAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revokeAccess(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DisksClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DisksClientRevokeAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// RevokeAccess - Revokes access to a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DisksClient) revokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginRevokeAccessOptions) (*http.Response, error) { + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, diskName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// revokeAccessCreateRequest creates the RevokeAccess request. +func (client *DisksClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksClientBeginRevokeAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginUpdate - Updates (patches) a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// diskName - The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported +// characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 +// characters. +// disk - Disk object supplied in the body of the Patch disk operation. +// options - DisksClientBeginUpdateOptions contains the optional parameters for the DisksClient.BeginUpdate method. +func (client *DisksClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksClientBeginUpdateOptions) (*runtime.Poller[DisksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DisksClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DisksClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates (patches) a disk. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *DisksClient) update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, diskName, disk, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DisksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if diskName == "" { + return nil, errors.New("parameter diskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, disk) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleries_client.go new file mode 100644 index 000000000..37f9dc9f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleries_client.go @@ -0,0 +1,432 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleriesClient contains the methods for the Galleries group. +// Don't use this type directly, use NewGalleriesClient() instead. +type GalleriesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGalleriesClient creates a new instance of GalleriesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleriesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GalleriesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods +// allowed in the middle. The maximum length is 80 characters. +// gallery - Parameters supplied to the create or update Shared Image Gallery operation. +// options - GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate +// method. +func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleriesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleriesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleriesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, gallery) +} + +// BeginDelete - Delete a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery to be deleted. +// options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. +func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*runtime.Poller[GalleriesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleriesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleriesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery. +// options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. +func (client *GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientGetOptions) (GalleriesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, options) + if err != nil { + return GalleriesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleriesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + if options != nil && options.Select != nil { + reqQP.Set("$select", string(*options.Select)) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleriesClient) getHandleResponse(resp *http.Response) (GalleriesClientGetResponse, error) { + result := GalleriesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Gallery); err != nil { + return GalleriesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List galleries under a subscription. +// Generated from API version 2022-03-03 +// options - GalleriesClientListOptions contains the optional parameters for the GalleriesClient.List method. +func (client *GalleriesClient) NewListPager(options *GalleriesClientListOptions) *runtime.Pager[GalleriesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleriesClientListResponse]{ + More: func(page GalleriesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleriesClientListResponse) (GalleriesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleriesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleriesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleriesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *GalleriesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GalleriesClient) listHandleResponse(resp *http.Response) (GalleriesClientListResponse, error) { + result := GalleriesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { + return GalleriesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List galleries under a resource group. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// options - GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.ListByResourceGroup +// method. +func (client *GalleriesClient) NewListByResourceGroupPager(resourceGroupName string, options *GalleriesClientListByResourceGroupOptions) *runtime.Pager[GalleriesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleriesClientListByResourceGroupResponse]{ + More: func(page GalleriesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleriesClientListByResourceGroupResponse) (GalleriesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleriesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleriesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleriesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *GalleriesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *http.Response) (GalleriesClientListByResourceGroupResponse, error) { + result := GalleriesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { + return GalleriesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods +// allowed in the middle. The maximum length is 80 characters. +// gallery - Parameters supplied to the update Shared Image Gallery operation. +// options - GalleriesClientBeginUpdateOptions contains the optional parameters for the GalleriesClient.BeginUpdate method. +func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*runtime.Poller[GalleriesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleriesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleriesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a Shared Image Gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleriesClient) update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, gallery) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplications_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplications_client.go new file mode 100644 index 000000000..23259ea84 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplications_client.go @@ -0,0 +1,397 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleryApplicationsClient contains the methods for the GalleryApplications group. +// Don't use this type directly, use NewGalleryApplicationsClient() instead. +type GalleryApplicationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGalleryApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryApplicationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GalleryApplicationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a gallery Application Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition is to be created. +// galleryApplicationName - The name of the gallery Application Definition to be created or updated. The allowed characters +// are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 +// characters. +// galleryApplication - Parameters supplied to the create or update gallery Application operation. +// options - GalleryApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginCreateOrUpdate +// method. +func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryApplicationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a gallery Application Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryApplication) +} + +// BeginDelete - Delete a gallery Application. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition is to be deleted. +// galleryApplicationName - The name of the gallery Application Definition to be deleted. +// options - GalleryApplicationsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationsClient.BeginDelete +// method. +func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*runtime.Poller[GalleryApplicationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a gallery Application. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a gallery Application Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery from which the Application Definitions are to be retrieved. +// galleryApplicationName - The name of the gallery Application Definition to be retrieved. +// options - GalleryApplicationsClientGetOptions contains the optional parameters for the GalleryApplicationsClient.Get method. +func (client *GalleryApplicationsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientGetOptions) (GalleryApplicationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + if err != nil { + return GalleryApplicationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryApplicationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryApplicationsClient) getHandleResponse(resp *http.Response) (GalleryApplicationsClientGetResponse, error) { + result := GalleryApplicationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplication); err != nil { + return GalleryApplicationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByGalleryPager - List gallery Application Definitions in a gallery. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery from which Application Definitions are to be listed. +// options - GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.ListByGallery +// method. +func (client *GalleryApplicationsClient) NewListByGalleryPager(resourceGroupName string, galleryName string, options *GalleryApplicationsClientListByGalleryOptions) *runtime.Pager[GalleryApplicationsClientListByGalleryResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryApplicationsClientListByGalleryResponse]{ + More: func(page GalleryApplicationsClientListByGalleryResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryApplicationsClientListByGalleryResponse) (GalleryApplicationsClientListByGalleryResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryApplicationsClientListByGalleryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryApplicationsClientListByGalleryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationsClientListByGalleryResponse{}, runtime.NewResponseError(resp) + } + return client.listByGalleryHandleResponse(resp) + }, + }) +} + +// listByGalleryCreateRequest creates the ListByGallery request. +func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryApplicationsClientListByGalleryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByGalleryHandleResponse handles the ListByGallery response. +func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *http.Response) (GalleryApplicationsClientListByGalleryResponse, error) { + result := GalleryApplicationsClientListByGalleryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationList); err != nil { + return GalleryApplicationsClientListByGalleryResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a gallery Application Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition is to be updated. +// galleryApplicationName - The name of the gallery Application Definition to be updated. The allowed characters are alphabets +// and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 +// characters. +// galleryApplication - Parameters supplied to the update gallery Application operation. +// options - GalleryApplicationsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginUpdate +// method. +func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*runtime.Poller[GalleryApplicationsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a gallery Application Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryApplication) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplicationversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplicationversions_client.go new file mode 100644 index 000000000..a932d1cc2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryapplicationversions_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleryApplicationVersionsClient contains the methods for the GalleryApplicationVersions group. +// Don't use this type directly, use NewGalleryApplicationVersionsClient() instead. +type GalleryApplicationVersionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGalleryApplicationVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryApplicationVersionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GalleryApplicationVersionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be created. +// galleryApplicationVersionName - The name of the gallery Application Version to be created. Needs to follow semantic version +// name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit +// integer. Format: .. +// galleryApplicationVersion - Parameters supplied to the create or update gallery Application Version operation. +// options - GalleryApplicationVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginCreateOrUpdate +// method. +func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryApplicationVersionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationVersionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationVersionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + if galleryApplicationVersionName == "" { + return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) +} + +// BeginDelete - Delete a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. +// galleryApplicationVersionName - The name of the gallery Application Version to be deleted. +// options - GalleryApplicationVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginDelete +// method. +func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryApplicationVersionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationVersionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationVersionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + if galleryApplicationVersionName == "" { + return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - The name of the gallery Application Definition in which the Application Version resides. +// galleryApplicationVersionName - The name of the gallery Application Version to be retrieved. +// options - GalleryApplicationVersionsClientGetOptions contains the optional parameters for the GalleryApplicationVersionsClient.Get +// method. +func (client *GalleryApplicationVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientGetOptions) (GalleryApplicationVersionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) + if err != nil { + return GalleryApplicationVersionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryApplicationVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationVersionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + if galleryApplicationVersionName == "" { + return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *http.Response) (GalleryApplicationVersionsClientGetResponse, error) { + result := GalleryApplicationVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersion); err != nil { + return GalleryApplicationVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByGalleryApplicationPager - List gallery Application Versions in a gallery Application Definition. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - The name of the Shared Application Gallery Application Definition from which the Application Versions +// are to be listed. +// options - GalleryApplicationVersionsClientListByGalleryApplicationOptions contains the optional parameters for the GalleryApplicationVersionsClient.ListByGalleryApplication +// method. +func (client *GalleryApplicationVersionsClient) NewListByGalleryApplicationPager(resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsClientListByGalleryApplicationOptions) *runtime.Pager[GalleryApplicationVersionsClientListByGalleryApplicationResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryApplicationVersionsClientListByGalleryApplicationResponse]{ + More: func(page GalleryApplicationVersionsClientListByGalleryApplicationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryApplicationVersionsClientListByGalleryApplicationResponse) (GalleryApplicationVersionsClientListByGalleryApplicationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByGalleryApplicationCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryApplicationVersionsClientListByGalleryApplicationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryApplicationVersionsClientListByGalleryApplicationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationVersionsClientListByGalleryApplicationResponse{}, runtime.NewResponseError(resp) + } + return client.listByGalleryApplicationHandleResponse(resp) + }, + }) +} + +// listByGalleryApplicationCreateRequest creates the ListByGalleryApplication request. +func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsClientListByGalleryApplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByGalleryApplicationHandleResponse handles the ListByGalleryApplication response. +func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleResponse(resp *http.Response) (GalleryApplicationVersionsClientListByGalleryApplicationResponse, error) { + result := GalleryApplicationVersionsClientListByGalleryApplicationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersionList); err != nil { + return GalleryApplicationVersionsClientListByGalleryApplicationResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Application Gallery in which the Application Definition resides. +// galleryApplicationName - The name of the gallery Application Definition in which the Application Version is to be updated. +// galleryApplicationVersionName - The name of the gallery Application Version to be updated. Needs to follow semantic version +// name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit +// integer. Format: .. +// galleryApplicationVersion - Parameters supplied to the update gallery Application Version operation. +// options - GalleryApplicationVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginUpdate +// method. +func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryApplicationVersionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryApplicationVersionsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryApplicationVersionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a gallery Application Version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryApplicationVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryApplicationName == "" { + return nil, errors.New("parameter galleryApplicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) + if galleryApplicationVersionName == "" { + return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimages_client.go new file mode 100644 index 000000000..5382768ed --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimages_client.go @@ -0,0 +1,396 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleryImagesClient contains the methods for the GalleryImages group. +// Don't use this type directly, use NewGalleryImagesClient() instead. +type GalleryImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGalleryImagesClient creates a new instance of GalleryImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GalleryImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a gallery image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition is to be created. +// galleryImageName - The name of the gallery image definition to be created or updated. The allowed characters are alphabets +// and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 +// characters. +// galleryImage - Parameters supplied to the create or update gallery image operation. +// options - GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate +// method. +func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImagesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a gallery image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryImage) +} + +// BeginDelete - Delete a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition is to be deleted. +// galleryImageName - The name of the gallery image definition to be deleted. +// options - GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete +// method. +func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryImageName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImagesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a gallery image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a gallery image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery from which the Image Definitions are to be retrieved. +// galleryImageName - The name of the gallery image definition to be retrieved. +// options - GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method. +func (client *GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (GalleryImagesClientGetResponse, error) { + result := GalleryImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImage); err != nil { + return GalleryImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListByGalleryPager - List gallery image definitions in a gallery. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery from which Image Definitions are to be listed. +// options - GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.ListByGallery +// method. +func (client *GalleryImagesClient) NewListByGalleryPager(resourceGroupName string, galleryName string, options *GalleryImagesClientListByGalleryOptions) *runtime.Pager[GalleryImagesClientListByGalleryResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryImagesClientListByGalleryResponse]{ + More: func(page GalleryImagesClientListByGalleryResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryImagesClientListByGalleryResponse) (GalleryImagesClientListByGalleryResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryImagesClientListByGalleryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryImagesClientListByGalleryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImagesClientListByGalleryResponse{}, runtime.NewResponseError(resp) + } + return client.listByGalleryHandleResponse(resp) + }, + }) +} + +// listByGalleryCreateRequest creates the ListByGallery request. +func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryImagesClientListByGalleryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByGalleryHandleResponse handles the ListByGallery response. +func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *http.Response) (GalleryImagesClientListByGalleryResponse, error) { + result := GalleryImagesClientListByGalleryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageList); err != nil { + return GalleryImagesClientListByGalleryResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a gallery image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition is to be updated. +// galleryImageName - The name of the gallery image definition to be updated. The allowed characters are alphabets and numbers +// with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters. +// galleryImage - Parameters supplied to the update gallery image operation. +// options - GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate +// method. +func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImagesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImagesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a gallery image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryImage) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimageversions_client.go new file mode 100644 index 000000000..53c148891 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/galleryimageversions_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleryImageVersionsClient contains the methods for the GalleryImageVersions group. +// Don't use this type directly, use NewGalleryImageVersionsClient() instead. +type GalleryImageVersionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryImageVersionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GalleryImageVersionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - The name of the gallery image definition in which the Image Version is to be created. +// galleryImageVersionName - The name of the gallery image version to be created. Needs to follow semantic version name pattern: +// The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. +// Format: .. +// galleryImageVersion - Parameters supplied to the create or update gallery image version operation. +// options - GalleryImageVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginCreateOrUpdate +// method. +func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImageVersionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImageVersionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImageVersionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImageVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryImageVersion) +} + +// BeginDelete - Delete a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - The name of the gallery image definition in which the Image Version resides. +// galleryImageVersionName - The name of the gallery image version to be deleted. +// options - GalleryImageVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryImageVersionsClient.BeginDelete +// method. +func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*runtime.Poller[GalleryImageVersionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImageVersionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImageVersionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImageVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - The name of the gallery image definition in which the Image Version resides. +// galleryImageVersionName - The name of the gallery image version to be retrieved. +// options - GalleryImageVersionsClientGetOptions contains the optional parameters for the GalleryImageVersionsClient.Get +// method. +func (client *GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientGetOptions) (GalleryImageVersionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return GalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImageVersionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryImageVersionsClient) getHandleResponse(resp *http.Response) (GalleryImageVersionsClientGetResponse, error) { + result := GalleryImageVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersion); err != nil { + return GalleryImageVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByGalleryImagePager - List gallery image versions in a gallery image definition. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - The name of the Shared Image Gallery Image Definition from which the Image Versions are to be listed. +// options - GalleryImageVersionsClientListByGalleryImageOptions contains the optional parameters for the GalleryImageVersionsClient.ListByGalleryImage +// method. +func (client *GalleryImageVersionsClient) NewListByGalleryImagePager(resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsClientListByGalleryImageOptions) *runtime.Pager[GalleryImageVersionsClientListByGalleryImageResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryImageVersionsClientListByGalleryImageResponse]{ + More: func(page GalleryImageVersionsClientListByGalleryImageResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryImageVersionsClientListByGalleryImageResponse) (GalleryImageVersionsClientListByGalleryImageResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByGalleryImageCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryImageVersionsClientListByGalleryImageResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GalleryImageVersionsClientListByGalleryImageResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImageVersionsClientListByGalleryImageResponse{}, runtime.NewResponseError(resp) + } + return client.listByGalleryImageHandleResponse(resp) + }, + }) +} + +// listByGalleryImageCreateRequest creates the ListByGalleryImage request. +func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsClientListByGalleryImageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByGalleryImageHandleResponse handles the ListByGalleryImage response. +func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp *http.Response) (GalleryImageVersionsClientListByGalleryImageResponse, error) { + result := GalleryImageVersionsClientListByGalleryImageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersionList); err != nil { + return GalleryImageVersionsClientListByGalleryImageResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery in which the Image Definition resides. +// galleryImageName - The name of the gallery image definition in which the Image Version is to be updated. +// galleryImageVersionName - The name of the gallery image version to be updated. Needs to follow semantic version name pattern: +// The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. +// Format: .. +// galleryImageVersion - Parameters supplied to the update gallery image version operation. +// options - GalleryImageVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginUpdate +// method. +func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*runtime.Poller[GalleryImageVersionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GalleryImageVersionsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GalleryImageVersionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a gallery image version. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GalleryImageVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, galleryImageVersion) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/gallerysharingprofile_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/gallerysharingprofile_client.go new file mode 100644 index 000000000..3874ca75f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/gallerysharingprofile_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GallerySharingProfileClient contains the methods for the GallerySharingProfile group. +// Don't use this type directly, use NewGallerySharingProfileClient() instead. +type GallerySharingProfileClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGallerySharingProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GallerySharingProfileClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GallerySharingProfileClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginUpdate - Update sharing profile of a gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// resourceGroupName - The name of the resource group. +// galleryName - The name of the Shared Image Gallery. +// sharingUpdate - Parameters supplied to the update gallery sharing profile. +// options - GallerySharingProfileClientBeginUpdateOptions contains the optional parameters for the GallerySharingProfileClient.BeginUpdate +// method. +func (client *GallerySharingProfileClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileClientBeginUpdateOptions) (*runtime.Poller[GallerySharingProfileClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, galleryName, sharingUpdate, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GallerySharingProfileClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GallerySharingProfileClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update sharing profile of a gallery. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +func (client *GallerySharingProfileClient) update(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, sharingUpdate, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if galleryName == "" { + return nil, errors.New("parameter galleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sharingUpdate) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/images_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/images_client.go new file mode 100644 index 000000000..ea18f9885 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/images_client.go @@ -0,0 +1,428 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ImagesClient contains the methods for the Images group. +// Don't use this type directly, use NewImagesClient() instead. +type ImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewImagesClient creates a new instance of ImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// imageName - The name of the image. +// parameters - Parameters supplied to the Create Image operation. +// options - ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate +// method. +func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ImagesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ImagesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ImagesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes an Image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// imageName - The name of the image. +// options - ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. +func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*runtime.Poller[ImagesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, imageName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ImagesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ImagesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes an Image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets an image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// imageName - The name of the image. +// options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. +func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientGetOptions) (ImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, imageName, options) + if err != nil { + return ImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClientGetResponse, error) { + result := ImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Image); err != nil { + return ImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the list of Images in the subscription. Use nextLink property in the response to get the next page +// of Images. Do this till nextLink is null to fetch all the Images. +// Generated from API version 2022-08-01 +// options - ImagesClientListOptions contains the optional parameters for the ImagesClient.List method. +func (client *ImagesClient) NewListPager(options *ImagesClientListOptions) *runtime.Pager[ImagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ImagesClientListResponse]{ + More: func(page ImagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImagesClientListResponse) (ImagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ImagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ImagesClient) listCreateRequest(ctx context.Context, options *ImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesClientListResponse, error) { + result := ImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { + return ImagesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets the list of images under a resource group. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.ListByResourceGroup +// method. +func (client *ImagesClient) NewListByResourceGroupPager(resourceGroupName string, options *ImagesClientListByResourceGroupOptions) *runtime.Pager[ImagesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ImagesClientListByResourceGroupResponse]{ + More: func(page ImagesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImagesClientListByResourceGroupResponse) (ImagesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ImagesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImagesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImagesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ImagesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ImagesClient) listByResourceGroupHandleResponse(resp *http.Response) (ImagesClientListByResourceGroupResponse, error) { + result := ImagesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { + return ImagesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// imageName - The name of the image. +// parameters - Parameters supplied to the Update Image operation. +// options - ImagesClientBeginUpdateOptions contains the optional parameters for the ImagesClient.BeginUpdate method. +func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*runtime.Poller[ImagesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ImagesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ImagesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update an image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/loganalytics_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/loganalytics_client.go new file mode 100644 index 000000000..51c8611dd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/loganalytics_client.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LogAnalyticsClient contains the methods for the LogAnalytics group. +// Don't use this type directly, use NewLogAnalyticsClient() instead. +type LogAnalyticsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLogAnalyticsClient creates a new instance of LogAnalyticsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogAnalyticsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LogAnalyticsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window +// to show throttling activities. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The location upon which virtual-machine-sizes is queried. +// parameters - Parameters supplied to the LogAnalytics getRequestRateByInterval Api. +// options - LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval +// method. +func (client *LogAnalyticsClient) BeginExportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*runtime.Poller[LogAnalyticsClientExportRequestRateByIntervalResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportRequestRateByInterval(ctx, location, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LogAnalyticsClientExportRequestRateByIntervalResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LogAnalyticsClientExportRequestRateByIntervalResponse](options.ResumeToken, client.pl, nil) + } +} + +// ExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to +// show throttling activities. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*http.Response, error) { + req, err := client.exportRequestRateByIntervalCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// exportRequestRateByIntervalCreateRequest creates the ExportRequestRateByInterval request. +func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsClientBeginExportRequestRateByIntervalOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time +// window. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The location upon which virtual-machine-sizes is queried. +// parameters - Parameters supplied to the LogAnalytics getThrottledRequests Api. +// options - LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests +// method. +func (client *LogAnalyticsClient) BeginExportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*runtime.Poller[LogAnalyticsClientExportThrottledRequestsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportThrottledRequests(ctx, location, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LogAnalyticsClientExportThrottledRequestsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LogAnalyticsClientExportThrottledRequestsResponse](options.ResumeToken, client.pl, nil) + } +} + +// ExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*http.Response, error) { + req, err := client.exportThrottledRequestsCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// exportThrottledRequestsCreateRequest creates the ExportThrottledRequests request. +func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsClientBeginExportThrottledRequestsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models.go new file mode 100644 index 000000000..1e09ad54a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models.go @@ -0,0 +1,9952 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import "time" + +// APIEntityReference - The API entity reference. +type APIEntityReference struct { + // The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/… + ID *string `json:"id,omitempty"` +} + +// APIError - Api error. +type APIError struct { + // The error code. + Code *string `json:"code,omitempty"` + + // The Api error details + Details []*APIErrorBase `json:"details,omitempty"` + + // The Api inner error + Innererror *InnerError `json:"innererror,omitempty"` + + // The error message. + Message *string `json:"message,omitempty"` + + // The target of the particular error. + Target *string `json:"target,omitempty"` +} + +// APIErrorBase - Api error base. +type APIErrorBase struct { + // The error code. + Code *string `json:"code,omitempty"` + + // The error message. + Message *string `json:"message,omitempty"` + + // The target of the particular error. + Target *string `json:"target,omitempty"` +} + +// AccessURI - A disk access SAS uri. +type AccessURI struct { + // READ-ONLY; A SAS uri for accessing a disk. + AccessSAS *string `json:"accessSAS,omitempty" azure:"ro"` + + // READ-ONLY; A SAS uri for accessing a VM guest state. + SecurityDataAccessSAS *string `json:"securityDataAccessSAS,omitempty" azure:"ro"` +} + +// AdditionalCapabilities - Enables or disables a capability on the virtual machine or virtual machine scale set. +type AdditionalCapabilities struct { + // The flag that enables or disables hibernation capability on the VM. + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + + // The flag that enables or disables a capability to have one or more managed data disks with UltraSSDLRS storage account + // type on the VM or VMSS. Managed disks with storage account type UltraSSDLRS can + // be added to a virtual machine or virtual machine scale set only if this property is enabled. + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} + +// AdditionalUnattendContent - Specifies additional XML formatted information that can be included in the Unattend.xml file, +// which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in +// which the content is applied. +type AdditionalUnattendContent struct { + // The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. + ComponentName *string `json:"componentName,omitempty"` + + // Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML + // must be less than 4KB and must include the root element for the setting or + // feature that is being inserted. + Content *string `json:"content,omitempty"` + + // The pass name. Currently, the only allowable value is OobeSystem. + PassName *string `json:"passName,omitempty"` + + // Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. + SettingName *SettingNames `json:"settingName,omitempty"` +} + +// ApplicationProfile - Contains the list of gallery applications that should be made available to the VM/VMSS +type ApplicationProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + GalleryApplications []*VMGalleryApplication `json:"galleryApplications,omitempty"` +} + +// AutomaticOSUpgradePolicy - The configuration parameters used for performing automatic OS upgrade. +type AutomaticOSUpgradePolicy struct { + // Whether OS image rollback feature should be disabled. Default value is false. + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` + + // Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer + // version of the OS image becomes available. Default value is false. + // If this is set to true for Windows based scale sets, enableAutomaticUpdates + // [https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet] + // is automatically set to false and cannot be set to true. + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + + // Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Default value is false. Auto OS Upgrade + // will fallback to the default policy if no policy is defined on the VMSS. + UseRollingUpgradePolicy *bool `json:"useRollingUpgradePolicy,omitempty"` +} + +// AutomaticOSUpgradeProperties - Describes automatic OS upgrade properties on the image. +type AutomaticOSUpgradeProperties struct { + // REQUIRED; Specifies whether automatic OS upgrade is supported on the image. + AutomaticOSUpgradeSupported *bool `json:"automaticOSUpgradeSupported,omitempty"` +} + +// AutomaticRepairsPolicy - Specifies the configuration parameters for automatic repairs on the virtual machine scale set. +type AutomaticRepairsPolicy struct { + // Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false. + Enabled *bool `json:"enabled,omitempty"` + + // The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the + // state change has completed. This helps avoid premature or accidental repairs. + // The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 10 minutes (PT10M), which + // is also the default value. The maximum allowed grace period is 90 minutes + // (PT90M). + GracePeriod *string `json:"gracePeriod,omitempty"` + + // Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy virtual machines in the scale + // set. Default value is replace. + RepairAction *RepairAction `json:"repairAction,omitempty"` +} + +// AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual +// machines specified in the same availability set are allocated to different nodes to maximize +// availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. +// For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] +// Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability +// set. +type AvailabilitySet struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The instance view of a resource. + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + + // Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use + // 'Aligned' for virtual machines with managed disks and 'Classic' for virtual + // machines with unmanaged disks. Default value is 'Classic'. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AvailabilitySetListResult - The List Availability Set operation response. +type AvailabilitySetListResult struct { + // REQUIRED; The list of availability sets + Value []*AvailabilitySet `json:"value,omitempty"` + + // The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailabilitySetProperties - The instance view of a resource. +type AvailabilitySetProperties struct { + // Fault Domain count. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + + // Update Domain count. + PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` + + // Specifies information about the proximity placement group that the availability set should be assigned to. + // Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + + // A list of references to all virtual machines in the availability set. + VirtualMachines []*SubResource `json:"virtualMachines,omitempty"` + + // READ-ONLY; The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty" azure:"ro"` +} + +// AvailabilitySetUpdate - Specifies information about the availability set that the virtual machine should be assigned to. +// Only tags may be updated. +type AvailabilitySetUpdate struct { + // The instance view of a resource. + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + + // Sku of the availability set + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// AvailabilitySetsClientCreateOrUpdateOptions contains the optional parameters for the AvailabilitySetsClient.CreateOrUpdate +// method. +type AvailabilitySetsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientDeleteOptions contains the optional parameters for the AvailabilitySetsClient.Delete method. +type AvailabilitySetsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method. +type AvailabilitySetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientListAvailableSizesOptions contains the optional parameters for the AvailabilitySetsClient.ListAvailableSizes +// method. +type AvailabilitySetsClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.ListBySubscription +// method. +type AvailabilitySetsClientListBySubscriptionOptions struct { + // The expand expression to apply to the operation. Allowed values are 'instanceView'. + Expand *string +} + +// AvailabilitySetsClientListOptions contains the optional parameters for the AvailabilitySetsClient.List method. +type AvailabilitySetsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailabilitySetsClientUpdateOptions contains the optional parameters for the AvailabilitySetsClient.Update method. +type AvailabilitySetsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// AvailablePatchSummary - Describes the properties of an virtual machine instance view for available patch summary. +type AvailablePatchSummary struct { + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + AssessmentActivityID *string `json:"assessmentActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 `json:"criticalAndSecurityPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *time.Time `json:"lastModifiedTime,omitempty" azure:"ro"` + + // READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 `json:"otherPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete + // installation but the reboot has not yet occurred. + RebootPending *bool `json:"rebootPending,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Unknown", "Failed", "Succeeded", or + // "CompletedWithWarnings." + Status *PatchOperationStatus `json:"status,omitempty" azure:"ro"` +} + +// BillingProfile - Specifies the billing related details of a Azure Spot VM or VMSS. +// Minimum api-version: 2019-03-01. +type BillingProfile struct { + // Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. + // This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time + // of create/update of Azure Spot VM/VMSS and the operation will only succeed if + // the maxPrice is greater than the current Azure Spot price. + // The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + // after creation of VM/VMSS. + // Possible values are: + // - Any decimal value greater than zero. Example: 0.01538 + // -1 – indicates default price to be up-to on-demand. + // You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the + // default max price is -1 if it is not provided by you. + // Minimum api-version: 2019-03-01. + MaxPrice *float64 `json:"maxPrice,omitempty"` +} + +// BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose +// VM status. +// You can easily view the output of your console log. +// Azure also enables you to see a screenshot of the VM from the hypervisor. +type BootDiagnostics struct { + // Whether boot diagnostics should be enabled on the Virtual Machine. + Enabled *bool `json:"enabled,omitempty"` + + // Uri of the storage account to use for placing the console output and screenshot. + // If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + StorageURI *string `json:"storageUri,omitempty"` +} + +// BootDiagnosticsInstanceView - The instance view of a virtual machine boot diagnostics. +type BootDiagnosticsInstanceView struct { + // READ-ONLY; The console screenshot blob URI. + // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty" azure:"ro"` + + // READ-ONLY; The serial console log blob Uri. + // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty" azure:"ro"` + + // READ-ONLY; The boot diagnostics status information for the VM. + // NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + Status *InstanceViewStatus `json:"status,omitempty" azure:"ro"` +} + +// CapacityReservation - Specifies information about the capacity reservation. +type CapacityReservation struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently + // VM Skus with the capability called 'CapacityReservationSupported' set to true are + // supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) + // for supported values. + SKU *SKU `json:"sku,omitempty"` + + // Properties of the Capacity reservation. + Properties *CapacityReservationProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // Availability Zone to use for this capacity reservation. The zone has to be single value and also should be part for the + // list of zones specified during the capacity reservation group creation. The zone + // can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If provided, + // enforces VM/VMSS using this capacity reservation to be in same zone. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CapacityReservationGroup - Specifies information about the capacity reservation group that the capacity reservations should +// be assigned to. +// Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity +// reservation cannot be added or moved to another capacity reservation group. +type CapacityReservationGroup struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, + // the group supports only regional resources in the region. If provided, + // enforces each capacity reservation in the group to be in one of the zones. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +type CapacityReservationGroupInstanceView struct { + // READ-ONLY; List of instance view of the capacity reservations under the capacity reservation group. + CapacityReservations []*CapacityReservationInstanceViewWithName `json:"capacityReservations,omitempty" azure:"ro"` +} + +// CapacityReservationGroupListResult - The List capacity reservation group with resource group response. +type CapacityReservationGroupListResult struct { + // REQUIRED; The list of capacity reservation groups + Value []*CapacityReservationGroup `json:"value,omitempty"` + + // The URI to fetch the next page of capacity reservation groups. Call ListNext() with this URI to fetch the next page of + // capacity reservation groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// CapacityReservationGroupProperties - capacity reservation group Properties. +type CapacityReservationGroupProperties struct { + // READ-ONLY; A list of all capacity reservation resource ids that belong to capacity reservation group. + CapacityReservations []*SubResourceReadOnly `json:"capacityReservations,omitempty" azure:"ro"` + + // READ-ONLY; The capacity reservation group instance view which has the list of instance views for all the capacity reservations + // that belong to the capacity reservation group. + InstanceView *CapacityReservationGroupInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to all virtual machines associated to the capacity reservation group. + VirtualMachinesAssociated []*SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty" azure:"ro"` +} + +// CapacityReservationGroupUpdate - Specifies information about the capacity reservation group. Only tags can be updated. +type CapacityReservationGroupUpdate struct { + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// CapacityReservationGroupsClientCreateOrUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.CreateOrUpdate +// method. +type CapacityReservationGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationGroupsClientDeleteOptions contains the optional parameters for the CapacityReservationGroupsClient.Delete +// method. +type CapacityReservationGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationGroupsClientGetOptions contains the optional parameters for the CapacityReservationGroupsClient.Get +// method. +type CapacityReservationGroupsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity + // reservations under the capacity reservation group which is a snapshot of the + // runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. + Expand *CapacityReservationGroupInstanceViewTypes +} + +// CapacityReservationGroupsClientListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroupsClient.ListByResourceGroup +// method. +type CapacityReservationGroupsClientListByResourceGroupOptions struct { + // The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet + // VM Instance or both resource Ids which are associated to capacity + // reservation group in the response. + Expand *ExpandTypesForGetCapacityReservationGroups +} + +// CapacityReservationGroupsClientListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroupsClient.ListBySubscription +// method. +type CapacityReservationGroupsClientListBySubscriptionOptions struct { + // The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet + // VM Instance or both resource Ids which are associated to capacity + // reservation group in the response. + Expand *ExpandTypesForGetCapacityReservationGroups +} + +// CapacityReservationGroupsClientUpdateOptions contains the optional parameters for the CapacityReservationGroupsClient.Update +// method. +type CapacityReservationGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationInstanceView - The instance view of a capacity reservation that provides as snapshot of the runtime +// properties of the capacity reservation that is managed by the platform and can change outside of control plane +// operations. +type CapacityReservationInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // Unutilized capacity of the capacity reservation. + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} + +// CapacityReservationInstanceViewWithName - The instance view of a capacity reservation that includes the name of the capacity +// reservation. It is used for the response to the instance view of a capacity reservation group. +type CapacityReservationInstanceViewWithName struct { + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // Unutilized capacity of the capacity reservation. + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` + + // READ-ONLY; The name of the capacity reservation. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// CapacityReservationListResult - The list capacity reservation operation response. +type CapacityReservationListResult struct { + // REQUIRED; The list of capacity reservations + Value []*CapacityReservation `json:"value,omitempty"` + + // The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity + // reservations. + NextLink *string `json:"nextLink,omitempty"` +} + +// CapacityReservationProfile - The parameters of a capacity reservation Profile. +type CapacityReservationProfile struct { + // Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset + // vm instances provided enough capacity has been reserved. Please refer to + // https://aka.ms/CapacityReservation for more details. + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} + +// CapacityReservationProperties - Properties of the Capacity reservation. +type CapacityReservationProperties struct { + // READ-ONLY; The Capacity reservation instance view. + InstanceView *CapacityReservationInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. + // NOTE: The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this + // value if it deploys using capacity reservation. + // Minimum api-version: 2022-08-01. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The date time when the capacity reservation was last updated. + ProvisioningTime *time.Time `json:"provisioningTime,omitempty" azure:"ro"` + + // READ-ONLY; A unique id generated and assigned to the capacity reservation by the platform which does not change throughout + // the lifetime of the resource. + ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the time at which the Capacity Reservation resource was created. + // Minimum api-version: 2021-11-01. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; A list of all virtual machine resource ids that are associated with the capacity reservation. + VirtualMachinesAssociated []*SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty" azure:"ro"` +} + +// CapacityReservationUpdate - Specifies information about the capacity reservation. Only tags and sku.capacity can be updated. +type CapacityReservationUpdate struct { + // Properties of the Capacity reservation. + Properties *CapacityReservationProperties `json:"properties,omitempty"` + + // SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM + // Skus with the capability called 'CapacityReservationSupported' set to true are + // supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) + // for supported values. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// CapacityReservationUtilization - Represents the capacity reservation utilization in terms of resources allocated. +type CapacityReservationUtilization struct { + // READ-ONLY; The value provides the current capacity of the VM size which was reserved successfully and for which the customer + // is getting billed. + // Minimum api-version: 2022-08-01. + CurrentCapacity *int32 `json:"currentCapacity,omitempty" azure:"ro"` + + // READ-ONLY; A list of all virtual machines resource ids allocated against the capacity reservation. + VirtualMachinesAllocated []*SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty" azure:"ro"` +} + +// CapacityReservationsClientBeginCreateOrUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginCreateOrUpdate +// method. +type CapacityReservationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacityReservationsClientBeginDeleteOptions contains the optional parameters for the CapacityReservationsClient.BeginDelete +// method. +type CapacityReservationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacityReservationsClientBeginUpdateOptions contains the optional parameters for the CapacityReservationsClient.BeginUpdate +// method. +type CapacityReservationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CapacityReservationsClientGetOptions contains the optional parameters for the CapacityReservationsClient.Get method. +type CapacityReservationsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity + // reservation that is managed by the platform and can change outside of + // control plane operations. + Expand *CapacityReservationInstanceViewTypes +} + +// CapacityReservationsClientListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservationsClient.ListByCapacityReservationGroup +// method. +type CapacityReservationsClientListByCapacityReservationGroupOptions struct { + // placeholder for future optional parameters +} + +// CloudService - Describes the cloud service. +type CloudService struct { + // REQUIRED; Resource location. + Location *string `json:"location,omitempty"` + + // Cloud service properties + Properties *CloudServiceProperties `json:"properties,omitempty"` + + // The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CloudServiceExtensionProfile - Describes a cloud service extension profile. +type CloudServiceExtensionProfile struct { + // List of extensions for the cloud service. + Extensions []*Extension `json:"extensions,omitempty"` +} + +// CloudServiceExtensionProperties - Extension Properties. +type CloudServiceExtensionProperties struct { + // Explicitly specify whether platform can automatically upgrade typeHandlerVersion to higher minor versions when they become + // available. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + + // Tag to force apply the provided public and protected settings. Changing the tag value allows for re-running the extension + // without changing any of the public or protected settings. If forceUpdateTag is + // not changed, updates to public or protected settings would still be applied by the handler. If neither forceUpdateTag nor + // any of public or protected settings change, extension would flow to the role + // instance with the same sequence-number, and it is up to handler implementation whether to re-run it or not + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + + // Protected settings for the extension which are encrypted before sent to the role instance. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + + // Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance. + ProtectedSettingsFromKeyVault *CloudServiceVaultAndSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + + // The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + + // Optional list of roles to apply this extension. If property is not specified or '*' is specified, extension is applied + // to all roles in the cloud service. + RolesAppliedTo []*string `json:"rolesAppliedTo,omitempty"` + + // Public settings for the extension. For JSON extensions, this is the JSON settings for the extension. For XML Extension + // (like RDP), this is the XML setting for the extension. + Settings interface{} `json:"settings,omitempty"` + + // Specifies the type of the extension. + Type *string `json:"type,omitempty"` + + // Specifies the version of the extension. Specifies the version of the extension. If this element is not specified or an + // asterisk (*) is used as the value, the latest version of the extension is used. + // If the value is specified with a major version number and an asterisk as the minor version number (X.), the latest minor + // version of the specified major version is selected. If a major version number + // and a minor version number are specified (X.Y), the specific extension version is selected. If a version is specified, + // an auto-upgrade is performed on the role instance. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// CloudServiceInstanceView - InstanceView of CloudService as a whole +type CloudServiceInstanceView struct { + // Instance view statuses. + RoleInstance *InstanceViewStatusesSummary `json:"roleInstance,omitempty"` + + // READ-ONLY; Specifies a list of unique identifiers generated internally for the cloud service. + // NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + PrivateIDs []*string `json:"privateIds,omitempty" azure:"ro"` + + // READ-ONLY; The version of the SDK that was used to generate the package for the cloud service. + SdkVersion *string `json:"sdkVersion,omitempty" azure:"ro"` + + // READ-ONLY + Statuses []*ResourceInstanceViewStatus `json:"statuses,omitempty" azure:"ro"` +} + +// CloudServiceListResult - The list operation result. +type CloudServiceListResult struct { + // REQUIRED; The list of resources. + Value []*CloudService `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// CloudServiceNetworkProfile - Network Profile for the cloud service. +type CloudServiceNetworkProfile struct { + // List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a + // Public Load Balancer and an Internal Load Balancer. + LoadBalancerConfigurations []*LoadBalancerConfiguration `json:"loadBalancerConfigurations,omitempty"` + + // Slot type for the cloud service. Possible values are + // Production + // Staging + // If not specified, the default value is Production. + SlotType *CloudServiceSlotType `json:"slotType,omitempty"` + + // The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap. + // This property cannot be updated once it is set. The swappable cloud service + // referred by this id must be present otherwise an error will be thrown. + SwappableCloudService *SubResource `json:"swappableCloudService,omitempty"` +} + +// CloudServiceOperatingSystemsClientGetOSFamilyOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSFamily +// method. +type CloudServiceOperatingSystemsClientGetOSFamilyOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceOperatingSystemsClientGetOSVersionOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.GetOSVersion +// method. +type CloudServiceOperatingSystemsClientGetOSVersionOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceOperatingSystemsClientListOSFamiliesOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.ListOSFamilies +// method. +type CloudServiceOperatingSystemsClientListOSFamiliesOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceOperatingSystemsClientListOSVersionsOptions contains the optional parameters for the CloudServiceOperatingSystemsClient.ListOSVersions +// method. +type CloudServiceOperatingSystemsClientListOSVersionsOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceOsProfile - Describes the OS profile for the cloud service. +type CloudServiceOsProfile struct { + // Specifies set of certificates that should be installed onto the role instances. + Secrets []*CloudServiceVaultSecretGroup `json:"secrets,omitempty"` +} + +// CloudServiceProperties - Cloud service properties +type CloudServiceProperties struct { + // (Optional) Indicates whether the role sku properties (roleProfile.roles.sku) specified in the model/template should override + // the role instance count and vm size specified in the .cscfg and .csdef + // respectively. The default value is false. + AllowModelOverride *bool `json:"allowModelOverride,omitempty"` + + // Specifies the XML service configuration (.cscfg) for the cloud service. + Configuration *string `json:"configuration,omitempty"` + + // Specifies a URL that refers to the location of the service configuration in the Blob service. The service package URL can + // be Shared Access Signature (SAS) URI from any storage account. This is a + // write-only property and is not returned in GET calls. + ConfigurationURL *string `json:"configurationUrl,omitempty"` + + // Describes a cloud service extension profile. + ExtensionProfile *CloudServiceExtensionProfile `json:"extensionProfile,omitempty"` + + // Network Profile for the cloud service. + NetworkProfile *CloudServiceNetworkProfile `json:"networkProfile,omitempty"` + + // Describes the OS profile for the cloud service. + OSProfile *CloudServiceOsProfile `json:"osProfile,omitempty"` + + // Specifies a URL that refers to the location of the service package in the Blob service. The service package URL can be + // Shared Access Signature (SAS) URI from any storage account. This is a write-only + // property and is not returned in GET calls. + PackageURL *string `json:"packageUrl,omitempty"` + + // Describes the role profile for the cloud service. + RoleProfile *CloudServiceRoleProfile `json:"roleProfile,omitempty"` + + // (Optional) Indicates whether to start the cloud service immediately after it is created. The default value is true. If + // false, the service model is still deployed, but the code is not run immediately. + // Instead, the service is PoweredOff until you call Start, at which time the service will be started. A deployed service + // still incurs charges, even if it is poweredoff. + StartCloudService *bool `json:"startCloudService,omitempty"` + + // Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates + // can be initiated manually in each update domain or initiated automatically in + // all update domains. Possible Values are + // Auto + // Manual + // Simultaneous + // If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If + // set to Auto, the update is automatically applied to each update domain in + // sequence. + UpgradeMode *CloudServiceUpgradeMode `json:"upgradeMode,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The unique identifier for the cloud service. + UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` +} + +// CloudServiceRole - Describes a role of the cloud service. +type CloudServiceRole struct { + // The cloud service role properties. + Properties *CloudServiceRoleProperties `json:"properties,omitempty"` + + // Describes the cloud service role sku. + SKU *CloudServiceRoleSKU `json:"sku,omitempty"` + + // READ-ONLY; Resource id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CloudServiceRoleInstancesClientBeginDeleteOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginDelete +// method. +type CloudServiceRoleInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServiceRoleInstancesClientBeginRebuildOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRebuild +// method. +type CloudServiceRoleInstancesClientBeginRebuildOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServiceRoleInstancesClientBeginReimageOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginReimage +// method. +type CloudServiceRoleInstancesClientBeginReimageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServiceRoleInstancesClientBeginRestartOptions contains the optional parameters for the CloudServiceRoleInstancesClient.BeginRestart +// method. +type CloudServiceRoleInstancesClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServiceRoleInstancesClientGetInstanceViewOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetInstanceView +// method. +type CloudServiceRoleInstancesClientGetInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceRoleInstancesClientGetOptions contains the optional parameters for the CloudServiceRoleInstancesClient.Get +// method. +type CloudServiceRoleInstancesClientGetOptions struct { + // The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + Expand *InstanceViewTypes +} + +// CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions contains the optional parameters for the CloudServiceRoleInstancesClient.GetRemoteDesktopFile +// method. +type CloudServiceRoleInstancesClientGetRemoteDesktopFileOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceRoleInstancesClientListOptions contains the optional parameters for the CloudServiceRoleInstancesClient.List +// method. +type CloudServiceRoleInstancesClientListOptions struct { + // The expand expression to apply to the operation. 'UserData' is not supported for cloud services. + Expand *InstanceViewTypes +} + +// CloudServiceRoleListResult - The list operation result. +type CloudServiceRoleListResult struct { + // REQUIRED; The list of resources. + Value []*CloudServiceRole `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// CloudServiceRoleProfile - Describes the role profile for the cloud service. +type CloudServiceRoleProfile struct { + // List of roles for the cloud service. + Roles []*CloudServiceRoleProfileProperties `json:"roles,omitempty"` +} + +// CloudServiceRoleProfileProperties - Describes the role properties. +type CloudServiceRoleProfileProperties struct { + // Resource name. + Name *string `json:"name,omitempty"` + + // Describes the cloud service role sku. + SKU *CloudServiceRoleSKU `json:"sku,omitempty"` +} + +// CloudServiceRoleProperties - The cloud service role properties. +type CloudServiceRoleProperties struct { + // READ-ONLY; Specifies the ID which uniquely identifies a cloud service role. + UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` +} + +// CloudServiceRoleSKU - Describes the cloud service role sku. +type CloudServiceRoleSKU struct { + // Specifies the number of role instances in the cloud service. + Capacity *int64 `json:"capacity,omitempty"` + + // The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is currently on, you need to delete + // and recreate the cloud service or move back to the old sku. + Name *string `json:"name,omitempty"` + + // Specifies the tier of the cloud service. Possible Values are + // Standard + // Basic + Tier *string `json:"tier,omitempty"` +} + +// CloudServiceRolesClientGetOptions contains the optional parameters for the CloudServiceRolesClient.Get method. +type CloudServiceRolesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudServiceRolesClientListOptions contains the optional parameters for the CloudServiceRolesClient.List method. +type CloudServiceRolesClientListOptions struct { + // placeholder for future optional parameters +} + +type CloudServiceUpdate struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// CloudServiceVaultAndSecretReference - Protected settings for the extension, referenced using KeyVault which are encrypted +// before sent to the role instance. +type CloudServiceVaultAndSecretReference struct { + // Secret URL which contains the protected settings of the extension + SecretURL *string `json:"secretUrl,omitempty"` + + // The ARM Resource ID of the Key Vault + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// CloudServiceVaultCertificate - Describes a single certificate reference in a Key Vault, and where the certificate should +// reside on the role instance. +type CloudServiceVaultCertificate struct { + // This is the URL of a certificate that has been uploaded to Key Vault as a secret. + CertificateURL *string `json:"certificateUrl,omitempty"` +} + +// CloudServiceVaultSecretGroup - Describes a set of certificates which are all in the same Key Vault. +type CloudServiceVaultSecretGroup struct { + // The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + SourceVault *SubResource `json:"sourceVault,omitempty"` + + // The list of key vault references in SourceVault which contain certificates. + VaultCertificates []*CloudServiceVaultCertificate `json:"vaultCertificates,omitempty"` +} + +// CloudServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudServicesClient.BeginCreateOrUpdate +// method. +type CloudServicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginDeleteInstancesOptions contains the optional parameters for the CloudServicesClient.BeginDeleteInstances +// method. +type CloudServicesClientBeginDeleteInstancesOptions struct { + // List of cloud service role instance names. + Parameters *RoleInstances + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginDeleteOptions contains the optional parameters for the CloudServicesClient.BeginDelete method. +type CloudServicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginPowerOffOptions contains the optional parameters for the CloudServicesClient.BeginPowerOff method. +type CloudServicesClientBeginPowerOffOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginRebuildOptions contains the optional parameters for the CloudServicesClient.BeginRebuild method. +type CloudServicesClientBeginRebuildOptions struct { + // List of cloud service role instance names. + Parameters *RoleInstances + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginReimageOptions contains the optional parameters for the CloudServicesClient.BeginReimage method. +type CloudServicesClientBeginReimageOptions struct { + // List of cloud service role instance names. + Parameters *RoleInstances + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginRestartOptions contains the optional parameters for the CloudServicesClient.BeginRestart method. +type CloudServicesClientBeginRestartOptions struct { + // List of cloud service role instance names. + Parameters *RoleInstances + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginStartOptions contains the optional parameters for the CloudServicesClient.BeginStart method. +type CloudServicesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientBeginUpdateOptions contains the optional parameters for the CloudServicesClient.BeginUpdate method. +type CloudServicesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesClientGetInstanceViewOptions contains the optional parameters for the CloudServicesClient.GetInstanceView +// method. +type CloudServicesClientGetInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesClientGetOptions contains the optional parameters for the CloudServicesClient.Get method. +type CloudServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesClientListAllOptions contains the optional parameters for the CloudServicesClient.ListAll method. +type CloudServicesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesClientListOptions contains the optional parameters for the CloudServicesClient.List method. +type CloudServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.BeginWalkUpdateDomain +// method. +type CloudServicesUpdateDomainClientBeginWalkUpdateDomainOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CloudServicesUpdateDomainClientGetUpdateDomainOptions contains the optional parameters for the CloudServicesUpdateDomainClient.GetUpdateDomain +// method. +type CloudServicesUpdateDomainClientGetUpdateDomainOptions struct { + // placeholder for future optional parameters +} + +// CloudServicesUpdateDomainClientListUpdateDomainsOptions contains the optional parameters for the CloudServicesUpdateDomainClient.ListUpdateDomains +// method. +type CloudServicesUpdateDomainClientListUpdateDomainsOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleriesClientGetOptions contains the optional parameters for the CommunityGalleriesClient.Get method. +type CommunityGalleriesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityGallery - Specifies information about the Community Gallery that you want to create or update. +type CommunityGallery struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier `json:"identifier,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CommunityGalleryIdentifier - The identifier information of community gallery. +type CommunityGalleryIdentifier struct { + // The unique id of this community gallery. + UniqueID *string `json:"uniqueId,omitempty"` +} + +// CommunityGalleryImage - Specifies information about the gallery image definition that you want to create or update. +type CommunityGalleryImage struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier `json:"identifier,omitempty"` + + // Describes the properties of a gallery image definition. + Properties *CommunityGalleryImageProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CommunityGalleryImageList - The List Community Gallery Images operation response. +type CommunityGalleryImageList struct { + // REQUIRED; A list of community gallery images. + Value []*CommunityGalleryImage `json:"value,omitempty"` + + // The uri to fetch the next page of community gallery images. Call ListNext() with this to fetch the next page of community + // gallery images. + NextLink *string `json:"nextLink,omitempty"` +} + +// CommunityGalleryImageProperties - Describes the properties of a gallery image definition. +type CommunityGalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier `json:"identifier,omitempty"` + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes `json:"osState,omitempty"` + + // REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a + // managed image. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture `json:"architecture,omitempty"` + + // Describes the disallowed disk types. + Disallowed *Disallowed `json:"disallowed,omitempty"` + + // The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // End-user license agreement for the current community gallery image. + Eula *string `json:"eula,omitempty"` + + // A list of gallery image features. + Features []*GalleryImageFeature `json:"features,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // Privacy statement uri for the current community gallery image. + PrivacyStatementURI *string `json:"privacyStatementUri,omitempty"` + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan `json:"purchasePlan,omitempty"` + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration `json:"recommended,omitempty"` +} + +// CommunityGalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type CommunityGalleryImageVersion struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier `json:"identifier,omitempty"` + + // Describes the properties of a gallery image version. + Properties *CommunityGalleryImageVersionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CommunityGalleryImageVersionList - The List Community Gallery Image versions operation response. +type CommunityGalleryImageVersionList struct { + // REQUIRED; A list of community gallery image versions. + Value []*CommunityGalleryImageVersion `json:"value,omitempty"` + + // The uri to fetch the next page of community gallery image versions. Call ListNext() with this to fetch the next page of + // community gallery image versions. + NextLink *string `json:"nextLink,omitempty"` +} + +// CommunityGalleryImageVersionProperties - Describes the properties of a gallery image version. +type CommunityGalleryImageVersionProperties struct { + // The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + + // The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + PublishedDate *time.Time `json:"publishedDate,omitempty"` + + // Describes the storage profile of the image version. + StorageProfile *SharedGalleryImageVersionStorageProfile `json:"storageProfile,omitempty"` +} + +// CommunityGalleryImageVersionsClientGetOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.Get +// method. +type CommunityGalleryImageVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleryImageVersionsClientListOptions contains the optional parameters for the CommunityGalleryImageVersionsClient.List +// method. +type CommunityGalleryImageVersionsClientListOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleryImagesClientGetOptions contains the optional parameters for the CommunityGalleryImagesClient.Get method. +type CommunityGalleryImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleryImagesClientListOptions contains the optional parameters for the CommunityGalleryImagesClient.List method. +type CommunityGalleryImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleryInfo - Information of community gallery if current gallery is shared to community +type CommunityGalleryInfo struct { + // End-user license agreement for community gallery image. + Eula *string `json:"eula,omitempty"` + + // The prefix of the gallery name that will be displayed publicly. Visible to all users. + PublicNamePrefix *string `json:"publicNamePrefix,omitempty"` + + // Community gallery publisher support email. The email address of the publisher. Visible to all users. + PublisherContact *string `json:"publisherContact,omitempty"` + + // The link to the publisher website. Visible to all users. + PublisherURI *string `json:"publisherUri,omitempty"` + + // READ-ONLY; Contains info about whether community gallery sharing is enabled. + CommunityGalleryEnabled *bool `json:"communityGalleryEnabled,omitempty" azure:"ro"` + + // READ-ONLY; Community gallery public name list. + PublicNames []*string `json:"publicNames,omitempty" azure:"ro"` +} + +// CopyCompletionError - Indicates the error details if the background copy of a resource created via the CopyStart operation +// fails. +type CopyCompletionError struct { + // REQUIRED; Indicates the error code if the background copy of a resource created via the CopyStart operation fails. + ErrorCode *CopyCompletionErrorReason `json:"errorCode,omitempty"` + + // REQUIRED; Indicates the error message if the background copy of a resource created via the CopyStart operation fails. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// CreationData - Data used when creating a disk. +type CreationData struct { + // REQUIRED; This enumerates the possible sources of a disk's creation. + CreateOption *DiskCreateOption `json:"createOption,omitempty"` + + // Required if creating from a Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference + // will be the ARM id of the shared galley image version from which to create a + // disk. + GalleryImageReference *ImageDiskReference `json:"galleryImageReference,omitempty"` + + // Disk source information for PIR or user images. + ImageReference *ImageDiskReference `json:"imageReference,omitempty"` + + // Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. + LogicalSectorSize *int32 `json:"logicalSectorSize,omitempty"` + + // Set this flag to true to get a boost on the performance target of the disk deployed, see here on the respective performance + // target. This flag can only be set on disk creation time and cannot be + // disabled after enabled. + PerformancePlus *bool `json:"performancePlus,omitempty"` + + // If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state. + SecurityDataURI *string `json:"securityDataUri,omitempty"` + + // If createOption is Copy, this is the ARM id of the source snapshot or disk. + SourceResourceID *string `json:"sourceResourceId,omitempty"` + + // If createOption is Import, this is the URI of a blob to be imported into a managed disk. + SourceURI *string `json:"sourceUri,omitempty"` + + // Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to + // import as a disk. + StorageAccountID *string `json:"storageAccountId,omitempty"` + + // If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be + // between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 + // bytes (32 TiB + 512 bytes for the VHD footer). + UploadSizeBytes *int64 `json:"uploadSizeBytes,omitempty"` + + // READ-ONLY; If this field is set, this is the unique id identifying the source of this resource. + SourceUniqueID *string `json:"sourceUniqueId,omitempty" azure:"ro"` +} + +// DataDisk - Describes a data disk. +type DataDisk struct { + // REQUIRED; Specifies how the virtual machine should be created. + // Possible values are: + // Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. + // FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform + // image, you also use the imageReference element described above. If you are + // using a marketplace image, you also use the plan element previously described. + CreateOption *DiskCreateOptionTypes `json:"createOption,omitempty"` + + // REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and + // therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies whether data disk should be deleted or detached upon VM deletion. + // Possible values: + // Delete If this value is used, the data disk is deleted when VM is deleted. + // Detach If this value is used, the data disk is retained after VM is deleted. + // The default value is set to detach + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + + // Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the + // virtual machine. Supported values: ForceDetach. + // detachOption: ForceDetach is applicable only for managed data disks. If a previous detachment attempt of the data disk + // did not complete due to an unexpected failure from the virtual machine and the + // disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes + // might not have been flushed when using this detach behavior. + // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update + // toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. + // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. + // If SourceImage is provided, the destination virtual hard drive must not + // exist. + Image *VirtualHardDisk `json:"image,omitempty"` + + // The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + + // The disk name. + Name *string `json:"name,omitempty"` + + // Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset + ToBeDetached *bool `json:"toBeDetached,omitempty"` + + // The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + + // READ-ONLY; Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for + // VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine + // Scale Set. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. Returned + // only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the + // VirtualMachine Scale Set. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty" azure:"ro"` +} + +// DataDiskImage - Contains the data disk images information. +type DataDiskImage struct { + // READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM + // and therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty" azure:"ro"` +} + +// DataDiskImageEncryption - Contains encryption settings for a data disk image. +type DataDiskImageEncryption struct { + // REQUIRED; This property specifies the logical unit number of the data disk. This value is used to identify data disks within + // the Virtual Machine and therefore must be unique for each data disk attached to the + // Virtual Machine. + Lun *int32 `json:"lun,omitempty"` + + // A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + +// DedicatedHost - Specifies information about the Dedicated host. +type DedicatedHost struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // REQUIRED; SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute + // SKUs for a list of possible values. + SKU *SKU `json:"sku,omitempty"` + + // Properties of the dedicated host. + Properties *DedicatedHostProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DedicatedHostAllocatableVM - Represents the dedicated host unutilized capacity in terms of a specific VM size. +type DedicatedHostAllocatableVM struct { + // Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. + Count *float64 `json:"count,omitempty"` + + // VM size in terms of which the unutilized capacity is represented. + VMSize *string `json:"vmSize,omitempty"` +} + +// DedicatedHostAvailableCapacity - Dedicated host unutilized capacity. +type DedicatedHostAvailableCapacity struct { + // The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the + // dedicated host. + AllocatableVMs []*DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} + +// DedicatedHostGroup - Specifies information about the dedicated host group that the dedicated hosts should be assigned to. +// Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot +// be added to another dedicated host group. +type DedicatedHostGroup struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Dedicated Host Group Properties. + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. + // If not provided, the group supports all zones in the region. If provided, + // enforces each host in the group to be in the same zone. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +type DedicatedHostGroupInstanceView struct { + // List of instance view of the dedicated hosts under the dedicated host group. + Hosts []*DedicatedHostInstanceViewWithName `json:"hosts,omitempty"` +} + +// DedicatedHostGroupListResult - The List Dedicated Host Group with resource group response. +type DedicatedHostGroupListResult struct { + // REQUIRED; The list of dedicated host groups + Value []*DedicatedHostGroup `json:"value,omitempty"` + + // The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI to fetch the next page of Dedicated + // Host Groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// DedicatedHostGroupProperties - Dedicated Host Group Properties. +type DedicatedHostGroupProperties struct { + // REQUIRED; Number of fault domains that the host group can span. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + + // Enables or disables a capability on the dedicated host group. + // Minimum api-version: 2022-03-01. + AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities `json:"additionalCapabilities,omitempty"` + + // Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. + // Automatic placement means resources are allocated on dedicated hosts, that are + // chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. + // Minimum api-version: 2020-06-01. + SupportAutomaticPlacement *bool `json:"supportAutomaticPlacement,omitempty"` + + // READ-ONLY; A list of references to all dedicated hosts in the dedicated host group. + Hosts []*SubResourceReadOnly `json:"hosts,omitempty" azure:"ro"` + + // READ-ONLY; The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the + // dedicated host group. + InstanceView *DedicatedHostGroupInstanceView `json:"instanceView,omitempty" azure:"ro"` +} + +// DedicatedHostGroupPropertiesAdditionalCapabilities - Enables or disables a capability on the dedicated host group. +// Minimum api-version: 2022-03-01. +type DedicatedHostGroupPropertiesAdditionalCapabilities struct { + // The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated + // Host Group. For the Virtual Machines to be UltraSSD Enabled, + // UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided. + // Please refer to + // https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. + // NOTE: The ultraSSDEnabled setting can only be enabled for Host Groups that are created as zonal. + // Minimum api-version: 2022-03-01. + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} + +// DedicatedHostGroupUpdate - Specifies information about the dedicated host group that the dedicated host should be assigned +// to. Only tags may be updated. +type DedicatedHostGroupUpdate struct { + // Dedicated Host Group Properties. + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. + // If not provided, the group supports all zones in the region. If provided, + // enforces each host in the group to be in the same zone. + Zones []*string `json:"zones,omitempty"` +} + +// DedicatedHostGroupsClientCreateOrUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.CreateOrUpdate +// method. +type DedicatedHostGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostGroupsClientDeleteOptions contains the optional parameters for the DedicatedHostGroupsClient.Delete method. +type DedicatedHostGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostGroupsClientGetOptions contains the optional parameters for the DedicatedHostGroupsClient.Get method. +type DedicatedHostGroupsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated + // hosts under the dedicated host group. 'UserData' is not supported for + // dedicated host group. + Expand *InstanceViewTypes +} + +// DedicatedHostGroupsClientListByResourceGroupOptions contains the optional parameters for the DedicatedHostGroupsClient.ListByResourceGroup +// method. +type DedicatedHostGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostGroupsClientListBySubscriptionOptions contains the optional parameters for the DedicatedHostGroupsClient.ListBySubscription +// method. +type DedicatedHostGroupsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostGroupsClientUpdateOptions contains the optional parameters for the DedicatedHostGroupsClient.Update method. +type DedicatedHostGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DedicatedHostInstanceView - The instance view of a dedicated host. +type DedicatedHostInstanceView struct { + // Unutilized capacity of the dedicated host. + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string `json:"assetId,omitempty" azure:"ro"` +} + +// DedicatedHostInstanceViewWithName - The instance view of a dedicated host that includes the name of the dedicated host. +// It is used for the response to the instance view of a dedicated host group. +type DedicatedHostInstanceViewWithName struct { + // Unutilized capacity of the dedicated host. + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string `json:"assetId,omitempty" azure:"ro"` + + // READ-ONLY; The name of the dedicated host. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// DedicatedHostListResult - The list dedicated host operation response. +type DedicatedHostListResult struct { + // REQUIRED; The list of dedicated hosts + Value []*DedicatedHost `json:"value,omitempty"` + + // The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to fetch the next page of dedicated hosts. + NextLink *string `json:"nextLink,omitempty"` +} + +// DedicatedHostProperties - Properties of the dedicated host. +type DedicatedHostProperties struct { + // Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' + // when not provided. + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + + // Specifies the software license type that will be applied to the VMs deployed on the dedicated host. + // Possible values are: + // None + // WindowsServerHybrid + // WindowsServerPerpetual + // Default: None + LicenseType *DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + + // Fault domain of the dedicated host within a dedicated host group. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + + // READ-ONLY; A unique id generated and assigned to the dedicated host by the platform. + // Does not change throughout the lifetime of the host. + HostID *string `json:"hostId,omitempty" azure:"ro"` + + // READ-ONLY; The dedicated host instance view. + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The date when the host was first provisioned. + ProvisioningTime *time.Time `json:"provisioningTime,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the time at which the Dedicated Host resource was created. + // Minimum api-version: 2021-11-01. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to all virtual machines in the Dedicated Host. + VirtualMachines []*SubResourceReadOnly `json:"virtualMachines,omitempty" azure:"ro"` +} + +// DedicatedHostUpdate - Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may +// be updated. +type DedicatedHostUpdate struct { + // Properties of the dedicated host. + Properties *DedicatedHostProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// DedicatedHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginCreateOrUpdate +// method. +type DedicatedHostsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DedicatedHostsClientBeginDeleteOptions contains the optional parameters for the DedicatedHostsClient.BeginDelete method. +type DedicatedHostsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DedicatedHostsClientBeginRestartOptions contains the optional parameters for the DedicatedHostsClient.BeginRestart method. +type DedicatedHostsClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DedicatedHostsClientBeginUpdateOptions contains the optional parameters for the DedicatedHostsClient.BeginUpdate method. +type DedicatedHostsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DedicatedHostsClientGetOptions contains the optional parameters for the DedicatedHostsClient.Get method. +type DedicatedHostsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated + // host. 'UserData' is not supported for dedicated host. + Expand *InstanceViewTypes +} + +// DedicatedHostsClientListByHostGroupOptions contains the optional parameters for the DedicatedHostsClient.ListByHostGroup +// method. +type DedicatedHostsClientListByHostGroupOptions struct { + // placeholder for future optional parameters +} + +// DiagnosticsProfile - Specifies the boot diagnostic settings state. +// Minimum api-version: 2015-06-15. +type DiagnosticsProfile struct { + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. + // NOTE: If storageUri is being specified then ensure that the storage account is in the same region and subscription as the + // VM. + // You can easily view the output of your console log. + // Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} + +// DiffDiskSettings - Describes the parameters of ephemeral disk settings that can be specified for operating system disk. +// NOTE: The ephemeral disk settings can only be specified for managed disk. +type DiffDiskSettings struct { + // Specifies the ephemeral disk settings for operating system disk. + Option *DiffDiskOptions `json:"option,omitempty"` + + // Specifies the ephemeral disk placement for operating system disk. + // Possible values are: + // CacheDisk + // ResourceDisk + // Default: CacheDisk if one is configured for the VM size otherwise ResourceDisk is used. + // Refer to VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux + // VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check + // which VM sizes exposes a cache disk. + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} + +// Disallowed - Describes the disallowed disk types. +type Disallowed struct { + // A list of disk types. + DiskTypes []*string `json:"diskTypes,omitempty"` +} + +// DisallowedConfiguration - Specifies the disallowed configuration for a virtual machine image. +type DisallowedConfiguration struct { + // VM disk types which are disallowed. + VMDiskType *VMDiskTypes `json:"vmDiskType,omitempty"` +} + +// Disk resource. +type Disk struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location where the disk will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Disk resource properties. + Properties *DiskProperties `json:"properties,omitempty"` + + // The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS. + SKU *DiskSKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // The Logical zone list for Disk. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + ManagedBy *string `json:"managedBy,omitempty" azure:"ro"` + + // READ-ONLY; List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to + // a value greater than one for disks to allow attaching them to multiple VMs. + ManagedByExtended []*string `json:"managedByExtended,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiskAccess - disk access resource. +type DiskAccess struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location where the disk access will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + Properties *DiskAccessProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiskAccessList - The List disk access operation response. +type DiskAccessList struct { + // REQUIRED; A list of disk access resources. + Value []*DiskAccess `json:"value,omitempty"` + + // The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access + // resources. + NextLink *string `json:"nextLink,omitempty"` +} + +type DiskAccessProperties struct { + // READ-ONLY; A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection + // is supported. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; The disk access resource provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The time when the disk access was created. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` +} + +// DiskAccessUpdate - Used for updating a disk access resource. +type DiskAccessUpdate struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// DiskAccessesClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginCreateOrUpdate +// method. +type DiskAccessesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginDeleteAPrivateEndpointConnection +// method. +type DiskAccessesClientBeginDeleteAPrivateEndpointConnectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskAccessesClientBeginDeleteOptions contains the optional parameters for the DiskAccessesClient.BeginDelete method. +type DiskAccessesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.BeginUpdateAPrivateEndpointConnection +// method. +type DiskAccessesClientBeginUpdateAPrivateEndpointConnectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskAccessesClientBeginUpdateOptions contains the optional parameters for the DiskAccessesClient.BeginUpdate method. +type DiskAccessesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskAccessesClientGetAPrivateEndpointConnectionOptions contains the optional parameters for the DiskAccessesClient.GetAPrivateEndpointConnection +// method. +type DiskAccessesClientGetAPrivateEndpointConnectionOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientGetOptions contains the optional parameters for the DiskAccessesClient.Get method. +type DiskAccessesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientGetPrivateLinkResourcesOptions contains the optional parameters for the DiskAccessesClient.GetPrivateLinkResources +// method. +type DiskAccessesClientGetPrivateLinkResourcesOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientListByResourceGroupOptions contains the optional parameters for the DiskAccessesClient.ListByResourceGroup +// method. +type DiskAccessesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientListOptions contains the optional parameters for the DiskAccessesClient.List method. +type DiskAccessesClientListOptions struct { + // placeholder for future optional parameters +} + +// DiskAccessesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the DiskAccessesClient.ListPrivateEndpointConnections +// method. +type DiskAccessesClientListPrivateEndpointConnectionsOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSet - disk encryption set resource. +type DiskEncryptionSet struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used + // to encrypt disks. + Identity *EncryptionSetIdentity `json:"identity,omitempty"` + Properties *EncryptionSetProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiskEncryptionSetList - The List disk encryption set operation response. +type DiskEncryptionSetList struct { + // REQUIRED; A list of disk encryption sets. + Value []*DiskEncryptionSet `json:"value,omitempty"` + + // The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption + // sets. + NextLink *string `json:"nextLink,omitempty"` +} + +// DiskEncryptionSetParameters - Describes the parameter of customer managed disk encryption set resource id that can be specified +// for disk. +// NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview +// for more details. +type DiskEncryptionSetParameters struct { + // Resource Id + ID *string `json:"id,omitempty"` +} + +// DiskEncryptionSetUpdate - disk encryption set update resource. +type DiskEncryptionSetUpdate struct { + // The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used + // to encrypt disks. + Identity *EncryptionSetIdentity `json:"identity,omitempty"` + + // disk encryption set resource update properties. + Properties *DiskEncryptionSetUpdateProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// DiskEncryptionSetUpdateProperties - disk encryption set resource update properties. +type DiskEncryptionSetUpdateProperties struct { + // Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots + ActiveKey *KeyForDiskEncryptionSet `json:"activeKey,omitempty"` + + // The type of key used to encrypt the data of the disk. + EncryptionType *DiskEncryptionSetType `json:"encryptionType,omitempty"` + + // Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the + // property. + FederatedClientID *string `json:"federatedClientId,omitempty"` + + // Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. + RotationToLatestKeyVersionEnabled *bool `json:"rotationToLatestKeyVersionEnabled,omitempty"` +} + +// DiskEncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginCreateOrUpdate +// method. +type DiskEncryptionSetsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskEncryptionSetsClientBeginDeleteOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginDelete +// method. +type DiskEncryptionSetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskEncryptionSetsClientBeginUpdateOptions contains the optional parameters for the DiskEncryptionSetsClient.BeginUpdate +// method. +type DiskEncryptionSetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskEncryptionSetsClientGetOptions contains the optional parameters for the DiskEncryptionSetsClient.Get method. +type DiskEncryptionSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSetsClientListAssociatedResourcesOptions contains the optional parameters for the DiskEncryptionSetsClient.ListAssociatedResources +// method. +type DiskEncryptionSetsClientListAssociatedResourcesOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSetsClientListByResourceGroupOptions contains the optional parameters for the DiskEncryptionSetsClient.ListByResourceGroup +// method. +type DiskEncryptionSetsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSetsClientListOptions contains the optional parameters for the DiskEncryptionSetsClient.List method. +type DiskEncryptionSetsClientListOptions struct { + // placeholder for future optional parameters +} + +// DiskEncryptionSettings - Describes a Encryption Settings for a Disk +type DiskEncryptionSettings struct { + // Specifies the location of the disk encryption key, which is a Key Vault Secret. + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + + // Specifies whether disk encryption should be enabled on the virtual machine. + Enabled *bool `json:"enabled,omitempty"` + + // Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} + +// DiskImageEncryption - This is the disk image encryption base class. +type DiskImageEncryption struct { + // A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + +// DiskInstanceView - The instance view of the disk. +type DiskInstanceView struct { + // Specifies the encryption settings for the OS Disk. + // Minimum api-version: 2015-06-15 + EncryptionSettings []*DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + + // The disk name. + Name *string `json:"name,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` +} + +// DiskList - The List Disks operation response. +type DiskList struct { + // REQUIRED; A list of disks. + Value []*Disk `json:"value,omitempty"` + + // The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. + NextLink *string `json:"nextLink,omitempty"` +} + +// DiskProperties - Disk resource properties. +type DiskProperties struct { + // REQUIRED; Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + + // Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. + // Does not apply to Ultra disks. + BurstingEnabled *bool `json:"burstingEnabled,omitempty"` + + // Percentage complete for the background copy when a resource is created via the CopyStart operation. + CompletionPercent *float32 `json:"completionPercent,omitempty"` + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode `json:"dataAccessAuthMode,omitempty"` + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string `json:"diskAccessId,omitempty"` + + // The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer + // between 4k and 256k bytes. + DiskIOPSReadOnly *int64 `json:"diskIOPSReadOnly,omitempty"` + + // The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k + // bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + + // The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions + // of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadOnly *int64 `json:"diskMBpsReadOnly,omitempty"` + + // The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here + // uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + + // If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this + // field is present for updates or creation with other options, it indicates a + // resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + + // Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can + // be mounted on multiple VMs at the same time. + MaxShares *int32 `json:"maxShares,omitempty"` + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + // The Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times + // a day) by detached from one virtual machine and attached to another. This + // property should not be set for disks that are not detached and attached frequently as it causes the disks to not align + // with the fault domain of the virtual machine. + OptimizedForFrequentAttach *bool `json:"optimizedForFrequentAttach,omitempty"` + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: + // MicrosoftWindowsServer, product: WindowsServer} + PurchasePlan *DiskPurchasePlan `json:"purchasePlan,omitempty"` + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile `json:"securityProfile,omitempty"` + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities `json:"supportedCapabilities,omitempty"` + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool `json:"supportsHibernation,omitempty"` + + // Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + // Does not apply to Ultra disks. + Tier *string `json:"tier,omitempty"` + + // READ-ONLY; Latest time when bursting was last enabled on a disk. + BurstingEnabledTime *time.Time `json:"burstingEnabledTime,omitempty" azure:"ro"` + + // READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 `json:"diskSizeBytes,omitempty" azure:"ro"` + + // READ-ONLY; The state of the disk. + DiskState *DiskState `json:"diskState,omitempty" azure:"ro"` + + // READ-ONLY; Properties of the disk for which update is pending. + PropertyUpdatesInProgress *PropertyUpdatesInProgress `json:"propertyUpdatesInProgress,omitempty" azure:"ro"` + + // READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than + // one for disks to allow attaching them to multiple VMs. + ShareInfo []*ShareInfoElement `json:"shareInfo,omitempty" azure:"ro"` + + // READ-ONLY; The time when the disk was created. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; Unique Guid identifying the resource. + UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` +} + +// DiskPurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +type DiskPurchasePlan struct { + // REQUIRED; The plan ID. + Name *string `json:"name,omitempty"` + + // REQUIRED; Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference + // element. + Product *string `json:"product,omitempty"` + + // REQUIRED; The publisher ID. + Publisher *string `json:"publisher,omitempty"` + + // The Offer Promotion Code. + PromotionCode *string `json:"promotionCode,omitempty"` +} + +// DiskRestorePoint - Properties of disk restore point +type DiskRestorePoint struct { + // Properties of an incremental disk restore point + Properties *DiskRestorePointProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DiskRestorePointClientBeginGrantAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginGrantAccess +// method. +type DiskRestorePointClientBeginGrantAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskRestorePointClientBeginRevokeAccessOptions contains the optional parameters for the DiskRestorePointClient.BeginRevokeAccess +// method. +type DiskRestorePointClientBeginRevokeAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DiskRestorePointClientGetOptions contains the optional parameters for the DiskRestorePointClient.Get method. +type DiskRestorePointClientGetOptions struct { + // placeholder for future optional parameters +} + +// DiskRestorePointClientListByRestorePointOptions contains the optional parameters for the DiskRestorePointClient.ListByRestorePoint +// method. +type DiskRestorePointClientListByRestorePointOptions struct { + // placeholder for future optional parameters +} + +// DiskRestorePointInstanceView - The instance view of a disk restore point. +type DiskRestorePointInstanceView struct { + // Disk restore point Id. + ID *string `json:"id,omitempty"` + + // The disk restore point replication status information. + ReplicationStatus *DiskRestorePointReplicationStatus `json:"replicationStatus,omitempty"` +} + +// DiskRestorePointList - The List Disk Restore Points operation response. +type DiskRestorePointList struct { + // REQUIRED; A list of disk restore points. + Value []*DiskRestorePoint `json:"value,omitempty"` + + // The uri to fetch the next page of disk restore points. Call ListNext() with this to fetch the next page of disk restore + // points. + NextLink *string `json:"nextLink,omitempty"` +} + +// DiskRestorePointProperties - Properties of an incremental disk restore point +type DiskRestorePointProperties struct { + // Percentage complete for the background copy of disk restore point when source resource is from a different region. + CompletionPercent *float32 `json:"completionPercent,omitempty"` + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string `json:"diskAccessId,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Purchase plan information for the the image from which the OS disk was created. + PurchasePlan *DiskPurchasePlan `json:"purchasePlan,omitempty"` + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile `json:"securityProfile,omitempty"` + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities `json:"supportedCapabilities,omitempty"` + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool `json:"supportsHibernation,omitempty"` + + // READ-ONLY; Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty" azure:"ro"` + + // READ-ONLY; id of the backing snapshot's MIS family + FamilyID *string `json:"familyId,omitempty" azure:"ro"` + + // READ-ONLY; The Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty" azure:"ro"` + + // READ-ONLY; Replication state of disk restore point when source resource is from a different region. + ReplicationState *string `json:"replicationState,omitempty" azure:"ro"` + + // READ-ONLY; arm id of source disk or source disk restore point. + SourceResourceID *string `json:"sourceResourceId,omitempty" azure:"ro"` + + // READ-ONLY; Location of source disk or source disk restore point when source resource is from a different region. + SourceResourceLocation *string `json:"sourceResourceLocation,omitempty" azure:"ro"` + + // READ-ONLY; unique incarnation id of the source disk + SourceUniqueID *string `json:"sourceUniqueId,omitempty" azure:"ro"` + + // READ-ONLY; The timestamp of restorePoint creation + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` +} + +// DiskRestorePointReplicationStatus - The instance view of a disk restore point. +type DiskRestorePointReplicationStatus struct { + // Replication completion percentage. + CompletionPercent *int32 `json:"completionPercent,omitempty"` + + // The resource status information. + Status *InstanceViewStatus `json:"status,omitempty"` +} + +// DiskSKU - The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, +// or PremiumV2_LRS. +type DiskSKU struct { + // The sku name. + Name *DiskStorageAccountTypes `json:"name,omitempty"` + + // READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty" azure:"ro"` +} + +// DiskSecurityProfile - Contains the security related information for the resource. +type DiskSecurityProfile struct { + // ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key + SecureVMDiskEncryptionSetID *string `json:"secureVMDiskEncryptionSetId,omitempty"` + + // Specifies the SecurityType of the VM. Applicable for OS disks only. + SecurityType *DiskSecurityTypes `json:"securityType,omitempty"` +} + +// DiskUpdate - Disk update resource. +type DiskUpdate struct { + // Disk resource update properties. + Properties *DiskUpdateProperties `json:"properties,omitempty"` + + // The disks sku name. Can be StandardLRS, PremiumLRS, StandardSSDLRS, UltraSSDLRS, PremiumZRS, StandardSSDZRS, or PremiumV2_LRS. + SKU *DiskSKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// DiskUpdateProperties - Disk resource update properties. +type DiskUpdateProperties struct { + // Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. + // Does not apply to Ultra disks. + BurstingEnabled *bool `json:"burstingEnabled,omitempty"` + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode `json:"dataAccessAuthMode,omitempty"` + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string `json:"diskAccessId,omitempty"` + + // The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer + // between 4k and 256k bytes. + DiskIOPSReadOnly *int64 `json:"diskIOPSReadOnly,omitempty"` + + // The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k + // bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + + // The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions + // of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadOnly *int64 `json:"diskMBpsReadOnly,omitempty"` + + // The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here + // uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + + // If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this + // field is present for updates or creation with other options, it indicates a + // resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + + // The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can + // be mounted on multiple VMs at the same time. + MaxShares *int32 `json:"maxShares,omitempty"` + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + // the Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times + // a day) by detached from one virtual machine and attached to another. This + // property should not be set for disks that are not detached and attached frequently as it causes the disks to not align + // with the fault domain of the virtual machine. + OptimizedForFrequentAttach *bool `json:"optimizedForFrequentAttach,omitempty"` + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Purchase plan information to be added on the OS disk + PurchasePlan *DiskPurchasePlan `json:"purchasePlan,omitempty"` + + // List of supported capabilities to be added on the OS disk. + SupportedCapabilities *SupportedCapabilities `json:"supportedCapabilities,omitempty"` + + // Indicates the OS on a disk supports hibernation. + SupportsHibernation *bool `json:"supportsHibernation,omitempty"` + + // Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. + // Does not apply to Ultra disks. + Tier *string `json:"tier,omitempty"` + + // READ-ONLY; Properties of the disk for which update is pending. + PropertyUpdatesInProgress *PropertyUpdatesInProgress `json:"propertyUpdatesInProgress,omitempty" azure:"ro"` +} + +// DisksClientBeginCreateOrUpdateOptions contains the optional parameters for the DisksClient.BeginCreateOrUpdate method. +type DisksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DisksClientBeginDeleteOptions contains the optional parameters for the DisksClient.BeginDelete method. +type DisksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DisksClientBeginGrantAccessOptions contains the optional parameters for the DisksClient.BeginGrantAccess method. +type DisksClientBeginGrantAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DisksClientBeginRevokeAccessOptions contains the optional parameters for the DisksClient.BeginRevokeAccess method. +type DisksClientBeginRevokeAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DisksClientBeginUpdateOptions contains the optional parameters for the DisksClient.BeginUpdate method. +type DisksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DisksClientGetOptions contains the optional parameters for the DisksClient.Get method. +type DisksClientGetOptions struct { + // placeholder for future optional parameters +} + +// DisksClientListByResourceGroupOptions contains the optional parameters for the DisksClient.ListByResourceGroup method. +type DisksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DisksClientListOptions contains the optional parameters for the DisksClient.List method. +type DisksClientListOptions struct { + // placeholder for future optional parameters +} + +// Encryption at rest settings for disk or snapshot +type Encryption struct { + // ResourceId of the disk encryption set to use for enabling encryption at rest. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` + + // The type of key used to encrypt the data of the disk. + Type *EncryptionType `json:"type,omitempty"` +} + +// EncryptionImages - Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the +// gallery artifact. +type EncryptionImages struct { + // A list of encryption specifications for data disk images. + DataDiskImages []*DataDiskImageEncryption `json:"dataDiskImages,omitempty"` + + // Contains encryption settings for an OS disk image. + OSDiskImage *OSDiskImageEncryption `json:"osDiskImage,omitempty"` +} + +// EncryptionSetIdentity - The managed identity for the disk encryption set. It should be given permission on the key vault +// before it can be used to encrypt disks. +type EncryptionSetIdentity struct { + // The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption + // Sets can be updated with Identity type None during migration of + // subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. + Type *DiskEncryptionSetIdentityType `json:"type,omitempty"` + + // The list of user identities associated with the disk encryption set. 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]*UserAssignedIdentitiesValue `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id + // header in the PUT request if the resource has a systemAssigned(implicit) + // identity + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id + // header in the PUT request if the resource has a systemAssigned(implicit) identity + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +type EncryptionSetProperties struct { + // The key vault key which is currently used by this disk encryption set. + ActiveKey *KeyForDiskEncryptionSet `json:"activeKey,omitempty"` + + // The type of key used to encrypt the data of the disk. + EncryptionType *DiskEncryptionSetType `json:"encryptionType,omitempty"` + + // Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the + // property. + FederatedClientID *string `json:"federatedClientId,omitempty"` + + // Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. + RotationToLatestKeyVersionEnabled *bool `json:"rotationToLatestKeyVersionEnabled,omitempty"` + + // READ-ONLY; The error that was encountered during auto-key rotation. If an error is present, then auto-key rotation will + // not be attempted until the error on this disk encryption set is fixed. + AutoKeyRotationError *APIError `json:"autoKeyRotationError,omitempty" azure:"ro"` + + // READ-ONLY; The time when the active key of this disk encryption set was updated. + LastKeyRotationTimestamp *time.Time `json:"lastKeyRotationTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is + // in progress. It will be empty if there is no ongoing key rotation. + PreviousKeys []*KeyForDiskEncryptionSet `json:"previousKeys,omitempty" azure:"ro"` + + // READ-ONLY; The disk encryption set provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// EncryptionSettingsCollection - Encryption settings for disk or snapshot +type EncryptionSettingsCollection struct { + // REQUIRED; Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this + // flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. + // If EncryptionSettings is null in the request object, the existing settings remain unchanged. + Enabled *bool `json:"enabled,omitempty"` + + // A collection of encryption settings, one for each disk volume. + EncryptionSettings []*EncryptionSettingsElement `json:"encryptionSettings,omitempty"` + + // Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds + // to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk + // Encryption. + EncryptionSettingsVersion *string `json:"encryptionSettingsVersion,omitempty"` +} + +// EncryptionSettingsElement - Encryption settings for one disk volume. +type EncryptionSettingsElement struct { + // Key Vault Secret Url and vault id of the disk encryption key + DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` + + // Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap + // the disk encryption key. + KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` +} + +// ExtendedLocation - The complex type of the extended location. +type ExtendedLocation struct { + // The name of the extended location. + Name *string `json:"name,omitempty"` + + // The type of the extended location. + Type *ExtendedLocationTypes `json:"type,omitempty"` +} + +// Extension - Describes a cloud service Extension. +type Extension struct { + // The name of the extension. + Name *string `json:"name,omitempty"` + + // Extension Properties. + Properties *CloudServiceExtensionProperties `json:"properties,omitempty"` +} + +// GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate +// method. +type GalleriesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. +type GalleriesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleriesClientBeginUpdateOptions contains the optional parameters for the GalleriesClient.BeginUpdate method. +type GalleriesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. +type GalleriesClientGetOptions struct { + // The expand query option to apply on the operation. + Expand *GalleryExpandParams + // The select expression to apply on the operation. + Select *SelectPermissions +} + +// GalleriesClientListByResourceGroupOptions contains the optional parameters for the GalleriesClient.ListByResourceGroup +// method. +type GalleriesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// GalleriesClientListOptions contains the optional parameters for the GalleriesClient.List method. +type GalleriesClientListOptions struct { + // placeholder for future optional parameters +} + +// Gallery - Specifies information about the Shared Image Gallery that you want to create or update. +type Gallery struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a Shared Image Gallery. + Properties *GalleryProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryApplication - Specifies information about the gallery Application Definition that you want to create or update. +type GalleryApplication struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a gallery Application Definition. + Properties *GalleryApplicationProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryApplicationCustomAction - A custom action that can be performed with a Gallery Application Version. +type GalleryApplicationCustomAction struct { + // REQUIRED; The name of the custom action. Must be unique within the Gallery Application Version. + Name *string `json:"name,omitempty"` + + // REQUIRED; The script to run when executing this custom action. + Script *string `json:"script,omitempty"` + + // Description to help the users understand what this custom action does. + Description *string `json:"description,omitempty"` + + // The parameters that this custom action uses + Parameters []*GalleryApplicationCustomActionParameter `json:"parameters,omitempty"` +} + +// GalleryApplicationCustomActionParameter - The definition of a parameter that can be passed to a custom action of a Gallery +// Application Version. +type GalleryApplicationCustomActionParameter struct { + // REQUIRED; The name of the custom action. Must be unique within the Gallery Application Version. + Name *string `json:"name,omitempty"` + + // The default value of the parameter. Only applies to string types + DefaultValue *string `json:"defaultValue,omitempty"` + + // A description to help users understand what this parameter means + Description *string `json:"description,omitempty"` + + // Indicates whether this parameter must be passed when running the custom action. + Required *bool `json:"required,omitempty"` + + // Specifies the type of the custom action parameter. Possible values are: String, ConfigurationDataBlob or LogOutputBlob + Type *GalleryApplicationCustomActionParameterType `json:"type,omitempty"` +} + +// GalleryApplicationList - The List Gallery Applications operation response. +type GalleryApplicationList struct { + // REQUIRED; A list of Gallery Applications. + Value []*GalleryApplication `json:"value,omitempty"` + + // The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch + // the next page of gallery Application Definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryApplicationProperties - Describes the properties of a gallery Application Definition. +type GalleryApplicationProperties struct { + // REQUIRED; This property allows you to specify the supported type of the OS that application is built for. + // Possible values are: + // Windows + // Linux + SupportedOSType *OperatingSystemTypes `json:"supportedOSType,omitempty"` + + // A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application. + CustomActions []*GalleryApplicationCustomAction `json:"customActions,omitempty"` + + // The description of this gallery Application Definition resource. This property is updatable. + Description *string `json:"description,omitempty"` + + // The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This + // property is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // The Eula agreement for the gallery Application Definition. + Eula *string `json:"eula,omitempty"` + + // The privacy statement uri. + PrivacyStatementURI *string `json:"privacyStatementUri,omitempty"` + + // The release note uri. + ReleaseNoteURI *string `json:"releaseNoteUri,omitempty"` +} + +// GalleryApplicationUpdate - Specifies information about the gallery Application Definition that you want to update. +type GalleryApplicationUpdate struct { + // Describes the properties of a gallery Application Definition. + Properties *GalleryApplicationProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryApplicationVersion - Specifies information about the gallery Application Version that you want to create or update. +type GalleryApplicationVersion struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a gallery image version. + Properties *GalleryApplicationVersionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryApplicationVersionList - The List Gallery Application version operation response. +type GalleryApplicationVersionList struct { + // REQUIRED; A list of gallery Application Versions. + Value []*GalleryApplicationVersion `json:"value,omitempty"` + + // The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery + // Application Versions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryApplicationVersionProperties - Describes the properties of a gallery image version. +type GalleryApplicationVersionProperties struct { + // REQUIRED; The publishing profile of a gallery image version. + PublishingProfile *GalleryApplicationVersionPublishingProfile `json:"publishingProfile,omitempty"` + + // The safety profile of the Gallery Application Version. + SafetyProfile *GalleryApplicationVersionSafetyProfile `json:"safetyProfile,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; This is the replication status of the gallery image version. + ReplicationStatus *ReplicationStatus `json:"replicationStatus,omitempty" azure:"ro"` +} + +// GalleryApplicationVersionPublishingProfile - The publishing profile of a gallery image version. +type GalleryApplicationVersionPublishingProfile struct { + // REQUIRED; The source image from which the Image Version is going to be created. + Source *UserArtifactSource `json:"source,omitempty"` + + // Optional. Additional settings to pass to the vm-application-manager extension. For advanced use only. + AdvancedSettings map[string]*string `json:"advancedSettings,omitempty"` + + // A list of custom actions that can be performed with this Gallery Application Version. + CustomActions []*GalleryApplicationCustomAction `json:"customActions,omitempty"` + + // Optional. Whether or not this application reports health. + EnableHealthCheck *bool `json:"enableHealthCheck,omitempty"` + + // The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + ManageActions *UserArtifactManage `json:"manageActions,omitempty"` + + // The number of replicas of the Image Version to be created per region. This property would take effect for a region when + // regionalReplicaCount is not specified. This property is updatable. + ReplicaCount *int32 `json:"replicaCount,omitempty"` + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode `json:"replicationMode,omitempty"` + + // Additional settings for the VM app that contains the target package and config file name when it is deployed to target + // VM or VM scale set. + Settings *UserArtifactSettings `json:"settings,omitempty"` + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation `json:"targetExtendedLocations,omitempty"` + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion `json:"targetRegions,omitempty"` + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time `json:"publishedDate,omitempty" azure:"ro"` +} + +// GalleryApplicationVersionSafetyProfile - The safety profile of the Gallery Application Version. +type GalleryApplicationVersionSafetyProfile struct { + // Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. + AllowDeletionOfReplicatedLocations *bool `json:"allowDeletionOfReplicatedLocations,omitempty"` +} + +// GalleryApplicationVersionUpdate - Specifies information about the gallery Application Version that you want to update. +type GalleryApplicationVersionUpdate struct { + // Describes the properties of a gallery image version. + Properties *GalleryApplicationVersionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryApplicationVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginCreateOrUpdate +// method. +type GalleryApplicationVersionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginDelete +// method. +type GalleryApplicationVersionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationVersionsClient.BeginUpdate +// method. +type GalleryApplicationVersionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationVersionsClientGetOptions contains the optional parameters for the GalleryApplicationVersionsClient.Get +// method. +type GalleryApplicationVersionsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *ReplicationStatusTypes +} + +// GalleryApplicationVersionsClientListByGalleryApplicationOptions contains the optional parameters for the GalleryApplicationVersionsClient.ListByGalleryApplication +// method. +type GalleryApplicationVersionsClientListByGalleryApplicationOptions struct { + // placeholder for future optional parameters +} + +// GalleryApplicationsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginCreateOrUpdate +// method. +type GalleryApplicationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationsClientBeginDeleteOptions contains the optional parameters for the GalleryApplicationsClient.BeginDelete +// method. +type GalleryApplicationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationsClientBeginUpdateOptions contains the optional parameters for the GalleryApplicationsClient.BeginUpdate +// method. +type GalleryApplicationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryApplicationsClientGetOptions contains the optional parameters for the GalleryApplicationsClient.Get method. +type GalleryApplicationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GalleryApplicationsClientListByGalleryOptions contains the optional parameters for the GalleryApplicationsClient.ListByGallery +// method. +type GalleryApplicationsClientListByGalleryOptions struct { + // placeholder for future optional parameters +} + +// GalleryArtifactPublishingProfileBase - Describes the basic gallery artifact publishing profile. +type GalleryArtifactPublishingProfileBase struct { + // The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + + // The number of replicas of the Image Version to be created per region. This property would take effect for a region when + // regionalReplicaCount is not specified. This property is updatable. + ReplicaCount *int32 `json:"replicaCount,omitempty"` + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode `json:"replicationMode,omitempty"` + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation `json:"targetExtendedLocations,omitempty"` + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion `json:"targetRegions,omitempty"` + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time `json:"publishedDate,omitempty" azure:"ro"` +} + +// GalleryArtifactSafetyProfileBase - This is the safety profile of the Gallery Artifact Version. +type GalleryArtifactSafetyProfileBase struct { + // Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. + AllowDeletionOfReplicatedLocations *bool `json:"allowDeletionOfReplicatedLocations,omitempty"` +} + +// GalleryArtifactSource - The source image from which the Image Version is going to be created. +type GalleryArtifactSource struct { + // REQUIRED; The managed artifact. + ManagedImage *ManagedArtifact `json:"managedImage,omitempty"` +} + +// GalleryArtifactVersionFullSource - The source of the gallery artifact version. +type GalleryArtifactVersionFullSource struct { + // The resource Id of the source Community Gallery Image. Only required when using Community Gallery Image as a source. + CommunityGalleryImageID *string `json:"communityGalleryImageId,omitempty"` + + // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + ID *string `json:"id,omitempty"` +} + +// GalleryArtifactVersionSource - The gallery artifact version source. +type GalleryArtifactVersionSource struct { + // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + ID *string `json:"id,omitempty"` +} + +// GalleryDataDiskImage - This is the data disk image. +type GalleryDataDiskImage struct { + // REQUIRED; This property specifies the logical unit number of the data disk. This value is used to identify data disks within + // the Virtual Machine and therefore must be unique for each data disk attached to the + // Virtual Machine. + Lun *int32 `json:"lun,omitempty"` + + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *HostCaching `json:"hostCaching,omitempty"` + + // The source for the disk image. + Source *GalleryDiskImageSource `json:"source,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty" azure:"ro"` +} + +// GalleryDiskImage - This is the disk image base class. +type GalleryDiskImage struct { + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *HostCaching `json:"hostCaching,omitempty"` + + // The source for the disk image. + Source *GalleryDiskImageSource `json:"source,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty" azure:"ro"` +} + +// GalleryDiskImageSource - The source for the disk image. +type GalleryDiskImageSource struct { + // The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + ID *string `json:"id,omitempty"` + + // The Storage Account Id that contains the vhd blob being used as a source for this artifact version. + StorageAccountID *string `json:"storageAccountId,omitempty"` + + // The uri of the gallery artifact version source. Currently used to specify vhd/blob source. + URI *string `json:"uri,omitempty"` +} + +// GalleryExtendedLocation - The name of the extended location. +type GalleryExtendedLocation struct { + Name *string `json:"name,omitempty"` + + // It is type of the extended location. + Type *GalleryExtendedLocationType `json:"type,omitempty"` +} + +// GalleryIdentifier - Describes the gallery unique name. +type GalleryIdentifier struct { + // READ-ONLY; The unique name of the Shared Image Gallery. This name is generated automatically by Azure. + UniqueName *string `json:"uniqueName,omitempty" azure:"ro"` +} + +// GalleryImage - Specifies information about the gallery image definition that you want to create or update. +type GalleryImage struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a gallery image definition. + Properties *GalleryImageProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryImageFeature - A feature for gallery image. +type GalleryImageFeature struct { + // The name of the gallery image feature. + Name *string `json:"name,omitempty"` + + // The value of the gallery image feature. + Value *string `json:"value,omitempty"` +} + +// GalleryImageIdentifier - This is the gallery image definition identifier. +type GalleryImageIdentifier struct { + // REQUIRED; The name of the gallery image definition offer. + Offer *string `json:"offer,omitempty"` + + // REQUIRED; The name of the gallery image definition publisher. + Publisher *string `json:"publisher,omitempty"` + + // REQUIRED; The name of the gallery image definition SKU. + SKU *string `json:"sku,omitempty"` +} + +// GalleryImageList - The List Gallery Images operation response. +type GalleryImageList struct { + // REQUIRED; A list of Shared Image Gallery images. + Value []*GalleryImage `json:"value,omitempty"` + + // The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the + // next page of gallery image definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryImageProperties - Describes the properties of a gallery image definition. +type GalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier `json:"identifier,omitempty"` + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes `json:"osState,omitempty"` + + // REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a + // managed image. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture `json:"architecture,omitempty"` + + // The description of this gallery image definition resource. This property is updatable. + Description *string `json:"description,omitempty"` + + // Describes the disallowed disk types. + Disallowed *Disallowed `json:"disallowed,omitempty"` + + // The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // The Eula agreement for the gallery image definition. + Eula *string `json:"eula,omitempty"` + + // A list of gallery image features. + Features []*GalleryImageFeature `json:"features,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // The privacy statement uri. + PrivacyStatementURI *string `json:"privacyStatementUri,omitempty"` + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan `json:"purchasePlan,omitempty"` + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration `json:"recommended,omitempty"` + + // The release note uri. + ReleaseNoteURI *string `json:"releaseNoteUri,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// GalleryImageUpdate - Specifies information about the gallery image definition that you want to update. +type GalleryImageUpdate struct { + // Describes the properties of a gallery image definition. + Properties *GalleryImageProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type GalleryImageVersion struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a gallery image version. + Properties *GalleryImageVersionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryImageVersionList - The List Gallery Image version operation response. +type GalleryImageVersionList struct { + // REQUIRED; A list of gallery image versions. + Value []*GalleryImageVersion `json:"value,omitempty"` + + // The uri to fetch the next page of gallery image versions. Call ListNext() with this to fetch the next page of gallery image + // versions. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryImageVersionProperties - Describes the properties of a gallery image version. +type GalleryImageVersionProperties struct { + // REQUIRED; This is the storage profile of a Gallery Image Version. + StorageProfile *GalleryImageVersionStorageProfile `json:"storageProfile,omitempty"` + + // The publishing profile of a gallery image Version. + PublishingProfile *GalleryImageVersionPublishingProfile `json:"publishingProfile,omitempty"` + + // This is the safety profile of the Gallery Image Version. + SafetyProfile *GalleryImageVersionSafetyProfile `json:"safetyProfile,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; This is the replication status of the gallery image version. + ReplicationStatus *ReplicationStatus `json:"replicationStatus,omitempty" azure:"ro"` +} + +// GalleryImageVersionPublishingProfile - The publishing profile of a gallery image Version. +type GalleryImageVersionPublishingProfile struct { + // The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + + // The number of replicas of the Image Version to be created per region. This property would take effect for a region when + // regionalReplicaCount is not specified. This property is updatable. + ReplicaCount *int32 `json:"replicaCount,omitempty"` + + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode `json:"replicationMode,omitempty"` + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` + + // The target extended locations where the Image Version is going to be replicated to. This property is updatable. + TargetExtendedLocations []*GalleryTargetExtendedLocation `json:"targetExtendedLocations,omitempty"` + + // The target regions where the Image Version is going to be replicated to. This property is updatable. + TargetRegions []*TargetRegion `json:"targetRegions,omitempty"` + + // READ-ONLY; The timestamp for when the gallery image version is published. + PublishedDate *time.Time `json:"publishedDate,omitempty" azure:"ro"` +} + +// GalleryImageVersionSafetyProfile - This is the safety profile of the Gallery Image Version. +type GalleryImageVersionSafetyProfile struct { + // Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. + AllowDeletionOfReplicatedLocations *bool `json:"allowDeletionOfReplicatedLocations,omitempty"` + + // READ-ONLY; A list of Policy Violations that have been reported for this Gallery Image Version. + PolicyViolations []*PolicyViolation `json:"policyViolations,omitempty" azure:"ro"` + + // READ-ONLY; Indicates whether this image has been reported as violating Microsoft's policies. + ReportedForPolicyViolation *bool `json:"reportedForPolicyViolation,omitempty" azure:"ro"` +} + +// GalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type GalleryImageVersionStorageProfile struct { + // A list of data disk images. + DataDiskImages []*GalleryDataDiskImage `json:"dataDiskImages,omitempty"` + + // This is the OS disk image. + OSDiskImage *GalleryOSDiskImage `json:"osDiskImage,omitempty"` + + // The source of the gallery artifact version. + Source *GalleryArtifactVersionFullSource `json:"source,omitempty"` +} + +// GalleryImageVersionUpdate - Specifies information about the gallery image version that you want to update. +type GalleryImageVersionUpdate struct { + // Describes the properties of a gallery image version. + Properties *GalleryImageVersionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GalleryImageVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginCreateOrUpdate +// method. +type GalleryImageVersionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImageVersionsClientBeginDeleteOptions contains the optional parameters for the GalleryImageVersionsClient.BeginDelete +// method. +type GalleryImageVersionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImageVersionsClientBeginUpdateOptions contains the optional parameters for the GalleryImageVersionsClient.BeginUpdate +// method. +type GalleryImageVersionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImageVersionsClientGetOptions contains the optional parameters for the GalleryImageVersionsClient.Get method. +type GalleryImageVersionsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *ReplicationStatusTypes +} + +// GalleryImageVersionsClientListByGalleryImageOptions contains the optional parameters for the GalleryImageVersionsClient.ListByGalleryImage +// method. +type GalleryImageVersionsClientListByGalleryImageOptions struct { + // placeholder for future optional parameters +} + +// GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate +// method. +type GalleryImagesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientBeginDeleteOptions contains the optional parameters for the GalleryImagesClient.BeginDelete method. +type GalleryImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientBeginUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginUpdate method. +type GalleryImagesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GalleryImagesClientGetOptions contains the optional parameters for the GalleryImagesClient.Get method. +type GalleryImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// GalleryImagesClientListByGalleryOptions contains the optional parameters for the GalleryImagesClient.ListByGallery method. +type GalleryImagesClientListByGalleryOptions struct { + // placeholder for future optional parameters +} + +// GalleryList - The List Galleries operation response. +type GalleryList struct { + // REQUIRED; A list of galleries. + Value []*Gallery `json:"value,omitempty"` + + // The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. + NextLink *string `json:"nextLink,omitempty"` +} + +// GalleryOSDiskImage - This is the OS disk image. +type GalleryOSDiskImage struct { + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *HostCaching `json:"hostCaching,omitempty"` + + // The source for the disk image. + Source *GalleryDiskImageSource `json:"source,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + SizeInGB *int32 `json:"sizeInGB,omitempty" azure:"ro"` +} + +// GalleryProperties - Describes the properties of a Shared Image Gallery. +type GalleryProperties struct { + // The description of this Shared Image Gallery resource. This property is updatable. + Description *string `json:"description,omitempty"` + + // Describes the gallery unique name. + Identifier *GalleryIdentifier `json:"identifier,omitempty"` + + // Profile for gallery sharing to subscription or tenant + SharingProfile *SharingProfile `json:"sharingProfile,omitempty"` + + // Contains information about the soft deletion policy of the gallery. + SoftDeletePolicy *SoftDeletePolicy `json:"softDeletePolicy,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *GalleryProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Sharing status of current gallery. + SharingStatus *SharingStatus `json:"sharingStatus,omitempty" azure:"ro"` +} + +// GallerySharingProfileClientBeginUpdateOptions contains the optional parameters for the GallerySharingProfileClient.BeginUpdate +// method. +type GallerySharingProfileClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +type GalleryTargetExtendedLocation struct { + // Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + Encryption *EncryptionImages `json:"encryption,omitempty"` + + // The name of the extended location. + ExtendedLocation *GalleryExtendedLocation `json:"extendedLocation,omitempty"` + + // The number of replicas of the Image Version to be created per extended location. This property is updatable. + ExtendedLocationReplicaCount *int32 `json:"extendedLocationReplicaCount,omitempty"` + + // The name of the region. + Name *string `json:"name,omitempty"` + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` +} + +// GalleryUpdate - Specifies information about the Shared Image Gallery that you want to update. +type GalleryUpdate struct { + // Describes the properties of a Shared Image Gallery. + Properties *GalleryProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GrantAccessData - Data used for requesting a SAS. +type GrantAccessData struct { + // REQUIRED + Access *AccessLevel `json:"access,omitempty"` + + // REQUIRED; Time duration in seconds until the SAS access expires. + DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` + + // Set this flag to true to get additional SAS for VM guest state + GetSecureVMGuestStateSAS *bool `json:"getSecureVMGuestStateSAS,omitempty"` +} + +// HardwareProfile - Specifies the hardware settings for the virtual machine. +type HardwareProfile struct { + // Specifies the size of the virtual machine. + // The enum data type is currently deprecated and will be removed by December 23rd 2023. + // Recommended way to get the list of available sizes is using these APIs: + // List all available virtual machine sizes in an availability set [https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes] + // List all available virtual machine sizes in a region [https://docs.microsoft.com/rest/api/compute/resourceskus/list] + // List all available virtual machine sizes for resizing [https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes]. + // For more information about virtual machine sizes, see Sizes for + // virtual machines [https://docs.microsoft.com/azure/virtual-machines/sizes]. + // The available VM sizes depend on region and availability set. + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + + // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. + // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. + // Please follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details. + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} + +// Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual +// machine. If SourceImage is provided, the destination virtual hard drive must not +// exist. +type Image struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location of the Image. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Describes the properties of an Image. + Properties *ImageProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ImageDataDisk - Describes a data disk. +type ImageDataDisk struct { + // REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and + // therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + + // The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual + // machine image. + // This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + + // The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// ImageDisk - Describes a image disk. +type ImageDisk struct { + // The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual + // machine image. + // This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + + // The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// ImageDiskReference - The source image used for creating the disk. +type ImageDiskReference struct { + // A relative uri containing a community Azure Compute Gallery image reference. + CommunityGalleryImageID *string `json:"communityGalleryImageId,omitempty"` + + // A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference. + ID *string `json:"id,omitempty"` + + // If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image + // to use. For OS disks, this field is null. + Lun *int32 `json:"lun,omitempty"` + + // A relative uri containing a direct shared Azure Compute Gallery image reference. + SharedGalleryImageID *string `json:"sharedGalleryImageId,omitempty"` +} + +// ImageListResult - The List Image operation response. +type ImageListResult struct { + // REQUIRED; The list of Images. + Value []*Image `json:"value,omitempty"` + + // The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. + NextLink *string `json:"nextLink,omitempty"` +} + +// ImageOSDisk - Describes an Operating System disk. +type ImageOSDisk struct { + // REQUIRED; The OS State. For managed images, use Generalized. + OSState *OperatingSystemStateTypes `json:"osState,omitempty"` + + // REQUIRED; This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom + // image. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual + // machine image. + // This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + + // The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// ImageProperties - Describes the properties of an Image. +type ImageProperties struct { + // Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image + // source is a blob, then we need the user to specify the value, if the source is + // managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the + // source managed resource. + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + + // The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + + // READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// ImagePurchasePlan - Describes the gallery image definition purchase plan. This is used by marketplace images. +type ImagePurchasePlan struct { + // The plan ID. + Name *string `json:"name,omitempty"` + + // The product ID. + Product *string `json:"product,omitempty"` + + // The publisher ID. + Publisher *string `json:"publisher,omitempty"` +} + +// ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace +// images, or virtual machine images. This element is required when you want to use a platform +// image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference +// publisher and offer can only be set when you create the scale set. +type ImageReference struct { + // Specified the community gallery image unique id for vm deployment. This can be fetched from community gallery image GET + // call. + CommunityGalleryImageID *string `json:"communityGalleryImageId,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Specifies the offer of the platform image or marketplace image used to create the virtual machine. + Offer *string `json:"offer,omitempty"` + + // The image publisher. + Publisher *string `json:"publisher,omitempty"` + + // The image SKU. + SKU *string `json:"sku,omitempty"` + + // Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. + SharedGalleryImageID *string `json:"sharedGalleryImageId,omitempty"` + + // Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats + // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. + // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image + // will not automatically update after deploy time even if a new version becomes + // available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for + // deployment, to use 'latest' version of gallery image, just set + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + // in the 'id' field without version input. + Version *string `json:"version,omitempty"` + + // READ-ONLY; Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual + // machine. This readonly field differs from 'version', only if the value specified in + // 'version' field is 'latest'. + ExactVersion *string `json:"exactVersion,omitempty" azure:"ro"` +} + +// ImageStorageProfile - Describes a storage profile. +type ImageStorageProfile struct { + // Specifies the parameters that are used to add a data disk to a virtual machine. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + DataDisks []*ImageDataDisk `json:"dataDisks,omitempty"` + + // Specifies information about the operating system disk used by the virtual machine. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + OSDisk *ImageOSDisk `json:"osDisk,omitempty"` + + // Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions + // that provide Zone Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +// ImageUpdate - The source user image virtual hard disk. Only tags may be updated. +type ImageUpdate struct { + // Describes the properties of an Image. + Properties *ImageProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method. +type ImagesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. +type ImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ImagesClientBeginUpdateOptions contains the optional parameters for the ImagesClient.BeginUpdate method. +type ImagesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. +type ImagesClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// ImagesClientListByResourceGroupOptions contains the optional parameters for the ImagesClient.ListByResourceGroup method. +type ImagesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientListOptions contains the optional parameters for the ImagesClient.List method. +type ImagesClientListOptions struct { + // placeholder for future optional parameters +} + +// InnerError - Inner error details. +type InnerError struct { + // The internal error message or exception dump. + Errordetail *string `json:"errordetail,omitempty"` + + // The exception type. + Exceptiontype *string `json:"exceptiontype,omitempty"` +} + +// InstanceSKU - The role instance SKU. +type InstanceSKU struct { + // READ-ONLY; The sku name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The tier of the cloud service role instance. + Tier *string `json:"tier,omitempty" azure:"ro"` +} + +// InstanceViewStatus - Instance view status. +type InstanceViewStatus struct { + // The status code. + Code *string `json:"code,omitempty"` + + // The short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + + // The level code. + Level *StatusLevelTypes `json:"level,omitempty"` + + // The detailed status message, including for alerts and error messages. + Message *string `json:"message,omitempty"` + + // The time of the status. + Time *time.Time `json:"time,omitempty"` +} + +// InstanceViewStatusesSummary - Instance view statuses. +type InstanceViewStatusesSummary struct { + // READ-ONLY; The summary. + StatusesSummary []*StatusCodeCount `json:"statusesSummary,omitempty" azure:"ro"` +} + +// KeyForDiskEncryptionSet - Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots +type KeyForDiskEncryptionSet struct { + // REQUIRED; Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled + // value. + KeyURL *string `json:"keyUrl,omitempty"` + + // Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault + // subscription is not the same as the Disk Encryption Set subscription. + SourceVault *SourceVault `json:"sourceVault,omitempty"` +} + +// KeyVaultAndKeyReference - Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the +// encryptionKey +type KeyVaultAndKeyReference struct { + // REQUIRED; Url pointing to a key or secret in KeyVault + KeyURL *string `json:"keyUrl,omitempty"` + + // REQUIRED; Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` +} + +// KeyVaultAndSecretReference - Key Vault Secret Url and vault id of the encryption key +type KeyVaultAndSecretReference struct { + // REQUIRED; Url pointing to a key or secret in KeyVault + SecretURL *string `json:"secretUrl,omitempty"` + + // REQUIRED; Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` +} + +// KeyVaultKeyReference - Describes a reference to Key Vault Key +type KeyVaultKeyReference struct { + // REQUIRED; The URL referencing a key encryption key in Key Vault. + KeyURL *string `json:"keyUrl,omitempty"` + + // REQUIRED; The relative URL of the Key Vault containing the key. + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// KeyVaultSecretReference - Describes a reference to Key Vault Secret +type KeyVaultSecretReference struct { + // REQUIRED; The URL referencing a secret in a Key Vault. + SecretURL *string `json:"secretUrl,omitempty"` + + // REQUIRED; The relative URL of the Key Vault containing the secret. + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// LastPatchInstallationSummary - Describes the properties of the last installed patch summary. +type LastPatchInstallationSummary struct { + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The number of all available patches but excluded explicitly by a customer-specified exclusion list match. + ExcludedPatchCount *int32 `json:"excludedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The count of patches that failed installation. + FailedPatchCount *int32 `json:"failedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + InstallationActivityID *string `json:"installationActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The count of patches that successfully installed. + InstalledPatchCount *int32 `json:"installedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *time.Time `json:"lastModifiedTime,omitempty" azure:"ro"` + + // READ-ONLY; Describes whether the operation ran out of time before it completed all its intended actions + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty" azure:"ro"` + + // READ-ONLY; The number of all available patches but not going to be installed because it didn't match a classification or + // inclusion list entry. + NotSelectedPatchCount *int32 `json:"notSelectedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of all available patches expected to be installed over the course of the patch installation operation. + PendingPatchCount *int32 `json:"pendingPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Unknown", "Failed", "Succeeded", or + // "CompletedWithWarnings." + Status *PatchOperationStatus `json:"status,omitempty" azure:"ro"` +} + +// LatestGalleryImageVersion - The gallery image version with latest version in a particular region. +type LatestGalleryImageVersion struct { + // The name of the latest version in the region. + LatestVersionName *string `json:"latestVersionName,omitempty"` + + // region of the Gallery Image Version. + Location *string `json:"location,omitempty"` +} + +// LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. +// For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. +type LinuxConfiguration struct { + // Specifies whether password authentication should be disabled. + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + + // Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + + // [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + + // Indicates whether virtual machine agent should be provisioned on the virtual machine. + // When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM + // Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + + // Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// LinuxParameters - Input for InstallPatches on a Linux VM, as directly received by the API +type LinuxParameters struct { + // The update classifications to select when installing patches for Linux. + ClassificationsToInclude []*VMGuestPatchClassificationLinux `json:"classificationsToInclude,omitempty"` + + // This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. + MaintenanceRunID *string `json:"maintenanceRunId,omitempty"` + + // packages to exclude in the patch operation. Format: packageName_packageVersion + PackageNameMasksToExclude []*string `json:"packageNameMasksToExclude,omitempty"` + + // packages to include in the patch operation. Format: packageName_packageVersion + PackageNameMasksToInclude []*string `json:"packageNameMasksToInclude,omitempty"` +} + +// LinuxPatchSettings - Specifies settings related to VM Guest Patching on Linux. +type LinuxPatchSettings struct { + // Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine. + // Possible values are: + // ImageDefault - You control the timing of patch assessments on a virtual machine. + // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux. + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + + // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale + // set with OrchestrationMode as Flexible. + // Possible values are: + // ImageDefault - The virtual machine's default patching configuration is used. + // AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent + // must be true + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} + +// LinuxVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Linux patch settings. +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} + +// ListUsagesResult - The List Usages operation response. +type ListUsagesResult struct { + // REQUIRED; The list of compute resource usages. + Value []*Usage `json:"value,omitempty"` + + // The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page + // of compute resource usage information. + NextLink *string `json:"nextLink,omitempty"` +} + +// LoadBalancerConfiguration - Describes the load balancer configuration. +type LoadBalancerConfiguration struct { + // REQUIRED; The name of the Load balancer + Name *string `json:"name,omitempty"` + + // REQUIRED; Properties of the load balancer configuration. + Properties *LoadBalancerConfigurationProperties `json:"properties,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` +} + +// LoadBalancerConfigurationProperties - Describes the properties of the load balancer configuration. +type LoadBalancerConfigurationProperties struct { + // REQUIRED; Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each + // load balancer configuration must have exactly one frontend IP configuration. + FrontendIPConfigurations []*LoadBalancerFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` +} + +// LoadBalancerFrontendIPConfiguration - Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP +// address is supported. Each load balancer configuration must have exactly one frontend IP configuration. +type LoadBalancerFrontendIPConfiguration struct { + // REQUIRED; The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. + // This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // REQUIRED; Properties of load balancer frontend ip configuration. + Properties *LoadBalancerFrontendIPConfigurationProperties `json:"properties,omitempty"` +} + +// LoadBalancerFrontendIPConfigurationProperties - Describes a cloud service IP Configuration +type LoadBalancerFrontendIPConfigurationProperties struct { + // The virtual network private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // The reference to the public ip address resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + + // The reference to the virtual network subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` +} + +// LogAnalyticsClientBeginExportRequestRateByIntervalOptions contains the optional parameters for the LogAnalyticsClient.BeginExportRequestRateByInterval +// method. +type LogAnalyticsClientBeginExportRequestRateByIntervalOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LogAnalyticsClientBeginExportThrottledRequestsOptions contains the optional parameters for the LogAnalyticsClient.BeginExportThrottledRequests +// method. +type LogAnalyticsClientBeginExportThrottledRequestsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LogAnalyticsInputBase - Api input base class for LogAnalytics Api. +type LogAnalyticsInputBase struct { + // REQUIRED; SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + + // REQUIRED; From time of the query + FromTime *time.Time `json:"fromTime,omitempty"` + + // REQUIRED; To time of the query + ToTime *time.Time `json:"toTime,omitempty"` + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + + // Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + + // Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + + // Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` +} + +// LogAnalyticsOperationResult - LogAnalytics operation status response +type LogAnalyticsOperationResult struct { + // READ-ONLY; LogAnalyticsOutput + Properties *LogAnalyticsOutput `json:"properties,omitempty" azure:"ro"` +} + +// LogAnalyticsOutput - LogAnalytics output properties +type LogAnalyticsOutput struct { + // READ-ONLY; Output file Uri path to blob container. + Output *string `json:"output,omitempty" azure:"ro"` +} + +// MaintenanceRedeployStatus - Maintenance Operation Status. +type MaintenanceRedeployStatus struct { + // True, if customer is allowed to perform Maintenance. + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + + // Message returned for the last Maintenance Operation. + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + + // The Last Maintenance Operation Result Code. + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + + // End Time for the Maintenance Window. + MaintenanceWindowEndTime *time.Time `json:"maintenanceWindowEndTime,omitempty"` + + // Start Time for the Maintenance Window. + MaintenanceWindowStartTime *time.Time `json:"maintenanceWindowStartTime,omitempty"` + + // End Time for the Pre Maintenance Window. + PreMaintenanceWindowEndTime *time.Time `json:"preMaintenanceWindowEndTime,omitempty"` + + // Start Time for the Pre Maintenance Window. + PreMaintenanceWindowStartTime *time.Time `json:"preMaintenanceWindowStartTime,omitempty"` +} + +// ManagedArtifact - The managed artifact. +type ManagedArtifact struct { + // REQUIRED; The managed artifact id. + ID *string `json:"id,omitempty"` +} + +// ManagedDiskParameters - The parameters of a managed disk. +type ManagedDiskParameters struct { + // Specifies the customer managed disk encryption set resource id for the managed disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Specifies the security profile for the managed disk. + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// NetworkInterfaceReference - Describes a network interface reference. +type NetworkInterfaceReference struct { + // Resource Id + ID *string `json:"id,omitempty"` + + // Describes a network interface reference properties. + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} + +// NetworkInterfaceReferenceProperties - Describes a network interface reference properties. +type NetworkInterfaceReferenceProperties struct { + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` +} + +// NetworkProfile - Specifies the network interfaces or the networking configuration of the virtual machine. +type NetworkProfile struct { + // specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations + NetworkAPIVersion *NetworkAPIVersion `json:"networkApiVersion,omitempty"` + + // Specifies the networking configurations that will be used to create the virtual machine networking resources. + NetworkInterfaceConfigurations []*VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + + // Specifies the list of resource Ids for the network interfaces associated with the virtual machine. + NetworkInterfaces []*NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} + +// OSDisk - Specifies information about the operating system disk used by the virtual machine. +// For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. +type OSDisk struct { + // REQUIRED; Specifies how the virtual machine should be created. + // Possible values are: + // Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine. + // FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform + // image, you also use the imageReference element described above. If you are + // using a marketplace image, you also use the plan element previously described. + CreateOption *DiskCreateOptionTypes `json:"createOption,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage. + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies whether OS Disk should be deleted or detached upon VM deletion. + // Possible values: + // Delete If this value is used, the OS disk is deleted when VM is deleted. + // Detach If this value is used, the os disk is retained after VM is deleted. + // The default value is set to detach. For an ephemeral OS Disk, the default value is set to Delete. User cannot change the + // delete option for ephemeral OS Disk. + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + + // Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. + // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Specifies the encryption settings for the OS Disk. + // Minimum api-version: 2015-06-15 + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + + // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. + // If SourceImage is provided, the destination virtual hard drive must not + // exist. + Image *VirtualHardDisk `json:"image,omitempty"` + + // The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + + // The disk name. + Name *string `json:"name,omitempty"` + + // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + // a specialized VHD. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} + +// OSDiskImage - Contains the os disk image information. +type OSDiskImage struct { + // REQUIRED; The operating system of the osDiskImage. + OperatingSystem *OperatingSystemTypes `json:"operatingSystem,omitempty"` +} + +// OSDiskImageEncryption - Contains encryption settings for an OS disk image. +type OSDiskImageEncryption struct { + // A relative URI containing the resource ID of the disk encryption set. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` + + // This property specifies the security profile of an OS disk image. + SecurityProfile *OSDiskImageSecurityProfile `json:"securityProfile,omitempty"` +} + +// OSDiskImageSecurityProfile - Contains security profile for an OS disk image. +type OSDiskImageSecurityProfile struct { + // confidential VM encryption types + ConfidentialVMEncryptionType *ConfidentialVMEncryptionType `json:"confidentialVMEncryptionType,omitempty"` + + // secure VM disk encryption set id + SecureVMDiskEncryptionSetID *string `json:"secureVMDiskEncryptionSetId,omitempty"` +} + +// OSFamily - Describes a cloud service OS family. +type OSFamily struct { + // OS family properties. + Properties *OSFamilyProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource location. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OSFamilyListResult - The list operation result. +type OSFamilyListResult struct { + // REQUIRED; The list of resources. + Value []*OSFamily `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// OSFamilyProperties - OS family properties. +type OSFamilyProperties struct { + // READ-ONLY; The OS family label. + Label *string `json:"label,omitempty" azure:"ro"` + + // READ-ONLY; The OS family name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; List of OS versions belonging to this family. + Versions []*OSVersionPropertiesBase `json:"versions,omitempty" azure:"ro"` +} + +// OSProfile - Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once +// VM is provisioned. +type OSProfile struct { + // Specifies the password of the administrator account. + // Minimum-length (Windows): 8 characters + // Minimum-length (Linux): 6 characters + // Max-length (Windows): 123 characters + // Max-length (Linux): 72 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!" + // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp] + // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension + // [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection] + AdminPassword *string `json:"adminPassword,omitempty"` + + // Specifies the name of the administrator account. + // This property cannot be updated after the VM is created. + // Windows-only 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 (Linux): 1 character + // Max-length (Linux): 64 characters + // Max-length (Windows): 20 characters. + AdminUsername *string `json:"adminUsername,omitempty"` + + // Specifies whether extension operations should be allowed on the virtual machine. + // This may only be set to False when no extensions are present on the virtual machine. + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + + // Specifies the host OS name of the virtual machine. + // This name cannot be updated after the VM is created. + // Max-length (Windows): 15 characters + // Max-length (Linux): 64 characters. + // For naming conventions and restrictions see Azure infrastructure services implementation guidelines [https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules]. + ComputerName *string `json:"computerName,omitempty"` + + // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved + // as a file on the Virtual Machine. The maximum length of the binary array is + // 65535 bytes. + // Note: Do not pass any secrets or passwords in customData property + // This property cannot be updated after the VM is created. + // customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMs [https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/] + // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + CustomData *string `json:"customData,omitempty"` + + // Specifies the Linux operating system settings on the virtual machine. + // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + + // Optional property which must either be set to True or omitted. + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + + // Specifies set of certificates that should be installed onto the virtual machine. To install certificates on a virtual machine + // it is recommended to use the Azure Key Vault virtual machine extension for + // Linux [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine + // extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + Secrets []*VaultSecretGroup `json:"secrets,omitempty"` + + // Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} + +// OSVersion - Describes a cloud service OS version. +type OSVersion struct { + // OS version properties. + Properties *OSVersionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource location. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OSVersionListResult - The list operation result. +type OSVersionListResult struct { + // REQUIRED; The list of resources. + Value []*OSVersion `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// OSVersionProperties - OS version properties. +type OSVersionProperties struct { + // READ-ONLY; The family of this OS version. + Family *string `json:"family,omitempty" azure:"ro"` + + // READ-ONLY; The family label of this OS version. + FamilyLabel *string `json:"familyLabel,omitempty" azure:"ro"` + + // READ-ONLY; Specifies whether this OS version is active. + IsActive *bool `json:"isActive,omitempty" azure:"ro"` + + // READ-ONLY; Specifies whether this is the default OS version for its family. + IsDefault *bool `json:"isDefault,omitempty" azure:"ro"` + + // READ-ONLY; The OS version label. + Label *string `json:"label,omitempty" azure:"ro"` + + // READ-ONLY; The OS version. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// OSVersionPropertiesBase - Configuration view of an OS version. +type OSVersionPropertiesBase struct { + // READ-ONLY; Specifies whether this OS version is active. + IsActive *bool `json:"isActive,omitempty" azure:"ro"` + + // READ-ONLY; Specifies whether this is the default OS version for its family. + IsDefault *bool `json:"isDefault,omitempty" azure:"ro"` + + // READ-ONLY; The OS version label. + Label *string `json:"label,omitempty" azure:"ro"` + + // READ-ONLY; The OS version. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// OperationListResult - The List Compute Operation operation response. +type OperationListResult struct { + // READ-ONLY; The list of compute operations + Value []*OperationValue `json:"value,omitempty" azure:"ro"` +} + +// OperationValue - Describes the properties of a Compute Operation value. +type OperationValue struct { + // Describes the properties of a Compute Operation Value Display. + Display *OperationValueDisplay `json:"display,omitempty"` + + // READ-ONLY; The name of the compute operation. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The origin of the compute operation. + Origin *string `json:"origin,omitempty" azure:"ro"` +} + +// OperationValueDisplay - Describes the properties of a Compute Operation Value Display. +type OperationValueDisplay struct { + // READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The display name of the compute operation. + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OrchestrationServiceStateInput - The input for OrchestrationServiceState +type OrchestrationServiceStateInput struct { + // REQUIRED; The action to be performed. + Action *OrchestrationServiceStateAction `json:"action,omitempty"` + + // REQUIRED; The name of the service. + ServiceName *OrchestrationServiceNames `json:"serviceName,omitempty"` +} + +// OrchestrationServiceSummary - Summary for an orchestration service of a virtual machine scale set. +type OrchestrationServiceSummary struct { + // READ-ONLY; The name of the service. + ServiceName *OrchestrationServiceNames `json:"serviceName,omitempty" azure:"ro"` + + // READ-ONLY; The current state of the service. + ServiceState *OrchestrationServiceState `json:"serviceState,omitempty" azure:"ro"` +} + +// PatchInstallationDetail - Information about a specific patch that was encountered during an installation action. +type PatchInstallationDetail struct { + // READ-ONLY; The classification(s) of the patch as provided by the patch publisher. + Classifications []*string `json:"classifications,omitempty" azure:"ro"` + + // READ-ONLY; The state of the patch after the installation operation completed. + InstallationState *PatchInstallationState `json:"installationState,omitempty" azure:"ro"` + + // READ-ONLY; The KBID of the patch. Only applies to Windows patches. + KbID *string `json:"kbId,omitempty" azure:"ro"` + + // READ-ONLY; The friendly name of the patch. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; A unique identifier for the patch. + PatchID *string `json:"patchId,omitempty" azure:"ro"` + + // READ-ONLY; The version string of the package. It may conform to Semantic Versioning. Only applies to Linux. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// PatchSettings - Specifies settings related to VM Guest Patching on Windows. +type PatchSettings struct { + // Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. + // Possible values are: + // ImageDefault - You control the timing of patch assessments on a virtual machine. + // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + + // Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Windows. + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + + // Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must + // be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + + // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale + // set with OrchestrationMode as Flexible. + // Possible values are: + // Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the + // VM. In this mode, automatic updates are disabled; the property + // WindowsConfiguration.enableAutomaticUpdates must be false + // AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + // must be true. + // AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and + // WindowsConfiguration.enableAutomaticUpdates must be true + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} + +// PirCommunityGalleryResource - Base information about the community gallery resource in pir. +type PirCommunityGalleryResource struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier `json:"identifier,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PirResource - The Resource model definition. +type PirResource struct { + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// PirSharedGalleryResource - Base information about the shared gallery resource in pir. +type PirSharedGalleryResource struct { + // The identifier information of shared gallery. + Identifier *SharedGalleryIdentifier `json:"identifier,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used +// for marketplace images. Before you can use a marketplace image from an API, you must +// enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click +// Want to deploy programmatically, Get Started ->. Enter any required +// information and then click Save. +type Plan struct { + // The plan ID. + Name *string `json:"name,omitempty"` + + // Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string `json:"product,omitempty"` + + // The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` + + // The publisher ID. + Publisher *string `json:"publisher,omitempty"` +} + +// PolicyViolation - A policy violation reported against a gallery artifact. +type PolicyViolation struct { + // Describes the nature of the policy violation. + Category *PolicyViolationCategory `json:"category,omitempty"` + + // Describes specific details about why this policy violation was reported. + Details *string `json:"details,omitempty"` +} + +// PriorityMixPolicy - Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible orchestration +// mode. +// With this property the customer is able to specify the base number of regular priority VMs created as the VMSS flex instance +// scales out and the split between Spot and Regular priority VMs after this +// base target has been reached. +type PriorityMixPolicy struct { + // The base number of regular priority VMs that will be created in this scale set as it scales out. + BaseRegularPriorityCount *int32 `json:"baseRegularPriorityCount,omitempty"` + + // The percentage of VM instances, after the base regular priority count has been reached, that are expected to use regular + // priority. + RegularPriorityPercentageAboveBase *int32 `json:"regularPriorityPercentageAboveBase,omitempty"` +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty" azure:"ro"` +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; private endpoint connection Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; private endpoint connection name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; private endpoint connection type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionListResult - A list of private link resources +type PrivateEndpointConnectionListResult struct { + // The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. + NextLink *string `json:"nextLink,omitempty"` + + // Array of private endpoint connections + Value []*PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between DiskAccess and Virtual Network. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; private link resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; private link resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; private link resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource DNS zone name. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + + // READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} + +// PropertyUpdatesInProgress - Properties of the disk for which update is pending. +type PropertyUpdatesInProgress struct { + // The target performance tier of the disk if a tier change operation is in progress. + TargetTier *string `json:"targetTier,omitempty"` +} + +// ProximityPlacementGroup - Specifies information about the proximity placement group. +type ProximityPlacementGroup struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a Proximity Placement Group. + Properties *ProximityPlacementGroupProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // Specifies the Availability Zone where virtual machine, virtual machine scale set or availability set associated with the + // proximity placement group can be created. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProximityPlacementGroupListResult - The List Proximity Placement Group operation response. +type ProximityPlacementGroupListResult struct { + // REQUIRED; The list of proximity placement groups + Value []*ProximityPlacementGroup `json:"value,omitempty"` + + // The URI to fetch the next page of proximity placement groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProximityPlacementGroupProperties - Describes the properties of a Proximity Placement Group. +type ProximityPlacementGroupProperties struct { + // Describes colocation status of the Proximity Placement Group. + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + + // Specifies the user intent of the proximity placement group. + Intent *ProximityPlacementGroupPropertiesIntent `json:"intent,omitempty"` + + // Specifies the type of the proximity placement group. + // Possible values are: + // Standard : Co-locate resources within an Azure region or Availability Zone. + // Ultra : For future use. + ProximityPlacementGroupType *ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + + // READ-ONLY; A list of references to all availability sets in the proximity placement group. + AvailabilitySets []*SubResourceWithColocationStatus `json:"availabilitySets,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to all virtual machine scale sets in the proximity placement group. + VirtualMachineScaleSets []*SubResourceWithColocationStatus `json:"virtualMachineScaleSets,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to all virtual machines in the proximity placement group. + VirtualMachines []*SubResourceWithColocationStatus `json:"virtualMachines,omitempty" azure:"ro"` +} + +// ProximityPlacementGroupPropertiesIntent - Specifies the user intent of the proximity placement group. +type ProximityPlacementGroupPropertiesIntent struct { + // Specifies possible sizes of virtual machines that can be created in the proximity placement group. + VMSizes []*string `json:"vmSizes,omitempty"` +} + +// ProximityPlacementGroupUpdate - Specifies information about the proximity placement group. +type ProximityPlacementGroupUpdate struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// ProximityPlacementGroupsClientCreateOrUpdateOptions contains the optional parameters for the ProximityPlacementGroupsClient.CreateOrUpdate +// method. +type ProximityPlacementGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProximityPlacementGroupsClientDeleteOptions contains the optional parameters for the ProximityPlacementGroupsClient.Delete +// method. +type ProximityPlacementGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProximityPlacementGroupsClientGetOptions contains the optional parameters for the ProximityPlacementGroupsClient.Get method. +type ProximityPlacementGroupsClientGetOptions struct { + // includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. + IncludeColocationStatus *string +} + +// ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListByResourceGroup +// method. +type ProximityPlacementGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListBySubscription +// method. +type ProximityPlacementGroupsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ProximityPlacementGroupsClientUpdateOptions contains the optional parameters for the ProximityPlacementGroupsClient.Update +// method. +type ProximityPlacementGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProxyOnlyResource - The ProxyOnly Resource model definition. +type ProxyOnlyResource struct { + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProxyResource - The resource model definition for an Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PublicIPAddressSKU - Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. +type PublicIPAddressSKU struct { + // Specify public IP sku name + Name *PublicIPAddressSKUName `json:"name,omitempty"` + + // Specify public IP sku tier + Tier *PublicIPAddressSKUTier `json:"tier,omitempty"` +} + +// PurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +type PurchasePlan struct { + // REQUIRED; The plan ID. + Name *string `json:"name,omitempty"` + + // REQUIRED; Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference + // element. + Product *string `json:"product,omitempty"` + + // REQUIRED; The publisher ID. + Publisher *string `json:"publisher,omitempty"` +} + +// RecommendedMachineConfiguration - The properties describe the recommended machine configuration for this Image Definition. +// These properties are updatable. +type RecommendedMachineConfiguration struct { + // Describes the resource range. + Memory *ResourceRange `json:"memory,omitempty"` + + // Describes the resource range. + VCPUs *ResourceRange `json:"vCPUs,omitempty"` +} + +// RecoveryWalkResponse - Response after calling a manual recovery walk +type RecoveryWalkResponse struct { + // READ-ONLY; The next update domain that needs to be walked. Null means walk spanning all update domains has been completed + NextPlatformUpdateDomain *int32 `json:"nextPlatformUpdateDomain,omitempty" azure:"ro"` + + // READ-ONLY; Whether the recovery walk was performed + WalkPerformed *bool `json:"walkPerformed,omitempty" azure:"ro"` +} + +// RegionalReplicationStatus - This is the regional replication status. +type RegionalReplicationStatus struct { + // READ-ONLY; The details of the replication status. + Details *string `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; It indicates progress of the replication job. + Progress *int32 `json:"progress,omitempty" azure:"ro"` + + // READ-ONLY; The region to which the gallery image version is being replicated to. + Region *string `json:"region,omitempty" azure:"ro"` + + // READ-ONLY; This is the regional replication state. + State *ReplicationState `json:"state,omitempty" azure:"ro"` +} + +// RegionalSharingStatus - Gallery regional sharing status +type RegionalSharingStatus struct { + // Details of gallery regional sharing failure. + Details *string `json:"details,omitempty"` + + // Region name + Region *string `json:"region,omitempty"` + + // READ-ONLY; Gallery sharing state in current region + State *SharingState `json:"state,omitempty" azure:"ro"` +} + +// ReplicationStatus - This is the replication status of the gallery image version. +type ReplicationStatus struct { + // READ-ONLY; This is the aggregated replication status based on all the regional replication status flags. + AggregatedState *AggregatedReplicationState `json:"aggregatedState,omitempty" azure:"ro"` + + // READ-ONLY; This is a summary of replication status for each region. + Summary []*RegionalReplicationStatus `json:"summary,omitempty" azure:"ro"` +} + +// RequestRateByIntervalInput - Api request input for LogAnalytics getRequestRateByInterval Api. +type RequestRateByIntervalInput struct { + // REQUIRED; SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + + // REQUIRED; From time of the query + FromTime *time.Time `json:"fromTime,omitempty"` + + // REQUIRED; Interval value in minutes used to create LogAnalytics call rate logs. + IntervalLength *IntervalInMins `json:"intervalLength,omitempty"` + + // REQUIRED; To time of the query + ToTime *time.Time `json:"toTime,omitempty"` + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + + // Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + + // Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + + // Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` +} + +// Resource - The Resource model definition. +type Resource struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceInstanceViewStatus - Instance view status. +type ResourceInstanceViewStatus struct { + // The level code. + Level *StatusLevelTypes `json:"level,omitempty"` + + // READ-ONLY; The status code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty" azure:"ro"` + + // READ-ONLY; The detailed status message, including for alerts and error messages. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The time of the status. + Time *time.Time `json:"time,omitempty" azure:"ro"` +} + +// ResourceRange - Describes the resource range. +type ResourceRange struct { + // The maximum number of the resource. + Max *int32 `json:"max,omitempty"` + + // The minimum number of the resource. + Min *int32 `json:"min,omitempty"` +} + +// ResourceSKU - Describes an available Compute SKU. +type ResourceSKU struct { + // READ-ONLY; The api versions that support this SKU. + APIVersions []*string `json:"apiVersions,omitempty" azure:"ro"` + + // READ-ONLY; A name value pair to describe the capability. + Capabilities []*ResourceSKUCapabilities `json:"capabilities,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *ResourceSKUCapacity `json:"capacity,omitempty" azure:"ro"` + + // READ-ONLY; Metadata for retrieving price info. + Costs []*ResourceSKUCosts `json:"costs,omitempty" azure:"ro"` + + // READ-ONLY; The Family of this particular SKU. + Family *string `json:"family,omitempty" azure:"ro"` + + // READ-ONLY; The Kind of resources that are supported in this SKU. + Kind *string `json:"kind,omitempty" azure:"ro"` + + // READ-ONLY; A list of locations and availability zones in those locations where the SKU is available. + LocationInfo []*ResourceSKULocationInfo `json:"locationInfo,omitempty" azure:"ro"` + + // READ-ONLY; The set of locations that the SKU is available. + Locations []*string `json:"locations,omitempty" azure:"ro"` + + // READ-ONLY; The name of SKU. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions []*ResourceSKURestrictions `json:"restrictions,omitempty" azure:"ro"` + + // READ-ONLY; The Size of the SKU. + Size *string `json:"size,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the tier of virtual machines in a scale set. + // Possible Values: + // Standard + // Basic + Tier *string `json:"tier,omitempty" azure:"ro"` +} + +// ResourceSKUCapabilities - Describes The SKU capabilities object. +type ResourceSKUCapabilities struct { + // READ-ONLY; An invariant to describe the feature. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty" azure:"ro"` +} + +// ResourceSKUCapacity - Describes scaling information of a SKU. +type ResourceSKUCapacity struct { + // READ-ONLY; The default capacity. + Default *int64 `json:"default,omitempty" azure:"ro"` + + // READ-ONLY; The maximum capacity that can be set. + Maximum *int64 `json:"maximum,omitempty" azure:"ro"` + + // READ-ONLY; The minimum capacity. + Minimum *int64 `json:"minimum,omitempty" azure:"ro"` + + // READ-ONLY; The scale type applicable to the sku. + ScaleType *ResourceSKUCapacityScaleType `json:"scaleType,omitempty" azure:"ro"` +} + +// ResourceSKUCosts - Describes metadata for retrieving price info. +type ResourceSKUCosts struct { + // READ-ONLY; An invariant to show the extended unit. + ExtendedUnit *string `json:"extendedUnit,omitempty" azure:"ro"` + + // READ-ONLY; Used for querying price from commerce. + MeterID *string `json:"meterID,omitempty" azure:"ro"` + + // READ-ONLY; The multiplier is needed to extend the base metered cost. + Quantity *int64 `json:"quantity,omitempty" azure:"ro"` +} + +// ResourceSKULocationInfo - Describes an available Compute SKU Location Information. +type ResourceSKULocationInfo struct { + // READ-ONLY; The names of extended locations. + ExtendedLocations []*string `json:"extendedLocations,omitempty" azure:"ro"` + + // READ-ONLY; Location of the SKU + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; The type of the extended location. + Type *ExtendedLocationType `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; Details of capabilities available to a SKU in specific zones. + ZoneDetails []*ResourceSKUZoneDetails `json:"zoneDetails,omitempty" azure:"ro"` + + // READ-ONLY; List of availability zones where the SKU is supported. + Zones []*string `json:"zones,omitempty" azure:"ro"` +} + +// ResourceSKURestrictionInfo - Describes an available Compute SKU Restriction Information. +type ResourceSKURestrictionInfo struct { + // READ-ONLY; Locations where the SKU is restricted + Locations []*string `json:"locations,omitempty" azure:"ro"` + + // READ-ONLY; List of availability zones where the SKU is restricted. + Zones []*string `json:"zones,omitempty" azure:"ro"` +} + +// ResourceSKURestrictions - Describes scaling information of a SKU. +type ResourceSKURestrictions struct { + // READ-ONLY; The reason for restriction. + ReasonCode *ResourceSKURestrictionsReasonCode `json:"reasonCode,omitempty" azure:"ro"` + + // READ-ONLY; The information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSKURestrictionInfo `json:"restrictionInfo,omitempty" azure:"ro"` + + // READ-ONLY; The type of restrictions. + Type *ResourceSKURestrictionsType `json:"type,omitempty" azure:"ro"` + + // 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" azure:"ro"` +} + +// ResourceSKUZoneDetails - Describes The zonal capabilities of a SKU. +type ResourceSKUZoneDetails struct { + // READ-ONLY; A list of capabilities that are available for the SKU in the specified list of zones. + Capabilities []*ResourceSKUCapabilities `json:"capabilities,omitempty" azure:"ro"` + + // READ-ONLY; The set of zones that the SKU is available in with the specified capabilities. + Name []*string `json:"name,omitempty" azure:"ro"` +} + +// ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.List method. +type ResourceSKUsClientListOptions struct { + // The filter to apply on the operation. Only location filter is supported currently. + Filter *string + // To Include Extended Locations information or not in the response. + IncludeExtendedLocations *string +} + +// ResourceSKUsResult - The List Resource Skus operation response. +type ResourceSKUsResult struct { + // REQUIRED; The list of skus available for the subscription. + Value []*ResourceSKU `json:"value,omitempty"` + + // The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceURIList - The List resources which are encrypted with the disk encryption set. +type ResourceURIList struct { + // REQUIRED; A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. + Value []*string `json:"value,omitempty"` + + // The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceWithOptionalLocation - The Resource model definition with location property as optional. +type ResourceWithOptionalLocation struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RestorePoint - Restore Point details. +type RestorePoint struct { + // The restore point properties. + Properties *RestorePointProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RestorePointCollection - Create or update Restore Point collection parameters. +type RestorePointCollection struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The restore point collection properties. + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RestorePointCollectionListResult - The List restore point collection operation response. +type RestorePointCollectionListResult struct { + // The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections + NextLink *string `json:"nextLink,omitempty"` + + // Gets the list of restore point collections. + Value []*RestorePointCollection `json:"value,omitempty"` +} + +// RestorePointCollectionProperties - The restore point collection properties. +type RestorePointCollectionProperties struct { + // The properties of the source resource that this restore point collection is created from. + Source *RestorePointCollectionSourceProperties `json:"source,omitempty"` + + // READ-ONLY; The provisioning state of the restore point collection. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The unique id of the restore point collection. + RestorePointCollectionID *string `json:"restorePointCollectionId,omitempty" azure:"ro"` + + // READ-ONLY; A list containing all restore points created under this restore point collection. + RestorePoints []*RestorePoint `json:"restorePoints,omitempty" azure:"ro"` +} + +// RestorePointCollectionSourceProperties - The properties of the source resource that this restore point collection is created +// from. +type RestorePointCollectionSourceProperties struct { + // Resource Id of the source resource used to create this restore point collection + ID *string `json:"id,omitempty"` + + // READ-ONLY; Location of the source resource used to create this restore point collection. + Location *string `json:"location,omitempty" azure:"ro"` +} + +// RestorePointCollectionUpdate - Update Restore Point collection parameters. +type RestorePointCollectionUpdate struct { + // The restore point collection properties. + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// RestorePointCollectionsClientBeginDeleteOptions contains the optional parameters for the RestorePointCollectionsClient.BeginDelete +// method. +type RestorePointCollectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RestorePointCollectionsClientCreateOrUpdateOptions contains the optional parameters for the RestorePointCollectionsClient.CreateOrUpdate +// method. +type RestorePointCollectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RestorePointCollectionsClientGetOptions contains the optional parameters for the RestorePointCollectionsClient.Get method. +type RestorePointCollectionsClientGetOptions struct { + // The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points + // in the restorePointCollection. + Expand *RestorePointCollectionExpandOptions +} + +// RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.ListAll +// method. +type RestorePointCollectionsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.List method. +type RestorePointCollectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// RestorePointCollectionsClientUpdateOptions contains the optional parameters for the RestorePointCollectionsClient.Update +// method. +type RestorePointCollectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// RestorePointInstanceView - The instance view of a restore point. +type RestorePointInstanceView struct { + // The disk restore points information. + DiskRestorePoints []*DiskRestorePointInstanceView `json:"diskRestorePoints,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` +} + +// RestorePointProperties - The restore point properties. +type RestorePointProperties struct { + // ConsistencyMode of the RestorePoint. Can be specified in the input while creating a restore point. For now, only CrashConsistent + // is accepted as a valid input. Please refer to + // https://aka.ms/RestorePoints for more details. + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty"` + + // List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks + // will be included. + ExcludeDisks []*APIEntityReference `json:"excludeDisks,omitempty"` + + // Resource Id of the source restore point from which a copy needs to be created. + SourceRestorePoint *APIEntityReference `json:"sourceRestorePoint,omitempty"` + + // Gets the creation time of the restore point. + TimeCreated *time.Time `json:"timeCreated,omitempty"` + + // READ-ONLY; The restore point instance view. + InstanceView *RestorePointInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; Gets the provisioning state of the restore point. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Gets the details of the VM captured at the time of the restore point creation. + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty" azure:"ro"` +} + +// RestorePointSourceMetadata - Describes the properties of the Virtual Machine for which the restore point was created. The +// properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the +// time of the restore point creation. +type RestorePointSourceMetadata struct { + // Gets the diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + + // Gets the hardware profile. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + + // Gets the license type, which is for bring your own license scenario. + LicenseType *string `json:"licenseType,omitempty"` + + // Location of the VM from which the restore point was created. + Location *string `json:"location,omitempty"` + + // Gets the OS profile. + OSProfile *OSProfile `json:"osProfile,omitempty"` + + // Gets the security profile. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + + // Gets the storage profile. + StorageProfile *RestorePointSourceVMStorageProfile `json:"storageProfile,omitempty"` + + // Gets the virtual machine unique id. + VMID *string `json:"vmId,omitempty"` +} + +// RestorePointSourceVMDataDisk - Describes a data disk. +type RestorePointSourceVMDataDisk struct { + // Gets the caching type. + Caching *CachingTypes `json:"caching,omitempty"` + + // Gets the disk restore point Id. + DiskRestorePoint *APIEntityReference `json:"diskRestorePoint,omitempty"` + + // Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Gets the logical unit number. + Lun *int32 `json:"lun,omitempty"` + + // Gets the managed disk details + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + + // Gets the disk name. + Name *string `json:"name,omitempty"` +} + +// RestorePointSourceVMOSDisk - Describes an Operating System disk. +type RestorePointSourceVMOSDisk struct { + // Gets the caching type. + Caching *CachingTypes `json:"caching,omitempty"` + + // Gets the disk restore point Id. + DiskRestorePoint *APIEntityReference `json:"diskRestorePoint,omitempty"` + + // Gets the disk size in GB. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Gets the disk encryption settings. + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + + // Gets the managed disk details + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + + // Gets the disk name. + Name *string `json:"name,omitempty"` + + // Gets the Operating System type. + OSType *OperatingSystemType `json:"osType,omitempty"` +} + +// RestorePointSourceVMStorageProfile - Describes the storage profile. +type RestorePointSourceVMStorageProfile struct { + // Gets the data disks of the VM captured at the time of the restore point creation. + DataDisks []*RestorePointSourceVMDataDisk `json:"dataDisks,omitempty"` + + // Gets the OS disk of the VM captured at the time of the restore point creation. + OSDisk *RestorePointSourceVMOSDisk `json:"osDisk,omitempty"` +} + +// RestorePointsClientBeginCreateOptions contains the optional parameters for the RestorePointsClient.BeginCreate method. +type RestorePointsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RestorePointsClientBeginDeleteOptions contains the optional parameters for the RestorePointsClient.BeginDelete method. +type RestorePointsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RestorePointsClientGetOptions contains the optional parameters for the RestorePointsClient.Get method. +type RestorePointsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' retrieves information about the run-time state of a restore + // point. + Expand *RestorePointExpandOptions +} + +// RetrieveBootDiagnosticsDataResult - The SAS URIs of the console screenshot and serial log blobs. +type RetrieveBootDiagnosticsDataResult struct { + // READ-ONLY; The console screenshot blob URI + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty" azure:"ro"` + + // READ-ONLY; The serial console log blob URI. + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty" azure:"ro"` +} + +// RoleInstance - Describes the cloud service role instance. +type RoleInstance struct { + // Role instance properties. + Properties *RoleInstanceProperties `json:"properties,omitempty"` + + // The role instance SKU. + SKU *InstanceSKU `json:"sku,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource Location. + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource Name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource tags. + Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + + // READ-ONLY; Resource Type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RoleInstanceListResult - The list operation result. +type RoleInstanceListResult struct { + // REQUIRED; The list of resources. + Value []*RoleInstance `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleInstanceNetworkProfile - Describes the network profile for the role instance. +type RoleInstanceNetworkProfile struct { + // READ-ONLY; Specifies the list of resource Ids for the network interfaces associated with the role instance. + NetworkInterfaces []*SubResource `json:"networkInterfaces,omitempty" azure:"ro"` +} + +// RoleInstanceProperties - Role instance properties. +type RoleInstanceProperties struct { + // The instance view of the role instance. + InstanceView *RoleInstanceView `json:"instanceView,omitempty"` + + // Describes the network profile for the role instance. + NetworkProfile *RoleInstanceNetworkProfile `json:"networkProfile,omitempty"` +} + +// RoleInstanceView - The instance view of the role instance. +type RoleInstanceView struct { + // READ-ONLY; The Fault Domain. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty" azure:"ro"` + + // READ-ONLY; The Update Domain. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty" azure:"ro"` + + // READ-ONLY; Specifies a unique identifier generated internally for the cloud service associated with this role instance. + // NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + PrivateID *string `json:"privateId,omitempty" azure:"ro"` + + // READ-ONLY + Statuses []*ResourceInstanceViewStatus `json:"statuses,omitempty" azure:"ro"` +} + +// RoleInstances - Specifies a list of role instances from the cloud service. +type RoleInstances struct { + // REQUIRED; List of cloud service role instance names. Value of '*' will signify all role instances of the cloud service. + RoleInstances []*string `json:"roleInstances,omitempty"` +} + +// RollbackStatusInfo - Information about rollback on failed VM instances after a OS Upgrade operation. +type RollbackStatusInfo struct { + // READ-ONLY; The number of instances which failed to rollback. + FailedRolledbackInstanceCount *int32 `json:"failedRolledbackInstanceCount,omitempty" azure:"ro"` + + // READ-ONLY; Error details if OS rollback failed. + RollbackError *APIError `json:"rollbackError,omitempty" azure:"ro"` + + // READ-ONLY; The number of instances which have been successfully rolled back. + SuccessfullyRolledbackInstanceCount *int32 `json:"successfullyRolledbackInstanceCount,omitempty" azure:"ro"` +} + +// RollingUpgradePolicy - The configuration parameters used while performing a rolling upgrade. +type RollingUpgradePolicy struct { + // Allow VMSS to ignore AZ boundaries when constructing upgrade batches. Take into consideration the Update Domain and maxBatchInstancePercent + // to determine the batch size. + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + + // The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one + // batch. As this is a maximum, unhealthy instances in previous or future batches + // can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter + // is 20%. + MaxBatchInstancePercent *int32 `json:"maxBatchInstancePercent,omitempty"` + + // The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either + // as a result of being upgraded, or by being found in an unhealthy state by + // the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting + // any batch. The default value for this parameter is 20%. + MaxUnhealthyInstancePercent *int32 `json:"maxUnhealthyInstancePercent,omitempty"` + + // The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check + // will happen after each batch is upgraded. If this percentage is ever exceeded, + // the rolling update aborts. The default value for this parameter is 20%. + MaxUnhealthyUpgradedInstancePercent *int32 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + + // The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time + // duration should be specified in ISO 8601 format. The default value is 0 seconds + // (PT0S). + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + + // Upgrade all unhealthy instances in a scale set before any healthy instances. + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` +} + +// RollingUpgradeProgressInfo - Information about the number of virtual machine instances in each upgrade state. +type RollingUpgradeProgressInfo struct { + // READ-ONLY; The number of instances that have failed to be upgraded successfully. + FailedInstanceCount *int32 `json:"failedInstanceCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of instances that are currently being upgraded. + InProgressInstanceCount *int32 `json:"inProgressInstanceCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of instances that have not yet begun to be upgraded. + PendingInstanceCount *int32 `json:"pendingInstanceCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of instances that have been successfully upgraded. + SuccessfulInstanceCount *int32 `json:"successfulInstanceCount,omitempty" azure:"ro"` +} + +// RollingUpgradeRunningStatus - Information about the current running state of the overall upgrade. +type RollingUpgradeRunningStatus struct { + // READ-ONLY; Code indicating the current status of the upgrade. + Code *RollingUpgradeStatusCode `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The last action performed on the rolling upgrade. + LastAction *RollingUpgradeActionType `json:"lastAction,omitempty" azure:"ro"` + + // READ-ONLY; Last action time of the upgrade. + LastActionTime *time.Time `json:"lastActionTime,omitempty" azure:"ro"` + + // READ-ONLY; Start time of the upgrade. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` +} + +// RollingUpgradeStatusInfo - The status of the latest virtual machine scale set rolling upgrade. +type RollingUpgradeStatusInfo struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The status of the latest virtual machine scale set rolling upgrade. + Properties *RollingUpgradeStatusInfoProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RollingUpgradeStatusInfoProperties - The status of the latest virtual machine scale set rolling upgrade. +type RollingUpgradeStatusInfoProperties struct { + // READ-ONLY; Error details for this upgrade, if there are any. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The rolling upgrade policies applied for this upgrade. + Policy *RollingUpgradePolicy `json:"policy,omitempty" azure:"ro"` + + // READ-ONLY; Information about the number of virtual machine instances in each upgrade state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty" azure:"ro"` + + // READ-ONLY; Information about the current running state of the overall upgrade. + RunningStatus *RollingUpgradeRunningStatus `json:"runningStatus,omitempty" azure:"ro"` +} + +// RunCommandDocument - Describes the properties of a Run Command. +type RunCommandDocument struct { + // REQUIRED; The VM run command description. + Description *string `json:"description,omitempty"` + + // REQUIRED; The VM run command id. + ID *string `json:"id,omitempty"` + + // REQUIRED; The VM run command label. + Label *string `json:"label,omitempty"` + + // REQUIRED; The Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // REQUIRED; The VM run command schema. + Schema *string `json:"$schema,omitempty"` + + // REQUIRED; The script to be executed. + Script []*string `json:"script,omitempty"` + + // The parameters used by the script. + Parameters []*RunCommandParameterDefinition `json:"parameters,omitempty"` +} + +// RunCommandDocumentBase - Describes the properties of a Run Command metadata. +type RunCommandDocumentBase struct { + // REQUIRED; The VM run command description. + Description *string `json:"description,omitempty"` + + // REQUIRED; The VM run command id. + ID *string `json:"id,omitempty"` + + // REQUIRED; The VM run command label. + Label *string `json:"label,omitempty"` + + // REQUIRED; The Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // REQUIRED; The VM run command schema. + Schema *string `json:"$schema,omitempty"` +} + +// RunCommandInput - Capture Virtual Machine parameters. +type RunCommandInput struct { + // REQUIRED; The run command id. + CommandID *string `json:"commandId,omitempty"` + + // The run command parameters. + Parameters []*RunCommandInputParameter `json:"parameters,omitempty"` + + // Optional. The script to be executed. When this value is given, the given script will override the default script of the + // command. + Script []*string `json:"script,omitempty"` +} + +// RunCommandInputParameter - Describes the properties of a run command parameter. +type RunCommandInputParameter struct { + // REQUIRED; The run command parameter name. + Name *string `json:"name,omitempty"` + + // REQUIRED; The run command parameter value. + Value *string `json:"value,omitempty"` +} + +// RunCommandListResult - The List Virtual Machine operation response. +type RunCommandListResult struct { + // REQUIRED; The list of virtual machine run commands. + Value []*RunCommandDocumentBase `json:"value,omitempty"` + + // The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands. + NextLink *string `json:"nextLink,omitempty"` +} + +// RunCommandParameterDefinition - Describes the properties of a run command parameter. +type RunCommandParameterDefinition struct { + // REQUIRED; The run command parameter name. + Name *string `json:"name,omitempty"` + + // REQUIRED; The run command parameter type. + Type *string `json:"type,omitempty"` + + // The run command parameter default value. + DefaultValue *string `json:"defaultValue,omitempty"` + + // The run command parameter required. + Required *bool `json:"required,omitempty"` +} + +type RunCommandResult struct { + // Run command operation response. + Value []*InstanceViewStatus `json:"value,omitempty"` +} + +// SKU - Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set +// is currently on, you need to deallocate the VMs in the scale set before you modify the +// SKU name. +type SKU struct { + // Specifies the number of virtual machines in the scale set. + Capacity *int64 `json:"capacity,omitempty"` + + // The sku name. + Name *string `json:"name,omitempty"` + + // Specifies the tier of virtual machines in a scale set. + // Possible Values: + // Standard + // Basic + Tier *string `json:"tier,omitempty"` +} + +// SSHConfiguration - SSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + // The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys []*SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey - Contains information about SSH certificate public key and the path on the Linux VM where the public key +// is placed. +type SSHPublicKey struct { + // SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa + // format. + // For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + KeyData *string `json:"keyData,omitempty"` + + // Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + // is appended to the file. Example: /home/user/.ssh/authorized_keys + Path *string `json:"path,omitempty"` +} + +// SSHPublicKeyGenerateKeyPairResult - Response from generation of an SSH key pair. +type SSHPublicKeyGenerateKeyPairResult struct { + // REQUIRED; The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + ID *string `json:"id,omitempty"` + + // REQUIRED; Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is + // returned in RFC3447 format and should be treated as a secret. + PrivateKey *string `json:"privateKey,omitempty"` + + // REQUIRED; Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in + // ssh-rsa format. + PublicKey *string `json:"publicKey,omitempty"` +} + +// SSHPublicKeyResource - Specifies information about the SSH public key. +type SSHPublicKeyResource struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Properties of the SSH public key. + Properties *SSHPublicKeyResourceProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SSHPublicKeyResourceProperties - Properties of the SSH public key. +type SSHPublicKeyResourceProperties struct { + // SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the + // resource is created, the publicKey property will be populated when + // generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at + // least 2048-bit and in ssh-rsa format. + PublicKey *string `json:"publicKey,omitempty"` +} + +// SSHPublicKeyUpdateResource - Specifies information about the SSH public key. +type SSHPublicKeyUpdateResource struct { + // Properties of the SSH public key. + Properties *SSHPublicKeyResourceProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// SSHPublicKeysClientCreateOptions contains the optional parameters for the SSHPublicKeysClient.Create method. +type SSHPublicKeysClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientDeleteOptions contains the optional parameters for the SSHPublicKeysClient.Delete method. +type SSHPublicKeysClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientGenerateKeyPairOptions contains the optional parameters for the SSHPublicKeysClient.GenerateKeyPair +// method. +type SSHPublicKeysClientGenerateKeyPairOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientGetOptions contains the optional parameters for the SSHPublicKeysClient.Get method. +type SSHPublicKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.ListByResourceGroup +// method. +type SSHPublicKeysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.ListBySubscription +// method. +type SSHPublicKeysClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysClientUpdateOptions contains the optional parameters for the SSHPublicKeysClient.Update method. +type SSHPublicKeysClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SSHPublicKeysGroupListResult - The list SSH public keys operation response. +type SSHPublicKeysGroupListResult struct { + // REQUIRED; The list of SSH public keys + Value []*SSHPublicKeyResource `json:"value,omitempty"` + + // The URI to fetch the next page of SSH public keys. Call ListNext() with this URI to fetch the next page of SSH public keys. + NextLink *string `json:"nextLink,omitempty"` +} + +// ScaleInPolicy - Describes a scale-in policy for a virtual machine scale set. +type ScaleInPolicy struct { + // This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine + // scale set is being scaled-in.(Feature in Preview) + ForceDeletion *bool `json:"forceDeletion,omitempty"` + + // The rules to be followed when scaling-in a virtual machine scale set. + // Possible values are: + // Default When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal + // scale set. Then, it will be balanced across Fault Domains as far as possible. + // Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. + // OldestVM When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in + // will be chosen for removal. For zonal virtual machine scale sets, the + // scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will + // be chosen for removal. + // NewestVM When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in + // will be chosen for removal. For zonal virtual machine scale sets, the + // scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will + // be chosen for removal. + Rules []*VirtualMachineScaleSetScaleInRules `json:"rules,omitempty"` +} + +type ScheduledEventsProfile struct { + // Specifies Terminate Scheduled Event related configurations. + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} + +// SecurityProfile - Specifies the Security profile settings for the virtual machine or virtual machine scale set. +type SecurityProfile struct { + // This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual + // machine scale set. This will enable the encryption for all the disks + // including Resource/Temp disk at host itself. + // Default: The Encryption at host will be disabled unless this property is set to true for the resource. + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + + // Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. + // Default: UefiSettings will not be enabled unless this property is set. + SecurityType *SecurityTypes `json:"securityType,omitempty"` + + // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. + // Minimum api-version: 2020-12-01 + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} + +type ShareInfoElement struct { + // READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + VMURI *string `json:"vmUri,omitempty" azure:"ro"` +} + +// SharedGalleriesClientGetOptions contains the optional parameters for the SharedGalleriesClient.Get method. +type SharedGalleriesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedGalleriesClientListOptions contains the optional parameters for the SharedGalleriesClient.List method. +type SharedGalleriesClientListOptions struct { + // The query parameter to decide what shared galleries to fetch when doing listing operations. + SharedTo *SharedToValues +} + +// SharedGallery - Specifies information about the Shared Gallery that you want to create or update. +type SharedGallery struct { + // The identifier information of shared gallery. + Identifier *SharedGalleryIdentifier `json:"identifier,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// SharedGalleryDataDiskImage - This is the data disk image. +type SharedGalleryDataDiskImage struct { + // REQUIRED; This property specifies the logical unit number of the data disk. This value is used to identify data disks within + // the Virtual Machine and therefore must be unique for each data disk attached to the + // Virtual Machine. + Lun *int32 `json:"lun,omitempty"` + + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *SharedGalleryHostCaching `json:"hostCaching,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty" azure:"ro"` +} + +// SharedGalleryDiskImage - This is the disk image base class. +type SharedGalleryDiskImage struct { + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *SharedGalleryHostCaching `json:"hostCaching,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty" azure:"ro"` +} + +// SharedGalleryIdentifier - The identifier information of shared gallery. +type SharedGalleryIdentifier struct { + // The unique id of this shared gallery. + UniqueID *string `json:"uniqueId,omitempty"` +} + +// SharedGalleryImage - Specifies information about the gallery image definition that you want to create or update. +type SharedGalleryImage struct { + // The identifier information of shared gallery. + Identifier *SharedGalleryIdentifier `json:"identifier,omitempty"` + + // Describes the properties of a gallery image definition. + Properties *SharedGalleryImageProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// SharedGalleryImageList - The List Shared Gallery Images operation response. +type SharedGalleryImageList struct { + // REQUIRED; A list of shared gallery images. + Value []*SharedGalleryImage `json:"value,omitempty"` + + // The uri to fetch the next page of shared gallery images. Call ListNext() with this to fetch the next page of shared gallery + // images. + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedGalleryImageProperties - Describes the properties of a gallery image definition. +type SharedGalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier `json:"identifier,omitempty"` + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' + // or 'Specialized'. + OSState *OperatingSystemStateTypes `json:"osState,omitempty"` + + // REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a + // managed image. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // The architecture of the image. Applicable to OS disks only. + Architecture *Architecture `json:"architecture,omitempty"` + + // Describes the disallowed disk types. + Disallowed *Disallowed `json:"disallowed,omitempty"` + + // The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property + // is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // End-user license agreement for the current community gallery image. + Eula *string `json:"eula,omitempty"` + + // A list of gallery image features. + Features []*GalleryImageFeature `json:"features,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // Privacy statement uri for the current community gallery image. + PrivacyStatementURI *string `json:"privacyStatementUri,omitempty"` + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan `json:"purchasePlan,omitempty"` + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration `json:"recommended,omitempty"` +} + +// SharedGalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type SharedGalleryImageVersion struct { + // The identifier information of shared gallery. + Identifier *SharedGalleryIdentifier `json:"identifier,omitempty"` + + // Describes the properties of a gallery image version. + Properties *SharedGalleryImageVersionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// SharedGalleryImageVersionList - The List Shared Gallery Image versions operation response. +type SharedGalleryImageVersionList struct { + // REQUIRED; A list of shared gallery images versions. + Value []*SharedGalleryImageVersion `json:"value,omitempty"` + + // The uri to fetch the next page of shared gallery image versions. Call ListNext() with this to fetch the next page of shared + // gallery image versions. + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedGalleryImageVersionProperties - Describes the properties of a gallery image version. +type SharedGalleryImageVersionProperties struct { + // The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + + // The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This + // property is updatable. + PublishedDate *time.Time `json:"publishedDate,omitempty"` + + // Describes the storage profile of the image version. + StorageProfile *SharedGalleryImageVersionStorageProfile `json:"storageProfile,omitempty"` +} + +// SharedGalleryImageVersionStorageProfile - This is the storage profile of a Gallery Image Version. +type SharedGalleryImageVersionStorageProfile struct { + // A list of data disk images. + DataDiskImages []*SharedGalleryDataDiskImage `json:"dataDiskImages,omitempty"` + + // This is the OS disk image. + OSDiskImage *SharedGalleryOSDiskImage `json:"osDiskImage,omitempty"` +} + +// SharedGalleryImageVersionsClientGetOptions contains the optional parameters for the SharedGalleryImageVersionsClient.Get +// method. +type SharedGalleryImageVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedGalleryImageVersionsClientListOptions contains the optional parameters for the SharedGalleryImageVersionsClient.List +// method. +type SharedGalleryImageVersionsClientListOptions struct { + // The query parameter to decide what shared galleries to fetch when doing listing operations. + SharedTo *SharedToValues +} + +// SharedGalleryImagesClientGetOptions contains the optional parameters for the SharedGalleryImagesClient.Get method. +type SharedGalleryImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedGalleryImagesClientListOptions contains the optional parameters for the SharedGalleryImagesClient.List method. +type SharedGalleryImagesClientListOptions struct { + // The query parameter to decide what shared galleries to fetch when doing listing operations. + SharedTo *SharedToValues +} + +// SharedGalleryList - The List Shared Galleries operation response. +type SharedGalleryList struct { + // REQUIRED; A list of shared galleries. + Value []*SharedGallery `json:"value,omitempty"` + + // The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch the next page of shared galleries. + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedGalleryOSDiskImage - This is the OS disk image. +type SharedGalleryOSDiskImage struct { + // The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite' + HostCaching *SharedGalleryHostCaching `json:"hostCaching,omitempty"` + + // READ-ONLY; This property indicates the size of the VHD to be created. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty" azure:"ro"` +} + +// SharingProfile - Profile for gallery sharing to subscription or tenant +type SharingProfile struct { + // Information of community gallery if current gallery is shared to community. + CommunityGalleryInfo *CommunityGalleryInfo `json:"communityGalleryInfo,omitempty"` + + // This property allows you to specify the permission of sharing gallery. + // Possible values are: + // Private + // Groups + // Community + Permissions *GallerySharingPermissionTypes `json:"permissions,omitempty"` + + // READ-ONLY; A list of sharing profile groups. + Groups []*SharingProfileGroup `json:"groups,omitempty" azure:"ro"` +} + +// SharingProfileGroup - Group of the gallery sharing profile +type SharingProfileGroup struct { + // A list of subscription/tenant ids the gallery is aimed to be shared to. + IDs []*string `json:"ids,omitempty"` + + // This property allows you to specify the type of sharing group. + // Possible values are: + // Subscriptions + // AADTenants + Type *SharingProfileGroupTypes `json:"type,omitempty"` +} + +// SharingStatus - Sharing status of current gallery. +type SharingStatus struct { + // Summary of all regional sharing status. + Summary []*RegionalSharingStatus `json:"summary,omitempty"` + + // READ-ONLY; Aggregated sharing state of current gallery. + AggregatedState *SharingState `json:"aggregatedState,omitempty" azure:"ro"` +} + +// SharingUpdate - Specifies information about the gallery sharing profile update. +type SharingUpdate struct { + // REQUIRED; This property allows you to specify the operation type of gallery sharing update. + // Possible values are: + // Add + // Remove + // Reset + OperationType *SharingUpdateOperationTypes `json:"operationType,omitempty"` + + // A list of sharing profile groups. + Groups []*SharingProfileGroup `json:"groups,omitempty"` +} + +// Snapshot resource. +type Snapshot struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location where the snapshot will be created. Extended location cannot be changed. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Snapshot resource properties. + Properties *SnapshotProperties `json:"properties,omitempty"` + + // The snapshots sku name. Can be StandardLRS, PremiumLRS, or Standard_ZRS. This is an optional parameter for incremental + // snapshot and the default behavior is the SKU will be set to the same sku as the + // previous snapshot + SKU *SnapshotSKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Unused. Always Null. + ManagedBy *string `json:"managedBy,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SnapshotList - The List Snapshots operation response. +type SnapshotList struct { + // REQUIRED; A list of snapshots. + Value []*Snapshot `json:"value,omitempty"` + + // The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. + NextLink *string `json:"nextLink,omitempty"` +} + +// SnapshotProperties - Snapshot resource properties. +type SnapshotProperties struct { + // REQUIRED; Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + + // Percentage complete for the background copy when a resource is created via the CopyStart operation. + CompletionPercent *float32 `json:"completionPercent,omitempty"` + + // Indicates the error details if the background copy of a resource created via the CopyStart operation fails. + CopyCompletionError *CopyCompletionError `json:"copyCompletionError,omitempty"` + + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode `json:"dataAccessAuthMode,omitempty"` + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string `json:"diskAccessId,omitempty"` + + // If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this + // field is present for updates or creation with other options, it indicates a + // resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can + // be diffed. + Incremental *bool `json:"incremental,omitempty"` + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + // The Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Purchase plan information for the image from which the source disk for the snapshot was originally created. + PurchasePlan *DiskPurchasePlan `json:"purchasePlan,omitempty"` + + // Contains the security related information for the resource. + SecurityProfile *DiskSecurityProfile `json:"securityProfile,omitempty"` + + // List of supported capabilities for the image from which the source disk from the snapshot was originally created. + SupportedCapabilities *SupportedCapabilities `json:"supportedCapabilities,omitempty"` + + // Indicates the OS on a snapshot supports hibernation. + SupportsHibernation *bool `json:"supportsHibernation,omitempty"` + + // READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 `json:"diskSizeBytes,omitempty" azure:"ro"` + + // READ-ONLY; The state of the snapshot. + DiskState *DiskState `json:"diskState,omitempty" azure:"ro"` + + // READ-ONLY; Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only + // be called on incremental snapshots with the same family id. + IncrementalSnapshotFamilyID *string `json:"incrementalSnapshotFamilyId,omitempty" azure:"ro"` + + // READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The time when the snapshot was created. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; Unique Guid identifying the resource. + UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` +} + +// SnapshotSKU - The snapshots sku name. Can be StandardLRS, PremiumLRS, or Standard_ZRS. This is an optional parameter for +// incremental snapshot and the default behavior is the SKU will be set to the same sku as the +// previous snapshot +type SnapshotSKU struct { + // The sku name. + Name *SnapshotStorageAccountTypes `json:"name,omitempty"` + + // READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty" azure:"ro"` +} + +// SnapshotUpdate - Snapshot update resource. +type SnapshotUpdate struct { + // Snapshot resource update properties. + Properties *SnapshotUpdateProperties `json:"properties,omitempty"` + + // The snapshots sku name. Can be StandardLRS, PremiumLRS, or Standard_ZRS. This is an optional parameter for incremental + // snapshot and the default behavior is the SKU will be set to the same sku as the + // previous snapshot + SKU *SnapshotSKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// SnapshotUpdateProperties - Snapshot resource update properties. +type SnapshotUpdateProperties struct { + // Additional authentication requirements when exporting or uploading to a disk or snapshot. + DataAccessAuthMode *DataAccessAuthMode `json:"dataAccessAuthMode,omitempty"` + + // ARM id of the DiskAccess resource for using private endpoints on disks. + DiskAccessID *string `json:"diskAccessId,omitempty"` + + // If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this + // field is present for updates or creation with other options, it indicates a + // resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + + // Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + + // Policy for accessing the disk via network. + NetworkAccessPolicy *NetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + // the Operating System type. + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Policy for controlling export on the disk. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // List of supported capabilities for the image from which the OS disk was created. + SupportedCapabilities *SupportedCapabilities `json:"supportedCapabilities,omitempty"` + + // Indicates the OS on a snapshot supports hibernation. + SupportsHibernation *bool `json:"supportsHibernation,omitempty"` +} + +// SnapshotsClientBeginCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.BeginCreateOrUpdate +// method. +type SnapshotsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientBeginDeleteOptions contains the optional parameters for the SnapshotsClient.BeginDelete method. +type SnapshotsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientBeginGrantAccessOptions contains the optional parameters for the SnapshotsClient.BeginGrantAccess method. +type SnapshotsClientBeginGrantAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientBeginRevokeAccessOptions contains the optional parameters for the SnapshotsClient.BeginRevokeAccess method. +type SnapshotsClientBeginRevokeAccessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientBeginUpdateOptions contains the optional parameters for the SnapshotsClient.BeginUpdate method. +type SnapshotsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +type SnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.ListByResourceGroup +// method. +type SnapshotsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.List method. +type SnapshotsClientListOptions struct { + // placeholder for future optional parameters +} + +// SoftDeletePolicy - Contains information about the soft deletion policy of the gallery. +type SoftDeletePolicy struct { + // Enables soft-deletion for resources in this gallery, allowing them to be recovered within retention time. + IsSoftDeleteEnabled *bool `json:"isSoftDeleteEnabled,omitempty"` +} + +// SourceVault - The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} +type SourceVault struct { + // Resource Id + ID *string `json:"id,omitempty"` +} + +// SpotRestorePolicy - Specifies the Spot-Try-Restore properties for the virtual machine scale set. +// With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically +// based on capacity availability and pricing constraint. +type SpotRestorePolicy struct { + // Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based + // on capacity availability and pricing constraints + Enabled *bool `json:"enabled,omitempty"` + + // Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances + RestoreTimeout *string `json:"restoreTimeout,omitempty"` +} + +// StatusCodeCount - The status code and count of the cloud service instance view statuses +type StatusCodeCount struct { + // READ-ONLY; The instance view status code + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Number of instances having this status code + Count *int32 `json:"count,omitempty" azure:"ro"` +} + +// StorageProfile - Specifies the storage settings for the virtual machine disks. +type StorageProfile struct { + // Specifies the parameters that are used to add a data disk to a virtual machine. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + DataDisks []*DataDisk `json:"dataDisks,omitempty"` + + // Specifies the disk controller type configured for the VM. + // NOTE: This property will be set to the default disk controller type if not specified provided virtual machine is being + // created as a hyperVGeneration: V2 based on the capabilities of the operating + // system disk and VM size from the the specified minimum api version. + // You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration + // which implicitly deallocates and reallocates the VM. + // Minimum api-version: 2022-08-01 + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + + // Specifies information about the image to use. You can specify information about platform images, marketplace images, or + // virtual machine images. This element is required when you want to use a platform + // image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + + // Specifies information about the operating system disk used by the virtual machine. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + OSDisk *OSDisk `json:"osDisk,omitempty"` +} + +type SubResource struct { + // Resource Id + ID *string `json:"id,omitempty"` +} + +type SubResourceReadOnly struct { + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` +} + +type SubResourceWithColocationStatus struct { + // Describes colocation status of a resource in the Proximity Placement Group. + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` +} + +// SupportedCapabilities - List of supported capabilities persisted on the disk resource for VM use. +type SupportedCapabilities struct { + // True if the image from which the OS disk is created supports accelerated networking. + AcceleratedNetwork *bool `json:"acceleratedNetwork,omitempty"` + + // CPU architecture supported by an OS disk. + Architecture *Architecture `json:"architecture,omitempty"` + + // The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI. + DiskControllerTypes *string `json:"diskControllerTypes,omitempty"` +} + +// SystemData - The system meta data relating to this resource. +type SystemData struct { + // READ-ONLY; Specifies the time in UTC at which the Cloud Service (extended support) resource was created. + // Minimum api-version: 2022-04-04. + CreatedAt *time.Time `json:"createdAt,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the time in UTC at which the Cloud Service (extended support) resource was last modified. + // Minimum api-version: 2022-04-04. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty" azure:"ro"` +} + +// TargetRegion - Describes the target region information. +type TargetRegion struct { + // REQUIRED; The name of the region. + Name *string `json:"name,omitempty"` + + // Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. + Encryption *EncryptionImages `json:"encryption,omitempty"` + + // Contains the flag setting to hide an image when users specify version='latest' + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + + // The number of replicas of the Image Version to be created per region. This property is updatable. + RegionalReplicaCount *int32 `json:"regionalReplicaCount,omitempty"` + + // Specifies the storage account type to be used to store the image. This property is not updatable. + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` +} + +type TerminateNotificationProfile struct { + // Specifies whether the Terminate Scheduled event is enabled or disabled. + Enable *bool `json:"enable,omitempty"` + + // Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event + // before the event is auto approved (timed out). The configuration must be + // specified in ISO 8601 format, the default value is 5 minutes (PT5M) + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} + +// ThrottledRequestsInput - Api request input for LogAnalytics getThrottledRequests Api. +type ThrottledRequestsInput struct { + // REQUIRED; SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + + // REQUIRED; From time of the query + FromTime *time.Time `json:"fromTime,omitempty"` + + // REQUIRED; To time of the query + ToTime *time.Time `json:"toTime,omitempty"` + + // Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + + // Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + + // Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + + // Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + + // Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` +} + +// UefiSettings - Specifies the security settings like secure boot and vTPM used while creating the virtual machine. +// Minimum api-version: 2020-12-01 +type UefiSettings struct { + // Specifies whether secure boot should be enabled on the virtual machine. + // Minimum api-version: 2020-12-01 + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + + // Specifies whether vTPM should be enabled on the virtual machine. + // Minimum api-version: 2020-12-01 + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} + +// UpdateDomain - Defines an update domain for the cloud service. +type UpdateDomain struct { + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource Name + Name *string `json:"name,omitempty" azure:"ro"` +} + +// UpdateDomainListResult - The list operation result. +type UpdateDomainListResult struct { + // REQUIRED; The list of resources. + Value []*UpdateDomain `json:"value,omitempty"` + + // The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null + // to fetch all the resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// UpdateResource - The Update Resource model definition. +type UpdateResource struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// UpdateResourceDefinition - The Update Resource model definition. +type UpdateResourceDefinition struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UpgradeOperationHistoricalStatusInfo - Virtual Machine Scale Set OS Upgrade History operation response. +type UpgradeOperationHistoricalStatusInfo struct { + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Information about the properties of the upgrade operation. + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UpgradeOperationHistoricalStatusInfoProperties - Describes each OS upgrade on the Virtual Machine Scale Set. +type UpgradeOperationHistoricalStatusInfoProperties struct { + // READ-ONLY; Error Details for this upgrade if there are any. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; Counts of the VMs in each state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty" azure:"ro"` + + // READ-ONLY; Information about OS rollback if performed + RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty" azure:"ro"` + + // READ-ONLY; Information about the overall status of the upgrade operation. + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty" azure:"ro"` + + // READ-ONLY; Invoker of the Upgrade Operation + StartedBy *UpgradeOperationInvoker `json:"startedBy,omitempty" azure:"ro"` + + // READ-ONLY; Image Reference details + TargetImageReference *ImageReference `json:"targetImageReference,omitempty" azure:"ro"` +} + +// UpgradeOperationHistoryStatus - Information about the current running state of the overall upgrade. +type UpgradeOperationHistoryStatus struct { + // READ-ONLY; Code indicating the current status of the upgrade. + Code *UpgradeState `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; End time of the upgrade. + EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; Start time of the upgrade. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` +} + +// UpgradePolicy - Describes an upgrade policy - automatic, manual, or rolling. +type UpgradePolicy struct { + // Configuration parameters used for performing automatic OS Upgrade. + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` + + // Specifies the mode of an upgrade to virtual machines in the scale set. + // Possible values are: + // Manual - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade + // action. + // Automatic - All virtual machines in the scale set are automatically updated at the same time. + Mode *UpgradeMode `json:"mode,omitempty"` + + // The configuration parameters used while performing a rolling upgrade. + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` +} + +// Usage - Describes Compute Resource Usage. +type Usage struct { + // REQUIRED; The current usage of the resource. + CurrentValue *int32 `json:"currentValue,omitempty"` + + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 `json:"limit,omitempty"` + + // REQUIRED; The name of the type of usage. + Name *UsageName `json:"name,omitempty"` + + // REQUIRED; An enum describing the unit of usage measurement. + Unit *string `json:"unit,omitempty"` +} + +// UsageClientListOptions contains the optional parameters for the UsageClient.List method. +type UsageClientListOptions struct { + // placeholder for future optional parameters +} + +// UsageName - The Usage Names. +type UsageName struct { + // The localized name of the resource. + LocalizedValue *string `json:"localizedValue,omitempty"` + + // The name of the resource. + Value *string `json:"value,omitempty"` +} + +type UserArtifactManage struct { + // REQUIRED; Required. The path and arguments to install the gallery application. This is limited to 4096 characters. + Install *string `json:"install,omitempty"` + + // REQUIRED; Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. + Remove *string `json:"remove,omitempty"` + + // Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove + // command on the previous version and install command on the current version + // of the gallery application. This is limited to 4096 characters. + Update *string `json:"update,omitempty"` +} + +// UserArtifactSettings - Additional settings for the VM app that contains the target package and config file name when it +// is deployed to target VM or VM scale set. +type UserArtifactSettings struct { + // Optional. The name to assign the downloaded config file on the VM. This is limited to 4096 characters. If not specified, + // the config file will be named the Gallery Application name appended with + // "_config". + ConfigFileName *string `json:"configFileName,omitempty"` + + // Optional. The name to assign the downloaded package file on the VM. This is limited to 4096 characters. If not specified, + // the package file will be named the same as the Gallery Application name. + PackageFileName *string `json:"packageFileName,omitempty"` +} + +// UserArtifactSource - The source image from which the Image Version is going to be created. +type UserArtifactSource struct { + // REQUIRED; Required. The mediaLink of the artifact, must be a readable storage page blob. + MediaLink *string `json:"mediaLink,omitempty"` + + // Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. + DefaultConfigurationLink *string `json:"defaultConfigurationLink,omitempty"` +} + +type UserAssignedIdentitiesValue struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +// VMDiskSecurityProfile - Specifies the security profile settings for the managed disk. +// NOTE: It can only be set for Confidential VMs +type VMDiskSecurityProfile struct { + // Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer Managed Key + // encrypted ConfidentialVM OS Disk and VMGuest blob. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Specifies the EncryptionType of the managed disk. + // It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly + // for encryption of just the VMGuestState blob. + // NOTE: It can be set for only Confidential VMs. + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} + +// VMGalleryApplication - Specifies the required information to reference a compute gallery application version +type VMGalleryApplication struct { + // REQUIRED; Specifies the GalleryApplicationVersion resource id on the form of + // /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + PackageReferenceID *string `json:"packageReferenceId,omitempty"` + + // Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided + ConfigurationReference *string `json:"configurationReference,omitempty"` + + // If set to true, when a new Gallery Application version is available in PIR/SIG, it will be automatically updated for the + // VM/VMSS + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + + // Optional, Specifies the order in which the packages have to be installed + Order *int32 `json:"order,omitempty"` + + // Optional, Specifies a passthrough value for more generic context. + Tags *string `json:"tags,omitempty"` + + // Optional, If true, any failure for any operation in the VmApplication will fail the deployment + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} + +// VMImagesInEdgeZoneListResult - The List VmImages in EdgeZone operation response. +type VMImagesInEdgeZoneListResult struct { + // The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() with this URI to fetch the next page of VmImages. + NextLink *string `json:"nextLink,omitempty"` + + // The list of VMImages in EdgeZone + Value []*VirtualMachineImageResource `json:"value,omitempty"` +} + +type VMScaleSetConvertToSinglePlacementGroupInput struct { + // Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, + // please use Virtual Machine Scale Set VMs - Get API. If not provided, the + // platform will choose one with maximum number of virtual machine instances. + ActivePlacementGroupID *string `json:"activePlacementGroupId,omitempty"` +} + +// VMSizeProperties - Specifies VM Size Property settings on the virtual machine. +type VMSizeProperties struct { + // Specifies the number of vCPUs available for the VM. + // When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available + // for that VM size exposed in api response of List all available virtual machine + // sizes in a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list] . + VCPUsAvailable *int32 `json:"vCPUsAvailable,omitempty"` + + // Specifies the vCPU to physical core ratio. + // When this property is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the + // VM Size exposed in api response of List all available virtual machine sizes in + // a region [https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list] + // Setting this property to 1 also means that hyper-threading is disabled. + VCPUsPerCore *int32 `json:"vCPUsPerCore,omitempty"` +} + +// VaultCertificate - Describes a single certificate reference in a Key Vault, and where the certificate should reside on +// the VM. +type VaultCertificate struct { + // For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified + // certificate store is implicitly in the LocalMachine account. + // For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name .crt + // for the X509 certificate file and .prv for private + // key. Both of these files are .pem formatted. + CertificateStore *string `json:"certificateStore,omitempty"` + + // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, + // see Add a key or secret to the key vault + // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be It + // is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + // { + // "data":"", + // "dataType":"pfx", + // "password":"" + // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for + // Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension + // for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + CertificateURL *string `json:"certificateUrl,omitempty"` +} + +// VaultSecretGroup - Describes a set of certificates which are all in the same Key Vault. +type VaultSecretGroup struct { + // The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + SourceVault *SubResource `json:"sourceVault,omitempty"` + + // The list of key vault references in SourceVault which contain certificates. + VaultCertificates []*VaultCertificate `json:"vaultCertificates,omitempty"` +} + +// VirtualHardDisk - Describes the uri of a disk. +type VirtualHardDisk struct { + // Specifies the virtual hard disk's uri. + URI *string `json:"uri,omitempty"` +} + +// VirtualMachine - Describes a Virtual Machine. +type VirtualMachine struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + + // Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace + // images. Before you can use a marketplace image from an API, you must + // enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click + // Want to deploy programmatically, Get Started ->. Enter any required + // information and then click Save. + Plan *Plan `json:"plan,omitempty"` + + // Describes the properties of a Virtual Machine. + Properties *VirtualMachineProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // The virtual machine zones. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The virtual machine child extension resources. + Resources []*VirtualMachineExtension `json:"resources,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineAgentInstanceView - The instance view of the VM Agent running on the virtual machine. +type VirtualMachineAgentInstanceView struct { + // The virtual machine extension handler instance view. + ExtensionHandlers []*VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // The VM Agent full version. + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} + +// VirtualMachineAssessPatchesResult - Describes the properties of an AssessPatches result. +type VirtualMachineAssessPatchesResult struct { + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + AssessmentActivityID *string `json:"assessmentActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The list of patches that have been detected as available for installation. + AvailablePatches []*VirtualMachineSoftwarePatchProperties `json:"availablePatches,omitempty" azure:"ro"` + + // READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 `json:"criticalAndSecurityPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 `json:"otherPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete + // installation but the reboot has not yet occurred. + RebootPending *bool `json:"rebootPending,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time `json:"startDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Unknown", "Failed", "Succeeded", or + // "CompletedWithWarnings." + Status *PatchOperationStatus `json:"status,omitempty" azure:"ro"` +} + +// VirtualMachineCaptureParameters - Capture Virtual Machine parameters. +type VirtualMachineCaptureParameters struct { + // REQUIRED; The destination container name. + DestinationContainerName *string `json:"destinationContainerName,omitempty"` + + // REQUIRED; Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + OverwriteVhds *bool `json:"overwriteVhds,omitempty"` + + // REQUIRED; The captured virtual hard disk's name prefix. + VhdPrefix *string `json:"vhdPrefix,omitempty"` +} + +// VirtualMachineCaptureResult - Output of virtual machine capture operation. +type VirtualMachineCaptureResult struct { + // Resource Id + ID *string `json:"id,omitempty"` + + // READ-ONLY; the version of the content + ContentVersion *string `json:"contentVersion,omitempty" azure:"ro"` + + // READ-ONLY; parameters of the captured virtual machine + Parameters interface{} `json:"parameters,omitempty" azure:"ro"` + + // READ-ONLY; a list of resource items of the captured virtual machine + Resources []interface{} `json:"resources,omitempty" azure:"ro"` + + // READ-ONLY; the schema of the captured virtual machine + Schema *string `json:"$schema,omitempty" azure:"ro"` +} + +// VirtualMachineExtension - Describes a Virtual Machine Extension. +type VirtualMachineExtension struct { + // Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineExtensionHandlerInstanceView - The instance view of a virtual machine extension handler. +type VirtualMachineExtensionHandlerInstanceView struct { + // The extension handler status. + Status *InstanceViewStatus `json:"status,omitempty"` + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + + // Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} + +// VirtualMachineExtensionImage - Describes a Virtual Machine Extension Image. +type VirtualMachineExtensionImage struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a Virtual Machine Extension Image. + Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineExtensionImageProperties - Describes the properties of a Virtual Machine Extension Image. +type VirtualMachineExtensionImageProperties struct { + // REQUIRED; The type of role (IaaS or PaaS) this extension supports. + ComputeRole *string `json:"computeRole,omitempty"` + + // REQUIRED; The schema defined by publisher, where extension consumers should provide settings in a matching schema. + HandlerSchema *string `json:"handlerSchema,omitempty"` + + // REQUIRED; The operating system this extension supports. + OperatingSystem *string `json:"operatingSystem,omitempty"` + + // Whether the handler can support multiple extensions. + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` + + // Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on scalesets, but there + // might be cases where a publisher wants to explicitly indicate the extension is + // only enabled for CRP VMs but not VMSS. + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` +} + +// VirtualMachineExtensionImagesClientGetOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.Get +// method. +type VirtualMachineExtensionImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineExtensionImagesClientListTypesOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListTypes +// method. +type VirtualMachineExtensionImagesClientListTypesOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineExtensionImagesClientListVersionsOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListVersions +// method. +type VirtualMachineExtensionImagesClientListVersionsOptions struct { + // The filter to apply on the operation. + Filter *string + Orderby *string + Top *int32 +} + +// VirtualMachineExtensionInstanceView - The instance view of a virtual machine extension. +type VirtualMachineExtensionInstanceView struct { + // The virtual machine extension name. + Name *string `json:"name,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // The resource status information. + Substatuses []*InstanceViewStatus `json:"substatuses,omitempty"` + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + + // Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} + +// VirtualMachineExtensionProperties - Describes the properties of a Virtual Machine Extension. +type VirtualMachineExtensionProperties struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + + // The virtual machine extension instance view. + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + + // The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + + // Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting + // to the VM will not be suppressed regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + + // Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualMachineExtensionUpdate - Describes a Virtual Machine Extension. +type VirtualMachineExtensionUpdate struct { + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineExtensionUpdateProperties - Describes the properties of a Virtual Machine Extension. +type VirtualMachineExtensionUpdateProperties struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + + // The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + + // Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting + // to the VM will not be suppressed regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + + // Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} + +// VirtualMachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginCreateOrUpdate +// method. +type VirtualMachineExtensionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginDelete +// method. +type VirtualMachineExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginUpdate +// method. +type VirtualMachineExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineExtensionsClientGetOptions contains the optional parameters for the VirtualMachineExtensionsClient.Get method. +type VirtualMachineExtensionsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineExtensionsClientListOptions contains the optional parameters for the VirtualMachineExtensionsClient.List +// method. +type VirtualMachineExtensionsClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineExtensionsListResult - The List Extension operation response +type VirtualMachineExtensionsListResult struct { + // The list of extensions + Value []*VirtualMachineExtension `json:"value,omitempty"` +} + +// VirtualMachineHealthStatus - The health status of the VM. +type VirtualMachineHealthStatus struct { + // READ-ONLY; The health status information for the VM. + Status *InstanceViewStatus `json:"status,omitempty" azure:"ro"` +} + +// VirtualMachineIPTag - Contains the IP tag associated with the public IP address. +type VirtualMachineIPTag struct { + // IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + + // IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string `json:"tag,omitempty"` +} + +// VirtualMachineIdentity - Identity for the virtual machine. +type VirtualMachineIdentity struct { + // The type of identity used for the virtual machine. 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 virtual machine. + Type *ResourceIdentityType `json:"type,omitempty"` + + // The list of user identities associated with the Virtual Machine. 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]*UserAssignedIdentitiesValue `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The principal id of virtual machine identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant id associated with the virtual machine. This property will only be provided for a system assigned + // identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// VirtualMachineImage - Describes a Virtual Machine Image. +type VirtualMachineImage struct { + // REQUIRED; The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + + // REQUIRED; The name of the resource. + Name *string `json:"name,omitempty"` + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Describes the properties of a Virtual Machine Image. + Properties *VirtualMachineImageProperties `json:"properties,omitempty"` + + // Specifies the tags that are assigned to the virtual machine. For more information about using tags, see Using tags to organize + // your Azure resources + // [https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md]. + Tags map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineImageFeature - Specifies additional capabilities supported by the image +type VirtualMachineImageFeature struct { + // The name of the feature. + Name *string `json:"name,omitempty"` + + // The corresponding value for the feature. + Value *string `json:"value,omitempty"` +} + +// VirtualMachineImageProperties - Describes the properties of a Virtual Machine Image. +type VirtualMachineImageProperties struct { + // Specifies the Architecture Type + Architecture *ArchitectureTypes `json:"architecture,omitempty"` + + // Describes automatic OS upgrade properties on the image. + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties `json:"automaticOSUpgradeProperties,omitempty"` + DataDiskImages []*DataDiskImage `json:"dataDiskImages,omitempty"` + + // Specifies disallowed configuration for the VirtualMachine created from the image + Disallowed *DisallowedConfiguration `json:"disallowed,omitempty"` + Features []*VirtualMachineImageFeature `json:"features,omitempty"` + + // Specifies the HyperVGeneration Type + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + + // Contains the os disk image information. + OSDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + + // Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + Plan *PurchasePlan `json:"plan,omitempty"` +} + +// VirtualMachineImageResource - Virtual machine image resource information. +type VirtualMachineImageResource struct { + // REQUIRED; The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + + // REQUIRED; The name of the resource. + Name *string `json:"name,omitempty"` + + // The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Specifies the tags that are assigned to the virtual machine. For more information about using tags, see Using tags to organize + // your Azure resources + // [https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md]. + Tags map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineImagesClientGetOptions contains the optional parameters for the VirtualMachineImagesClient.Get method. +type VirtualMachineImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesClientListByEdgeZoneOptions contains the optional parameters for the VirtualMachineImagesClient.ListByEdgeZone +// method. +type VirtualMachineImagesClientListByEdgeZoneOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesClientListOffersOptions contains the optional parameters for the VirtualMachineImagesClient.ListOffers +// method. +type VirtualMachineImagesClientListOffersOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesClientListOptions contains the optional parameters for the VirtualMachineImagesClient.List method. +type VirtualMachineImagesClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string + Orderby *string + Top *int32 +} + +// VirtualMachineImagesClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesClient.ListPublishers +// method. +type VirtualMachineImagesClientListPublishersOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesClientListSKUsOptions contains the optional parameters for the VirtualMachineImagesClient.ListSKUs +// method. +type VirtualMachineImagesClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesEdgeZoneClientGetOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.Get +// method. +type VirtualMachineImagesEdgeZoneClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesEdgeZoneClientListOffersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListOffers +// method. +type VirtualMachineImagesEdgeZoneClientListOffersOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesEdgeZoneClientListOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.List +// method. +type VirtualMachineImagesEdgeZoneClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string + // Specifies the order of the results returned. Formatted as an OData query. + Orderby *string + // An integer value specifying the number of images to return that matches supplied values. + Top *int32 +} + +// VirtualMachineImagesEdgeZoneClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListPublishers +// method. +type VirtualMachineImagesEdgeZoneClientListPublishersOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineImagesEdgeZoneClientListSKUsOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListSKUs +// method. +type VirtualMachineImagesEdgeZoneClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineInstallPatchesParameters - Input for InstallPatches as directly received by the API +type VirtualMachineInstallPatchesParameters struct { + // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. + RebootSetting *VMGuestPatchRebootSetting `json:"rebootSetting,omitempty"` + + // Input for InstallPatches on a Linux VM, as directly received by the API + LinuxParameters *LinuxParameters `json:"linuxParameters,omitempty"` + + // Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such + // as PT4H (4 hours) + MaximumDuration *string `json:"maximumDuration,omitempty"` + + // Input for InstallPatches on a Windows VM, as directly received by the API + WindowsParameters *WindowsParameters `json:"windowsParameters,omitempty"` +} + +// VirtualMachineInstallPatchesResult - The result summary of an installation operation. +type VirtualMachineInstallPatchesResult struct { + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. + ExcludedPatchCount *int32 `json:"excludedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. + FailedPatchCount *int32 `json:"failedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + InstallationActivityID *string `json:"installationActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches successfully installed. + InstalledPatchCount *int32 `json:"installedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. + NotSelectedPatchCount *int32 `json:"notSelectedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The patches that were installed during the operation. + Patches []*PatchInstallationDetail `json:"patches,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that were identified as meeting the installation criteria, but were not able to be installed. + // Typically this happens when maintenanceWindowExceeded == true. + PendingPatchCount *int32 `json:"pendingPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The reboot state of the VM following completion of the operation. + RebootStatus *VMGuestPatchRebootStatus `json:"rebootStatus,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time `json:"startDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings." + Status *PatchOperationStatus `json:"status,omitempty" azure:"ro"` +} + +// VirtualMachineInstanceView - The instance view of a virtual machine. +type VirtualMachineInstanceView struct { + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. + // You can easily view the output of your console log. + // Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + + // The computer name assigned to the virtual machine. + ComputerName *string `json:"computerName,omitempty"` + + // The virtual machine disk information. + Disks []*DiskInstanceView `json:"disks,omitempty"` + + // The extensions information. + Extensions []*VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + + // Specifies the HyperVGeneration Type associated with a resource + HyperVGeneration *HyperVGenerationType `json:"hyperVGeneration,omitempty"` + + // The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + + // The Operating System running on the virtual machine. + OSName *string `json:"osName,omitempty"` + + // The version of Operating System running on the virtual machine. + OSVersion *string `json:"osVersion,omitempty"` + + // [Preview Feature] The status of virtual machine patch operations. + PatchStatus *VirtualMachinePatchStatus `json:"patchStatus,omitempty"` + + // Specifies the fault domain of the virtual machine. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + + // Specifies the update domain of the virtual machine. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + + // The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + + // READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when + // the virtual machine is associated with a dedicated host group that has automatic + // placement enabled. + // Minimum api-version: 2020-06-01. + AssignedHost *string `json:"assignedHost,omitempty" azure:"ro"` + + // READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty" azure:"ro"` +} + +// VirtualMachineListResult - The List Virtual Machine operation response. +type VirtualMachineListResult struct { + // REQUIRED; The list of virtual machines. + Value []*VirtualMachine `json:"value,omitempty"` + + // The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineNetworkInterfaceConfiguration - Describes a virtual machine network interface configurations. +type VirtualMachineNetworkInterfaceConfiguration struct { + // REQUIRED; The network interface configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machine network profile's IP configuration. + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineNetworkInterfaceConfigurationProperties - Describes a virtual machine network profile's IP configuration. +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + // REQUIRED; Specifies the IP configurations of the network interface. + IPConfigurations []*VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineNetworkInterfaceDNSSettingsConfiguration `json:"dnsSettings,omitempty"` + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool `json:"enableFpga,omitempty"` + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + + // The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` +} + +// VirtualMachineNetworkInterfaceDNSSettingsConfiguration - Describes a virtual machines network configuration's DNS settings. +type VirtualMachineNetworkInterfaceDNSSettingsConfiguration struct { + // List of DNS servers IP addresses + DNSServers []*string `json:"dnsServers,omitempty"` +} + +// VirtualMachineNetworkInterfaceIPConfiguration - Describes a virtual machine network profile's IP configuration. +type VirtualMachineNetworkInterfaceIPConfiguration struct { + // REQUIRED; The IP configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machine network interface IP configuration properties. + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineNetworkInterfaceIPConfigurationProperties - Describes a virtual machine network interface IP configuration +// properties. +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + // Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend + // address pools of multiple application gateways. Multiple virtual machines + // cannot use the same application gateway. + ApplicationGatewayBackendAddressPools []*SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource `json:"applicationSecurityGroups,omitempty"` + + // Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address + // pools of one public and one internal load balancer. [Multiple virtual + // machines cannot use the same basic sku load balancer]. + LoadBalancerBackendAddressPools []*SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + + // Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + + // Specifies the identifier of the subnet. + Subnet *SubResource `json:"subnet,omitempty"` +} + +// VirtualMachinePatchStatus - The status of virtual machine patch operations. +type VirtualMachinePatchStatus struct { + // The available patch summary of the latest assessment operation for the virtual machine. + AvailablePatchSummary *AvailablePatchSummary `json:"availablePatchSummary,omitempty"` + + // The installation summary of the latest installation operation for the virtual machine. + LastPatchInstallationSummary *LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` + + // READ-ONLY; The enablement status of the specified patchMode + ConfigurationStatuses []*InstanceViewStatus `json:"configurationStatuses,omitempty" azure:"ro"` +} + +// VirtualMachineProperties - Describes the properties of a Virtual Machine. +type VirtualMachineProperties struct { + // Specifies additional capabilities enabled or disabled on the virtual machine. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + + // Specifies the gallery applications that should be made available to the VM/VMSS + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + + // Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified + // in the same availability set are allocated to different nodes to maximize + // availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. + // For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] + // Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added + // should be under the same resource group as the availability set resource. An + // existing VM cannot be added to an availability set. + // This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + + // Specifies the billing related details of a Azure Spot virtual machine. + // Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + + // Specifies information about the capacity reservation that is used to allocate virtual machine. + // Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + + // Specifies the boot diagnostic settings state. + // Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + + // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. + // For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + // For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + + // Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes + // (inclusive) and should be specified in ISO 8601 format. The default value is 90 + // minutes (PT1H30M). + // Minimum api-version: 2020-06-01 + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + + // Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + + // Specifies information about the dedicated host that the virtual machine resides in. + // Minimum api-version: 2018-10-01. + Host *SubResource `json:"host,omitempty"` + + // Specifies information about the dedicated host group that the virtual machine resides in. + // Minimum api-version: 2020-06-01. + // NOTE: User cannot specify both host and hostGroup properties. + HostGroup *SubResource `json:"hostGroup,omitempty"` + + // Specifies that the image or disk that is being used was licensed on-premises. + // Possible values for Windows Server operating system are: + // WindowsClient + // WindowsServer + // Possible values for Linux Server operating system are: + // RHELBYOS (for RHEL) + // SLESBYOS (for SUSE) + // For more information, see Azure Hybrid Use Benefit for Windows Server [https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing] + // Azure Hybrid Use Benefit for Linux Server [https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux] + // Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + + // Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + + // Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed + // once VM is provisioned. + OSProfile *OSProfile `json:"osProfile,omitempty"` + + // Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine + // will by automatically assigned to a fault domain that best maintains + // balance across available fault domains. + // This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.The Virtual Machine Scale + // Set that is referenced, must have 'platformFaultDomainCount' > 1.This property + // cannot be updated once the Virtual Machine is created.Fault domain assignment can be viewed in the Virtual Machine Instance + // View. + // Minimum api‐version: 2020‐12‐01 + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + + // Specifies the priority for the virtual machine. + // Minimum api-version: 2019-03-01 + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + + // Specifies information about the proximity placement group that the virtual machine should be assigned to. + // Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + + // Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + + // UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. + // Minimum api-version: 2021-03-01 + UserData *string `json:"userData,omitempty"` + + // Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines + // specified in the same virtual machine scale set are allocated to different + // nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing + // VM cannot be added to a virtual machine scale set. + // This property cannot exist along with a non-null properties.availabilitySet reference. + // Minimum api‐version: 2019‐03‐01 + VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"` + + // READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the time at which the Virtual Machine resource was created. + // Minimum api-version: 2021-11-01. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS + // and can be read using platform BIOS commands. + VMID *string `json:"vmId,omitempty" azure:"ro"` +} + +// VirtualMachinePublicIPAddressConfiguration - Describes a virtual machines IP Configuration's PublicIPAddress configuration +type VirtualMachinePublicIPAddressConfiguration struct { + // REQUIRED; The publicIP address configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machines IP Configuration's PublicIPAddress configuration + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + + // Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + SKU *PublicIPAddressSKU `json:"sku,omitempty"` +} + +// VirtualMachinePublicIPAddressConfigurationProperties - Describes a virtual machines IP Configuration's PublicIPAddress +// configuration +type VirtualMachinePublicIPAddressConfigurationProperties struct { + // The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachinePublicIPAddressDNSSettingsConfiguration `json:"dnsSettings,omitempty"` + + // Specify what happens to the public IP address when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // The list of IP tags associated with the public IP address. + IPTags []*VirtualMachineIPTag `json:"ipTags,omitempty"` + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + + // Specify the public IP allocation type + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} + +// VirtualMachinePublicIPAddressDNSSettingsConfiguration - Describes a virtual machines network configuration's DNS settings. +type VirtualMachinePublicIPAddressDNSSettingsConfiguration struct { + // REQUIRED; The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label + // is the concatenation of the domain name label and vm network profile unique ID. + DomainNameLabel *string `json:"domainNameLabel,omitempty"` +} + +// VirtualMachineReimageParameters - Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be +// reimaged +type VirtualMachineReimageParameters struct { + // Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported + // for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineRunCommand - Describes a Virtual Machine run command. +type VirtualMachineRunCommand struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Describes the properties of a Virtual Machine run command. + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineRunCommandInstanceView - The instance view of a virtual machine run command. +type VirtualMachineRunCommandInstanceView struct { + // Script end time. + EndTime *time.Time `json:"endTime,omitempty"` + + // Script error stream. + Error *string `json:"error,omitempty"` + + // Communicate script configuration errors or execution messages. + ExecutionMessage *string `json:"executionMessage,omitempty"` + + // Script execution status. + ExecutionState *ExecutionState `json:"executionState,omitempty"` + + // Exit code returned from script execution. + ExitCode *int32 `json:"exitCode,omitempty"` + + // Script output stream. + Output *string `json:"output,omitempty"` + + // Script start time. + StartTime *time.Time `json:"startTime,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineRunCommandProperties - Describes the properties of a Virtual Machine run command. +type VirtualMachineRunCommandProperties struct { + // Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + AsyncExecution *bool `json:"asyncExecution,omitempty"` + + // Specifies the Azure storage blob where script error stream will be uploaded. + ErrorBlobURI *string `json:"errorBlobUri,omitempty"` + + // Specifies the Azure storage blob where script output stream will be uploaded. + OutputBlobURI *string `json:"outputBlobUri,omitempty"` + + // The parameters used by the script. + Parameters []*RunCommandInputParameter `json:"parameters,omitempty"` + + // The parameters used by the script. + ProtectedParameters []*RunCommandInputParameter `json:"protectedParameters,omitempty"` + + // Specifies the user account password on the VM when executing the run command. + RunAsPassword *string `json:"runAsPassword,omitempty"` + + // Specifies the user account on the VM when executing the run command. + RunAsUser *string `json:"runAsUser,omitempty"` + + // The source of the run command script. + Source *VirtualMachineRunCommandScriptSource `json:"source,omitempty"` + + // The timeout in seconds to execute the run command. + TimeoutInSeconds *int32 `json:"timeoutInSeconds,omitempty"` + + // READ-ONLY; The virtual machine run command instance view. + InstanceView *VirtualMachineRunCommandInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualMachineRunCommandScriptSource - Describes the script sources for run command. +type VirtualMachineRunCommandScriptSource struct { + // Specifies a commandId of predefined built-in script. + CommandID *string `json:"commandId,omitempty"` + + // Specifies the script content to be executed on the VM. + Script *string `json:"script,omitempty"` + + // Specifies the script download location. + ScriptURI *string `json:"scriptUri,omitempty"` +} + +// VirtualMachineRunCommandUpdate - Describes a Virtual Machine run command. +type VirtualMachineRunCommandUpdate struct { + // Describes the properties of a Virtual Machine run command. + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginCreateOrUpdate +// method. +type VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineRunCommandsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginDelete +// method. +type VirtualMachineRunCommandsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineRunCommandsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginUpdate +// method. +type VirtualMachineRunCommandsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineRunCommandsClientGetByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.GetByVirtualMachine +// method. +type VirtualMachineRunCommandsClientGetByVirtualMachineOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineRunCommandsClient.Get +// method. +type VirtualMachineRunCommandsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineRunCommandsClientListByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.ListByVirtualMachine +// method. +type VirtualMachineRunCommandsClientListByVirtualMachineOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.List +// method. +type VirtualMachineRunCommandsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineRunCommandsListResult - The List run command operation response +type VirtualMachineRunCommandsListResult struct { + // REQUIRED; The list of run commands + Value []*VirtualMachineRunCommand `json:"value,omitempty"` + + // The uri to fetch the next page of run commands. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSet - Describes a Virtual Machine Scale Set. +type VirtualMachineScaleSet struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The extended location of the Virtual Machine Scale Set. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + + // Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace + // images. Before you can use a marketplace image from an API, you must + // enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click + // Want to deploy programmatically, Get Started ->. Enter any required + // information and then click Save. + Plan *Plan `json:"plan,omitempty"` + + // Describes the properties of a Virtual Machine Scale Set. + Properties *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + + // The virtual machine scale set sku. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetDataDisk - Describes a virtual machine scale set data disk. +type VirtualMachineScaleSetDataDisk struct { + // REQUIRED; The create option. + CreateOption *DiskCreateOptionTypes `json:"createOption,omitempty"` + + // REQUIRED; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and + // therefore must be unique for each data disk attached to a VM. + Lun *int32 `json:"lun,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with + // Flexible OrchestrationMode only). + // Possible values: + // Delete If this value is used, the data disk is deleted when the VMSS Flex VM is deleted. + // Detach If this value is used, the data disk is retained after VMSS Flex VM is deleted. + // The default value is set to Delete. + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + + // Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not + // specified, a default value would be assigned based on diskSizeGB. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + + // Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. + // If not specified, a default value would be assigned based on diskSizeGB. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. + // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + + // The disk name. + Name *string `json:"name,omitempty"` + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} + +// VirtualMachineScaleSetExtension - Describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtension struct { + // The name of the extension. + Name *string `json:"name,omitempty"` + + // Describes the properties of a Virtual Machine Scale Set Extension. + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetExtensionListResult - The List VM scale set extension operation response. +type VirtualMachineScaleSetExtensionListResult struct { + // REQUIRED; The list of VM scale set extensions. + Value []*VirtualMachineScaleSetExtension `json:"value,omitempty"` + + // The uri to fetch the next page of VM scale set extensions. Call ListNext() with this to fetch the next page of VM scale + // set extensions. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetExtensionProfile - Describes a virtual machine scale set extension profile. +type VirtualMachineScaleSetExtensionProfile struct { + // The virtual machine scale set child extension resources. + Extensions []*VirtualMachineScaleSetExtension `json:"extensions,omitempty"` + + // Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes + // (inclusive) and should be specified in ISO 8601 format. The default value is 90 + // minutes (PT1H30M). + // Minimum api-version: 2020-06-01 + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` +} + +// VirtualMachineScaleSetExtensionProperties - Describes the properties of a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtensionProperties struct { + // Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + // however, the extension will not upgrade minor versions unless redeployed, even + // with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension + // available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + + // If a value is provided and is different from the previous value, the extension handler will be forced to update even if + // the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + + // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + + // The extensions protected settings that are passed by reference, and consumed from key vault + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + + // Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions []*string `json:"provisionAfterExtensions,omitempty"` + + // The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + + // Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting + // to the VM will not be suppressed regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + + // Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetExtensionUpdate - Describes a Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtensionUpdate struct { + // Describes the properties of a Virtual Machine Scale Set Extension. + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginCreateOrUpdate +// method. +type VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginDelete +// method. +type VirtualMachineScaleSetExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginUpdate +// method. +type VirtualMachineScaleSetExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetExtensionsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.Get +// method. +type VirtualMachineScaleSetExtensionsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineScaleSetExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.List +// method. +type VirtualMachineScaleSetExtensionsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetHardwareProfile - Specifies the hardware settings for the virtual machine scale set. +type VirtualMachineScaleSetHardwareProfile struct { + // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. + // Please follow the instructions in VM Customization [https://aka.ms/vmcustomization] for more details. + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} + +// VirtualMachineScaleSetIPConfiguration - Describes a virtual machine scale set network profile's IP configuration. +type VirtualMachineScaleSetIPConfiguration struct { + // REQUIRED; The IP configuration name. + Name *string `json:"name,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Describes a virtual machine scale set network profile's IP configuration properties. + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetIPConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration +// properties. +type VirtualMachineScaleSetIPConfigurationProperties struct { + // Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address + // pools of multiple application gateways. Multiple scale sets cannot use the + // same application gateway. + ApplicationGatewayBackendAddressPools []*SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource `json:"applicationSecurityGroups,omitempty"` + + // Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address + // pools of one public and one internal load balancer. Multiple scale sets cannot + // use the same basic sku load balancer. + LoadBalancerBackendAddressPools []*SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + + // Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools + // of one public and one internal load balancer. Multiple scale sets cannot use + // the same basic sku load balancer. + LoadBalancerInboundNatPools []*SubResource `json:"loadBalancerInboundNatPools,omitempty"` + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + + // Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + + // Specifies the identifier of the subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` +} + +// VirtualMachineScaleSetIPTag - Contains the IP tag associated with the public IP address. +type VirtualMachineScaleSetIPTag struct { + // IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + + // IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string `json:"tag,omitempty"` +} + +// VirtualMachineScaleSetIdentity - Identity for the virtual machine scale set. +type VirtualMachineScaleSetIdentity struct { + // The type of identity used for the virtual machine scale set. 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 virtual machine scale set. + Type *ResourceIdentityType `json:"type,omitempty"` + + // The list of user identities associated with the virtual machine scale set. 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]*UserAssignedIdentitiesValue `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The principal id of virtual machine scale set identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant id associated with the virtual machine scale set. This property will only be provided for a system + // assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetInstanceView - The instance view of a virtual machine scale set. +type VirtualMachineScaleSetInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // READ-ONLY; The extensions information. + Extensions []*VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty" azure:"ro"` + + // READ-ONLY; The orchestration services information. + OrchestrationServices []*OrchestrationServiceSummary `json:"orchestrationServices,omitempty" azure:"ro"` + + // READ-ONLY; The instance view status summary for the virtual machine scale set. + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetInstanceViewStatusesSummary - Instance view statuses summary for virtual machines of a virtual machine +// scale set. +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + // READ-ONLY; The extensions information. + StatusesSummary []*VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetListOSUpgradeHistory - List of Virtual Machine Scale Set OS Upgrade History operation response. +type VirtualMachineScaleSetListOSUpgradeHistory struct { + // REQUIRED; The list of OS upgrades performed on the virtual machine scale set. + Value []*UpgradeOperationHistoricalStatusInfo `json:"value,omitempty"` + + // The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to fetch the next page of history of upgrades. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListResult - The List Virtual Machine operation response. +type VirtualMachineScaleSetListResult struct { + // REQUIRED; The list of virtual machine scale sets. + Value []*VirtualMachineScaleSet `json:"value,omitempty"` + + // The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListSKUsResult - The Virtual Machine Scale Set List Skus operation response. +type VirtualMachineScaleSetListSKUsResult struct { + // REQUIRED; The list of skus available for the virtual machine scale set. + Value []*VirtualMachineScaleSetSKU `json:"value,omitempty"` + + // The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with this to fetch the next page of VMSS + // Skus. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListWithLinkResult - The List Virtual Machine operation response. +type VirtualMachineScaleSetListWithLinkResult struct { + // REQUIRED; The list of virtual machine scale sets. + Value []*VirtualMachineScaleSet `json:"value,omitempty"` + + // The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of Virtual + // Machine Scale Sets. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetManagedDiskParameters - Describes the parameters of a ScaleSet managed disk. +type VirtualMachineScaleSetManagedDiskParameters struct { + // Specifies the customer managed disk encryption set resource id for the managed disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + // Specifies the security profile for the managed disk. + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + + // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot + // be used with OS Disk. + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. +type VirtualMachineScaleSetNetworkConfiguration struct { + // REQUIRED; The network configuration name. + Name *string `json:"name,omitempty"` + + // Resource Id + ID *string `json:"id,omitempty"` + + // Describes a virtual machine scale set network profile's IP configuration. + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfigurationDNSSettings - Describes a virtual machines scale sets network configuration's +// DNS settings. +type VirtualMachineScaleSetNetworkConfigurationDNSSettings struct { + // List of DNS servers IP addresses + DNSServers []*string `json:"dnsServers,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration. +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + // REQUIRED; Specifies the IP configurations of the network interface. + IPConfigurations []*VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` + + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool `json:"enableFpga,omitempty"` + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + + // The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + + // Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` +} + +// VirtualMachineScaleSetNetworkProfile - Describes a virtual machine scale set network profile. +type VirtualMachineScaleSetNetworkProfile struct { + // A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The + // reference will be in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference `json:"healthProbe,omitempty"` + + // specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations + // for Virtual Machine Scale Set with orchestration mode 'Flexible' + NetworkAPIVersion *NetworkAPIVersion `json:"networkApiVersion,omitempty"` + + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetOSDisk - Describes a virtual machine scale set operating system disk. +type VirtualMachineScaleSetOSDisk struct { + // REQUIRED; Specifies how the virtual machines in the scale set should be created. + // The only allowed value is: FromImage \u2013 This value is used when you are using an image to create the virtual machine. + // If you are using a platform image, you also use the imageReference element + // described above. If you are using a marketplace image, you also use the plan element previously described. + CreateOption *DiskCreateOptionTypes `json:"createOption,omitempty"` + + // Specifies the caching requirements. + // Possible values are: + // None + // ReadOnly + // ReadWrite + // Default: None for Standard storage. ReadOnly for Premium storage + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with + // Flexible OrchestrationMode only). + // Possible values: + // Delete If this value is used, the OS disk is deleted when VMSS Flex VM is deleted. + // Detach If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + // The default value is set to Delete. For an Ephemeral OS Disk, the default value is set to Delete. User cannot change the + // delete option for Ephemeral OS Disk. + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + + // Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine scale set. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. + // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // Specifies information about the unmanaged user image to base the scale set on. + Image *VirtualHardDisk `json:"image,omitempty"` + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + + // The disk name. + Name *string `json:"name,omitempty"` + + // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + // a specialized VHD. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Specifies the container urls that are used to store operating system disks for the scale set. + VhdContainers []*string `json:"vhdContainers,omitempty"` + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} + +// VirtualMachineScaleSetOSProfile - Describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetOSProfile struct { + // Specifies the password of the administrator account. + // Minimum-length (Windows): 8 characters + // Minimum-length (Linux): 6 characters + // Max-length (Windows): 123 characters + // Max-length (Linux): 72 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!" + // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp] + // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension + // [https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection] + AdminPassword *string `json:"adminPassword,omitempty"` + + // Specifies the name of the administrator account. + // Windows-only 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 (Linux): 1 character + // Max-length (Linux): 64 characters + // Max-length (Windows): 20 characters + AdminUsername *string `json:"adminUsername,omitempty"` + + // Specifies whether extension operations should be allowed on the virtual machine scale set. + // This may only be set to False when no extensions are present on the virtual machine scale set. + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + + // Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to + // 15 characters long. + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + + // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved + // as a file on the Virtual Machine. The maximum length of the binary array is + // 65535 bytes. + // For using cloud-init for your VM, see Using cloud-init to customize a Linux VM during creation [https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init] + CustomData *string `json:"customData,omitempty"` + + // Specifies the Linux operating system settings on the virtual machine. + // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions [https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros]. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + + // Specifies set of certificates that should be installed onto the virtual machines in the scale set. To install certificates + // on a virtual machine it is recommended to use the Azure Key Vault virtual + // machine extension for Linux [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure + // Key Vault virtual machine extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + Secrets []*VaultSecretGroup `json:"secrets,omitempty"` + + // Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} + +// VirtualMachineScaleSetProperties - Describes the properties of a Virtual Machine Scale Set. +type VirtualMachineScaleSetProperties struct { + // Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: + // whether the Virtual Machines have the capability to support attaching + // managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + + // Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + + // When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This + // property will hence ensure that the extensions do not run on the extra + // overprovisioned VMs. + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + + // Specifies information about the dedicated host group that the virtual machine scale set resides in. + // Minimum api-version: 2020-06-01. + HostGroup *SubResource `json:"hostGroup,omitempty"` + + // Specifies the orchestration mode for the virtual machine scale set. + OrchestrationMode *OrchestrationMode `json:"orchestrationMode,omitempty"` + + // Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + + // Fault Domain count for each placement group. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + + // Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + + // Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. + // Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + + // When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup + // is true, it may be modified to false. However, if singlePlacementGroup + // is false, it may not be modified to true. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + + // Specifies the Spot Restore properties for the virtual machine scale set. + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + + // The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + + // The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + + // Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. zoneBalance property + // can only be set if the zones property of the scale set contains more than + // one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. + ZoneBalance *bool `json:"zoneBalance,omitempty"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the time at which the Virtual Machine Scale Set resource was created. + // Minimum api-version: 2021-11-01. + TimeCreated *time.Time `json:"timeCreated,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + UniqueID *string `json:"uniqueId,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetPublicIPAddressConfiguration - Describes a virtual machines scale set IP Configuration's PublicIPAddress +// configuration +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + // REQUIRED; The publicIP address configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + + // Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + SKU *PublicIPAddressSKU `json:"sku,omitempty"` +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings - Describes a virtual machines scale sets network configuration's +// DNS settings. +type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings struct { + // REQUIRED; The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels + // of the PublicIPAddress resources that will be created + DomainNameLabel *string `json:"domainNameLabel,omitempty"` +} + +// VirtualMachineScaleSetPublicIPAddressConfigurationProperties - Describes a virtual machines scale set IP Configuration's +// PublicIPAddress configuration +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + // The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` + + // Specify what happens to the public IP when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // The list of IP tags associated with the public IP address. + IPTags []*VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} + +// VirtualMachineScaleSetReimageParameters - Describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetReimageParameters struct { + // The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation + // being performed on all virtual machines in the virtual machine scale set. + InstanceIDs []*string `json:"instanceIds,omitempty"` + + // Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported + // for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginCancel +// method. +type VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginStartExtensionUpgrade +// method. +type VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginStartOSUpgrade +// method. +type VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.GetLatest +// method. +type VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetSKU - Describes an available virtual machine scale set sku. +type VirtualMachineScaleSetSKU struct { + // READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *VirtualMachineScaleSetSKUCapacity `json:"capacity,omitempty" azure:"ro"` + + // READ-ONLY; The type of resource the sku applies to. + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; The Sku. + SKU *SKU `json:"sku,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetSKUCapacity - Describes scaling information of a sku. +type VirtualMachineScaleSetSKUCapacity struct { + // READ-ONLY; The default capacity. + DefaultCapacity *int64 `json:"defaultCapacity,omitempty" azure:"ro"` + + // READ-ONLY; The maximum capacity that can be set. + Maximum *int64 `json:"maximum,omitempty" azure:"ro"` + + // READ-ONLY; The minimum capacity. + Minimum *int64 `json:"minimum,omitempty" azure:"ro"` + + // READ-ONLY; The scale type applicable to the sku. + ScaleType *VirtualMachineScaleSetSKUScaleType `json:"scaleType,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetStorageProfile - Describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetStorageProfile struct { + // Specifies the parameters that are used to add data disks to the virtual machines in the scale set. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + DataDisks []*VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *string `json:"diskControllerType,omitempty"` + + // Specifies information about the image to use. You can specify information about platform images, marketplace images, or + // virtual machine images. This element is required when you want to use a platform + // image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + + // Specifies information about the operating system disk used by the virtual machines in the scale set. + // For more information about disks, see About disks and VHDs for Azure virtual machines [https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview]. + OSDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` +} + +// VirtualMachineScaleSetUpdate - Describes a Virtual Machine Scale Set. +type VirtualMachineScaleSetUpdate struct { + // The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + + // The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + Plan *Plan `json:"plan,omitempty"` + + // Describes the properties of a Virtual Machine Scale Set. + Properties *VirtualMachineScaleSetUpdateProperties `json:"properties,omitempty"` + + // The virtual machine scale set sku. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineScaleSetUpdateIPConfiguration - Describes a virtual machine scale set network profile's IP configuration. +// NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual +// network +type VirtualMachineScaleSetUpdateIPConfiguration struct { + // Resource Id + ID *string `json:"id,omitempty"` + + // The IP configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machine scale set network profile's IP configuration properties. + Properties *VirtualMachineScaleSetUpdateIPConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetUpdateIPConfigurationProperties - Describes a virtual machine scale set network profile's IP configuration +// properties. +type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + // The application gateway backend address pools. + ApplicationGatewayBackendAddressPools []*SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + + // Specifies an array of references to application security group. + ApplicationSecurityGroups []*SubResource `json:"applicationSecurityGroups,omitempty"` + + // The load balancer backend address pools. + LoadBalancerBackendAddressPools []*SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + + // The load balancer inbound nat pools. + LoadBalancerInboundNatPools []*SubResource `json:"loadBalancerInboundNatPools,omitempty"` + + // Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. + Primary *bool `json:"primary,omitempty"` + + // Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default + // is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + + // The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + + // The subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` +} + +// VirtualMachineScaleSetUpdateNetworkConfiguration - Describes a virtual machine scale set network profile's network configurations. +type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + // Resource Id + ID *string `json:"id,omitempty"` + + // The network configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machine scale set updatable network profile's IP configuration.Use this object for updating network + // profile's IP Configuration. + Properties *VirtualMachineScaleSetUpdateNetworkConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetUpdateNetworkConfigurationProperties - Describes a virtual machine scale set updatable network profile's +// IP configuration.Use this object for updating network profile's IP Configuration. +type VirtualMachineScaleSetUpdateNetworkConfigurationProperties struct { + // The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + + // Specify what happens to the network interface when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // Specifies whether the network interface is disabled for tcp state tracking. + DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + + // Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + + // Specifies whether the network interface is FPGA networking-enabled. + EnableFpga *bool `json:"enableFpga,omitempty"` + + // Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + + // The virtual machine scale set IP Configuration. + IPConfigurations []*VirtualMachineScaleSetUpdateIPConfiguration `json:"ipConfigurations,omitempty"` + + // The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + + // Whether this is a primary NIC on a virtual machine. + Primary *bool `json:"primary,omitempty"` +} + +// VirtualMachineScaleSetUpdateNetworkProfile - Describes a virtual machine scale set network profile. +type VirtualMachineScaleSetUpdateNetworkProfile struct { + // A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The + // reference will be in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference `json:"healthProbe,omitempty"` + + // specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations + // for Virtual Machine Scale Set with orchestration mode 'Flexible' + NetworkAPIVersion *NetworkAPIVersion `json:"networkApiVersion,omitempty"` + + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetUpdateNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetUpdateOSDisk - Describes virtual machine scale set operating system disk Update Object. This should +// be used for Updating VMSS OS Disk. +type VirtualMachineScaleSetUpdateOSDisk struct { + // The caching type. + Caching *CachingTypes `json:"caching,omitempty"` + + // Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with + // Flexible OrchestrationMode only). + // Possible values: + // Delete If this value is used, the OS disk is deleted when VMSS Flex VM is deleted. + // Detach If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + // The default value is set to Delete. For an Ephemeral OS Disk, the default value is set to Delete. User cannot change the + // delete option for Ephemeral OS Disk. + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + + // Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a + // virtual machine image. + // diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023 + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + + // The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. + // If SourceImage is provided, the destination VirtualHardDisk should not + // exist. + Image *VirtualHardDisk `json:"image,omitempty"` + + // The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + + // The list of virtual hard disk container uris. + VhdContainers []*string `json:"vhdContainers,omitempty"` + + // Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} + +// VirtualMachineScaleSetUpdateOSProfile - Describes a virtual machine scale set OS profile. +type VirtualMachineScaleSetUpdateOSProfile struct { + // A base-64 encoded string of custom data. + CustomData *string `json:"customData,omitempty"` + + // The Linux Configuration of the OS profile. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + + // The List of certificates for addition to the VM. + Secrets []*VaultSecretGroup `json:"secrets,omitempty"` + + // The Windows Configuration of the OS profile. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} + +// VirtualMachineScaleSetUpdateProperties - Describes the properties of a Virtual Machine Scale Set. +type VirtualMachineScaleSetUpdateProperties struct { + // Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: + // whether the Virtual Machines have the capability to support attaching + // managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + + // Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + + // When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This + // property will hence ensure that the extensions do not run on the extra + // overprovisioned VMs. + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + + // Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + + // Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. + // Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + + // When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup + // is true, it may be modified to false. However, if singlePlacementGroup + // is false, it may not be modified to true. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + + // The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + + // The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile `json:"virtualMachineProfile,omitempty"` +} + +// VirtualMachineScaleSetUpdatePublicIPAddressConfiguration - Describes a virtual machines scale set IP Configuration's PublicIPAddress +// configuration +type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + // The publicIP address configuration name. + Name *string `json:"name,omitempty"` + + // Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration + Properties *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties - Describes a virtual machines scale set IP Configuration's +// PublicIPAddress configuration +type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties struct { + // The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` + + // Specify what happens to the public IP when the VM is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} + +// VirtualMachineScaleSetUpdateStorageProfile - Describes a virtual machine scale set storage profile. +type VirtualMachineScaleSetUpdateStorageProfile struct { + // The data disks. + DataDisks []*VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *string `json:"diskControllerType,omitempty"` + + // The image reference. + ImageReference *ImageReference `json:"imageReference,omitempty"` + + // The OS disk. + OSDisk *VirtualMachineScaleSetUpdateOSDisk `json:"osDisk,omitempty"` +} + +// VirtualMachineScaleSetUpdateVMProfile - Describes a virtual machine scale set virtual machine profile. +type VirtualMachineScaleSetUpdateVMProfile struct { + // Specifies the billing related details of a Azure Spot VMSS. + // Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + + // The virtual machine scale set diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + + // The virtual machine scale set extension profile. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + + // Specifies the hardware profile related details of a scale set. + // Minimum api-version: 2021-11-01. + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + + // The license type, which is for bring your own license scenario. + LicenseType *string `json:"licenseType,omitempty"` + + // The virtual machine scale set network profile. + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile `json:"networkProfile,omitempty"` + + // The virtual machine scale set OS profile. + OSProfile *VirtualMachineScaleSetUpdateOSProfile `json:"osProfile,omitempty"` + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + + // The virtual machine scale set Security profile + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + + // The virtual machine scale set storage profile. + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile `json:"storageProfile,omitempty"` + + // UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. + // Minimum api-version: 2021-03-01 + UserData *string `json:"userData,omitempty"` +} + +// VirtualMachineScaleSetVM - Describes a virtual machine scale set virtual machine. +type VirtualMachineScaleSetVM struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + + // Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace + // images. Before you can use a marketplace image from an API, you must + // enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click + // Want to deploy programmatically, Get Started ->. Enter any required + // information and then click Save. + Plan *Plan `json:"plan,omitempty"` + + // Describes the properties of a virtual machine scale set virtual machine. + Properties *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The virtual machine instance ID. + InstanceID *string `json:"instanceId,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The virtual machine child extension resources. + Resources []*VirtualMachineExtension `json:"resources,omitempty" azure:"ro"` + + // READ-ONLY; The virtual machine SKU. + SKU *SKU `json:"sku,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; The virtual machine zones. + Zones []*string `json:"zones,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMExtension - Describes a VMSS VM Extension. +type VirtualMachineScaleSetVMExtension struct { + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMExtensionUpdate - Describes a VMSS VM Extension. +type VirtualMachineScaleSetVMExtensionUpdate struct { + // Describes the properties of a Virtual Machine Extension. + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginCreateOrUpdate +// method. +type VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginDelete +// method. +type VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginUpdate +// method. +type VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMExtensionsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.Get +// method. +type VirtualMachineScaleSetVMExtensionsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineScaleSetVMExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.List +// method. +type VirtualMachineScaleSetVMExtensionsClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineScaleSetVMExtensionsListResult - The List VMSS VM Extension operation response +type VirtualMachineScaleSetVMExtensionsListResult struct { + // The list of VMSS VM extensions + Value []*VirtualMachineScaleSetVMExtension `json:"value,omitempty"` +} + +// VirtualMachineScaleSetVMExtensionsSummary - Extensions summary for virtual machines of a virtual machine scale set. +type VirtualMachineScaleSetVMExtensionsSummary struct { + // READ-ONLY; The extension name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The extensions information. + StatusesSummary []*VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMInstanceIDs - Specifies a list of virtual machine instance IDs from the VM scale set. +type VirtualMachineScaleSetVMInstanceIDs struct { + // The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation + // being performed on all virtual machines in the virtual machine scale set. + InstanceIDs []*string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceRequiredIDs - Specifies a list of virtual machine instance IDs from the VM scale set. +type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + // REQUIRED; The virtual machine scale set instance ids. + InstanceIDs []*string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceView - The instance view of a virtual machine scale set VM. +type VirtualMachineScaleSetVMInstanceView struct { + // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. + // You can easily view the output of your console log. + // Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + + // The disks information. + Disks []*DiskInstanceView `json:"disks,omitempty"` + + // The extensions information. + Extensions []*VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + + // The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + + // The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId. + PlacementGroupID *string `json:"placementGroupId,omitempty"` + + // The Fault Domain count. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + + // The Update Domain count. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + + // The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + + // READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when + // the virtual machine is associated with a dedicated host group that has automatic + // placement enabled. + // Minimum api-version: 2020-06-01. + AssignedHost *string `json:"assignedHost,omitempty" azure:"ro"` + + // READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMListResult - The List Virtual Machine Scale Set VMs operation response. +type VirtualMachineScaleSetVMListResult struct { + // REQUIRED; The list of virtual machine scale sets VMs. + Value []*VirtualMachineScaleSetVM `json:"value,omitempty"` + + // The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS + // VMs + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetVMNetworkProfileConfiguration - Describes a virtual machine scale set VM network profile. +type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + // The list of network configurations. + NetworkInterfaceConfigurations []*VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetVMProfile - Describes a virtual machine scale set virtual machine profile. +type VirtualMachineScaleSetVMProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + + // Specifies the billing related details of a Azure Spot VMSS. + // Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + + // Specifies the capacity reservation related details of a scale set. + // Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + + // Specifies the boot diagnostic settings state. + // Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + + // Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. + // For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + // For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + + // Specifies a collection of settings for extensions installed on virtual machines in the scale set. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + + // Specifies the hardware profile related details of a scale set. + // Minimum api-version: 2021-11-01. + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + + // Specifies that the image or disk that is being used was licensed on-premises. + // Possible values for Windows Server operating system are: + // WindowsClient + // WindowsServer + // Possible values for Linux Server operating system are: + // RHELBYOS (for RHEL) + // SLESBYOS (for SUSE) + // For more information, see Azure Hybrid Use Benefit for Windows Server [https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing] + // Azure Hybrid Use Benefit for Linux Server [https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux] + // Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + + // Specifies properties of the network interfaces of the virtual machines in the scale set. + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + + // Specifies the operating system settings for the virtual machines in the scale set. + OSProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + + // Specifies the priority for the virtual machines in the scale set. + // Minimum api-version: 2017-10-30-preview + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + + // Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + + // Specifies the Security related profile settings for the virtual machines in the scale set. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + + // UserData for the virtual machines in the scale set, which must be base-64 encoded. Customer should not pass any secrets + // in here. + // Minimum api-version: 2021-03-01 + UserData *string `json:"userData,omitempty"` +} + +// VirtualMachineScaleSetVMProperties - Describes the properties of a virtual machine scale set virtual machine. +type VirtualMachineScaleSetVMProperties struct { + // Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For instance: whether the + // virtual machine has the capability to support attaching managed data disks with + // UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + + // Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified + // in the same availability set are allocated to different nodes to maximize + // availability. For more information about availability sets, see Availability sets overview [https://docs.microsoft.com/azure/virtual-machines/availability-set-overview]. + // For more information on Azure planned maintenance, see Maintenance and updates for Virtual Machines in Azure [https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates] + // Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability + // set. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + + // Specifies the boot diagnostic settings state. + // Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + + // Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + + // Specifies that the image or disk that is being used was licensed on-premises. + // Possible values for Windows Server operating system are: + // WindowsClient + // WindowsServer + // Possible values for Linux Server operating system are: + // RHELBYOS (for RHEL) + // SLESBYOS (for SUSE) + // For more information, see Azure Hybrid Use Benefit for Windows Server [https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing] + // Azure Hybrid Use Benefit for Linux Server [https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux] + // Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + + // Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + + // Specifies the network profile configuration of the virtual machine. + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration `json:"networkProfileConfiguration,omitempty"` + + // Specifies the operating system settings for the virtual machine. + OSProfile *OSProfile `json:"osProfile,omitempty"` + + // Specifies the protection policy of the virtual machine. + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy `json:"protectionPolicy,omitempty"` + + // Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + + // Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + + // UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. + // Minimum api-version: 2021-03-01 + UserData *string `json:"userData,omitempty"` + + // READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. + LatestModelApplied *bool `json:"latestModelApplied,omitempty" azure:"ro"` + + // READ-ONLY; Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or + // the customized model for the virtual machine. + ModelDefinitionApplied *string `json:"modelDefinitionApplied,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Azure VM unique ID. + VMID *string `json:"vmId,omitempty" azure:"ro"` +} + +// VirtualMachineScaleSetVMProtectionPolicy - The protection policy of a virtual machine scale set VM. +type VirtualMachineScaleSetVMProtectionPolicy struct { + // Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation. + ProtectFromScaleIn *bool `json:"protectFromScaleIn,omitempty"` + + // Indicates that model updates or actions (including scale-in) initiated on the virtual machine scale set should not be applied + // to the virtual machine scale set VM. + ProtectFromScaleSetActions *bool `json:"protectFromScaleSetActions,omitempty"` +} + +// VirtualMachineScaleSetVMReimageParameters - Describes a Virtual Machine Scale Set VM Reimage Parameters. +type VirtualMachineScaleSetVMReimageParameters struct { + // Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported + // for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` +} + +// VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate +// method. +type VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.BeginDelete +// method. +type VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.BeginUpdate +// method. +type VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.Get +// method. +type VirtualMachineScaleSetVMRunCommandsClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineScaleSetVMRunCommandsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.List +// method. +type VirtualMachineScaleSetVMRunCommandsClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// VirtualMachineScaleSetVMsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginDeallocate +// method. +type VirtualMachineScaleSetVMsClientBeginDeallocateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginDelete +// method. +type VirtualMachineScaleSetVMsClientBeginDeleteOptions struct { + // Optional parameter to force delete a virtual machine from a VM scale set. (Feature in Preview) + ForceDeletion *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginPerformMaintenance +// method. +type VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginPowerOff +// method. +type VirtualMachineScaleSetVMsClientBeginPowerOffOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false + // indicates otherwise. Default value for this flag is false if not specified + SkipShutdown *bool +} + +// VirtualMachineScaleSetVMsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRedeploy +// method. +type VirtualMachineScaleSetVMsClientBeginRedeployOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginReimageAll +// method. +type VirtualMachineScaleSetVMsClientBeginReimageAllOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginReimage +// method. +type VirtualMachineScaleSetVMsClientBeginReimageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // Parameters for the Reimaging Virtual machine in ScaleSet. + VMScaleSetVMReimageInput *VirtualMachineScaleSetVMReimageParameters +} + +// VirtualMachineScaleSetVMsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRestart +// method. +type VirtualMachineScaleSetVMsClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginRunCommandOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRunCommand +// method. +type VirtualMachineScaleSetVMsClientBeginRunCommandOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginStart +// method. +type VirtualMachineScaleSetVMsClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginUpdate +// method. +type VirtualMachineScaleSetVMsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetVMsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.GetInstanceView +// method. +type VirtualMachineScaleSetVMsClientGetInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetVMsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.Get +// method. +type VirtualMachineScaleSetVMsClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. + // 'UserData' will retrieve the UserData of the virtual machine. + Expand *InstanceViewTypes +} + +// VirtualMachineScaleSetVMsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.List +// method. +type VirtualMachineScaleSetVMsClientListOptions struct { + // The expand expression to apply to the operation. Allowed values are 'instanceView'. + Expand *string + // The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', + // 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq + // false'. + Filter *string + // The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + Select *string +} + +// VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData +// method. +type VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions struct { + // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. + // NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. + SasURIExpirationTimeInMinutes *int32 +} + +// VirtualMachineScaleSetVMsClientSimulateEvictionOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.SimulateEviction +// method. +type VirtualMachineScaleSetVMsClientSimulateEvictionOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginCreateOrUpdate +// method. +type VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeallocate +// method. +type VirtualMachineScaleSetsClientBeginDeallocateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginDeleteInstancesOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeleteInstances +// method. +type VirtualMachineScaleSetsClientBeginDeleteInstancesOptions struct { + // Optional parameter to force delete virtual machines from the VM scale set. (Feature in Preview) + ForceDeletion *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDelete +// method. +type VirtualMachineScaleSetsClientBeginDeleteOptions struct { + // Optional parameter to force delete a VM scale set. (Feature in Preview) + ForceDeletion *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPerformMaintenance +// method. +type VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPowerOff +// method. +type VirtualMachineScaleSetsClientBeginPowerOffOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false + // indicates otherwise. Default value for this flag is false if not specified + SkipShutdown *bool + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRedeploy +// method. +type VirtualMachineScaleSetsClientBeginRedeployOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimageAll +// method. +type VirtualMachineScaleSetsClientBeginReimageAllOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimage +// method. +type VirtualMachineScaleSetsClientBeginReimageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // Parameters for Reimaging VM ScaleSet. + VMScaleSetReimageInput *VirtualMachineScaleSetReimageParameters +} + +// VirtualMachineScaleSetsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRestart +// method. +type VirtualMachineScaleSetsClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginSetOrchestrationServiceState +// method. +type VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginStart +// method. +type VirtualMachineScaleSetsClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // A list of virtual machine instance IDs from the VM scale set. + VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs +} + +// VirtualMachineScaleSetsClientBeginUpdateInstancesOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginUpdateInstances +// method. +type VirtualMachineScaleSetsClientBeginUpdateInstancesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginUpdate +// method. +type VirtualMachineScaleSetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup +// method. +type VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions contains the optional parameters +// for the VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk method. +type VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions struct { + // The placement group id for which the manual recovery walk is requested. + PlacementGroupID *string + // The zone in which the manual recovery walk is requested for cross zone virtual machine scale set + Zone *string +} + +// VirtualMachineScaleSetsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetInstanceView +// method. +type VirtualMachineScaleSetsClientGetInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetOSUpgradeHistory +// method. +type VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.Get method. +type VirtualMachineScaleSetsClientGetOptions struct { + // The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was + // provided by the user during the VM scale set Create/Update operation + Expand *ExpandTypesForGetVMScaleSets +} + +// VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListAll +// method. +type VirtualMachineScaleSetsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListByLocation +// method. +type VirtualMachineScaleSetsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.List method. +type VirtualMachineScaleSetsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineScaleSetsClientListSKUsOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListSKUs +// method. +type VirtualMachineScaleSetsClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineSize - Describes the properties of a VM size. +type VirtualMachineSize struct { + // The maximum number of data disks that can be attached to the virtual machine size. + MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` + + // The amount of memory, in MB, supported by the virtual machine size. + MemoryInMB *int32 `json:"memoryInMB,omitempty"` + + // The name of the virtual machine size. + Name *string `json:"name,omitempty"` + + // The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents + // the total vCPUs of quota that the VM uses. For accurate vCPU count, please + // refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + + // The OS disk size, in MB, allowed by the virtual machine size. + OSDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` + + // The resource disk size, in MB, allowed by the virtual machine size. + ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` +} + +// VirtualMachineSizeListResult - The List Virtual Machine operation response. +type VirtualMachineSizeListResult struct { + // The list of virtual machine sizes. + Value []*VirtualMachineSize `json:"value,omitempty"` +} + +// VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.List method. +type VirtualMachineSizesClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachineSoftwarePatchProperties - Describes the properties of a Virtual Machine software patch. +type VirtualMachineSoftwarePatchProperties struct { + // READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension + // logs. + ActivityID *string `json:"activityId,omitempty" azure:"ro"` + + // READ-ONLY; Describes the availability of a given patch. + AssessmentState *PatchAssessmentState `json:"assessmentState,omitempty" azure:"ro"` + + // READ-ONLY; The classification(s) of the patch as provided by the patch publisher. + Classifications []*string `json:"classifications,omitempty" azure:"ro"` + + // READ-ONLY; The KBID of the patch. Only applies to Windows patches. + KbID *string `json:"kbId,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp of the last update to this patch record. + LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The friendly name of the patch. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; A unique identifier for the patch. + PatchID *string `json:"patchId,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the repository published this patch. + PublishedDate *time.Time `json:"publishedDate,omitempty" azure:"ro"` + + // READ-ONLY; Describes the reboot requirements of the patch. + RebootBehavior *VMGuestPatchRebootBehavior `json:"rebootBehavior,omitempty" azure:"ro"` + + // READ-ONLY; The version number of the patch. This property applies only to Linux patches. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// VirtualMachineStatusCodeCount - The status code and count of the virtual machine scale set instance view status summary. +type VirtualMachineStatusCodeCount struct { + // READ-ONLY; The instance view status code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The number of instances having a particular status code. + Count *int32 `json:"count,omitempty" azure:"ro"` +} + +// VirtualMachineUpdate - Describes a Virtual Machine Update. +type VirtualMachineUpdate struct { + // The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + + // Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace + // images. Before you can use a marketplace image from an API, you must + // enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click + // Want to deploy programmatically, Get Started ->. Enter any required + // information and then click Save. + Plan *Plan `json:"plan,omitempty"` + + // Describes the properties of a Virtual Machine. + Properties *VirtualMachineProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // The virtual machine zones. + Zones []*string `json:"zones,omitempty"` +} + +// VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches +// method. +type VirtualMachinesClientBeginAssessPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginCaptureOptions contains the optional parameters for the VirtualMachinesClient.BeginCapture method. +type VirtualMachinesClientBeginCaptureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginConvertToManagedDisksOptions contains the optional parameters for the VirtualMachinesClient.BeginConvertToManagedDisks +// method. +type VirtualMachinesClientBeginConvertToManagedDisksOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate +// method. +type VirtualMachinesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginDeallocateOptions contains the optional parameters for the VirtualMachinesClient.BeginDeallocate +// method. +type VirtualMachinesClientBeginDeallocateOptions struct { + // Optional parameter to hibernate a virtual machine. (Feature in Preview) + Hibernate *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete method. +type VirtualMachinesClientBeginDeleteOptions struct { + // Optional parameter to force delete virtual machines. + ForceDeletion *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginInstallPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginInstallPatches +// method. +type VirtualMachinesClientBeginInstallPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachinesClient.BeginPerformMaintenance +// method. +type VirtualMachinesClientBeginPerformMaintenanceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginPowerOffOptions contains the optional parameters for the VirtualMachinesClient.BeginPowerOff +// method. +type VirtualMachinesClientBeginPowerOffOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false + // indicates otherwise. Default value for this flag is false if not specified + SkipShutdown *bool +} + +// VirtualMachinesClientBeginReapplyOptions contains the optional parameters for the VirtualMachinesClient.BeginReapply method. +type VirtualMachinesClientBeginReapplyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy +// method. +type VirtualMachinesClientBeginRedeployOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage method. +type VirtualMachinesClientBeginReimageOptions struct { + // Parameters supplied to the Reimage Virtual Machine operation. + Parameters *VirtualMachineReimageParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart method. +type VirtualMachinesClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginRunCommandOptions contains the optional parameters for the VirtualMachinesClient.BeginRunCommand +// method. +type VirtualMachinesClientBeginRunCommandOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart method. +type VirtualMachinesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate method. +type VirtualMachinesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientGeneralizeOptions contains the optional parameters for the VirtualMachinesClient.Generalize method. +type VirtualMachinesClientGeneralizeOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. +type VirtualMachinesClientGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual + // machine that is managed by the platform and can change outside of control + // plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user + // during the VM Create/Update operation. + Expand *InstanceViewTypes +} + +// VirtualMachinesClientInstanceViewOptions contains the optional parameters for the VirtualMachinesClient.InstanceView method. +type VirtualMachinesClientInstanceViewOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.ListAll method. +type VirtualMachinesClientListAllOptions struct { + // The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + Filter *string + // statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + StatusOnly *string +} + +// VirtualMachinesClientListAvailableSizesOptions contains the optional parameters for the VirtualMachinesClient.ListAvailableSizes +// method. +type VirtualMachinesClientListAvailableSizesOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.ListByLocation +// method. +type VirtualMachinesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.List method. +type VirtualMachinesClientListOptions struct { + // The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}' + Filter *string +} + +// VirtualMachinesClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachinesClient.RetrieveBootDiagnosticsData +// method. +type VirtualMachinesClientRetrieveBootDiagnosticsDataOptions struct { + // Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. + // NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. + SasURIExpirationTimeInMinutes *int32 +} + +// VirtualMachinesClientSimulateEvictionOptions contains the optional parameters for the VirtualMachinesClient.SimulateEviction +// method. +type VirtualMachinesClientSimulateEvictionOptions struct { + // placeholder for future optional parameters +} + +// WinRMConfiguration - Describes Windows Remote Management configuration of the VM +type WinRMConfiguration struct { + // The list of Windows Remote Management listeners + Listeners []*WinRMListener `json:"listeners,omitempty"` +} + +// WinRMListener - Describes Protocol and thumbprint of Windows Remote Management listener +type WinRMListener struct { + // This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, + // see Add a key or secret to the key vault + // [https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add]. In this case, your certificate needs to be It + // is the Base64 encoding of the following JSON Object which is encoded in UTF-8: + // { + // "data":"", + // "dataType":"pfx", + // "password":"" + // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for + // Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension + // for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. + CertificateURL *string `json:"certificateUrl,omitempty"` + + // Specifies the protocol of WinRM listener. + // Possible values are: + // http + // https + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} + +// WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. +type WindowsConfiguration struct { + // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is + // used by Windows Setup. + AdditionalUnattendContent []*AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + + // Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. + // For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + + // Indicates whether VMAgent Platform Updates is enabled for the Windows virtual machine. Default value is false. + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + + // [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + + // Indicates whether virtual machine agent should be provisioned on the virtual machine. + // When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM + // Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + + // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + // Possible values can be TimeZoneInfo.Id [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id] + // value from time zones returned by TimeZoneInfo.GetSystemTimeZones + // [https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones]. + TimeZone *string `json:"timeZone,omitempty"` + + // Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} + +// WindowsParameters - Input for InstallPatches on a Windows VM, as directly received by the API +type WindowsParameters struct { + // The update classifications to select when installing patches for Windows. + ClassificationsToInclude []*VMGuestPatchClassificationWindows `json:"classificationsToInclude,omitempty"` + + // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + ExcludeKbsRequiringReboot *bool `json:"excludeKbsRequiringReboot,omitempty"` + + // Kbs to exclude in the patch operation + KbNumbersToExclude []*string `json:"kbNumbersToExclude,omitempty"` + + // Kbs to include in the patch operation + KbNumbersToInclude []*string `json:"kbNumbersToInclude,omitempty"` + + // This is used to install patches that were published on or before this given max published date. + MaxPatchPublishDate *time.Time `json:"maxPatchPublishDate,omitempty"` +} + +// WindowsVMGuestPatchAutomaticByPlatformSettings - Specifies additional settings to be applied when patch mode AutomaticByPlatform +// is selected in Windows patch settings. +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + // Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models_serde.go new file mode 100644 index 000000000..15c6df11f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/models_serde.go @@ -0,0 +1,18634 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type APIEntityReference. +func (a APIEntityReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIEntityReference. +func (a *APIEntityReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIError. +func (a APIError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "details", a.Details) + populate(objectMap, "innererror", a.Innererror) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIError. +func (a *APIError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &a.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIErrorBase. +func (a APIErrorBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIErrorBase. +func (a *APIErrorBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessURI. +func (a AccessURI) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessSAS", a.AccessSAS) + populate(objectMap, "securityDataAccessSAS", a.SecurityDataAccessSAS) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessURI. +func (a *AccessURI) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessSAS": + err = unpopulate(val, "AccessSAS", &a.AccessSAS) + delete(rawMsg, key) + case "securityDataAccessSAS": + err = unpopulate(val, "SecurityDataAccessSAS", &a.SecurityDataAccessSAS) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdditionalCapabilities. +func (a AdditionalCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hibernationEnabled", a.HibernationEnabled) + populate(objectMap, "ultraSSDEnabled", a.UltraSSDEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalCapabilities. +func (a *AdditionalCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hibernationEnabled": + err = unpopulate(val, "HibernationEnabled", &a.HibernationEnabled) + delete(rawMsg, key) + case "ultraSSDEnabled": + err = unpopulate(val, "UltraSSDEnabled", &a.UltraSSDEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdditionalUnattendContent. +func (a AdditionalUnattendContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["componentName"] = "Microsoft-Windows-Shell-Setup" + populate(objectMap, "content", a.Content) + objectMap["passName"] = "OobeSystem" + populate(objectMap, "settingName", a.SettingName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalUnattendContent. +func (a *AdditionalUnattendContent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "componentName": + err = unpopulate(val, "ComponentName", &a.ComponentName) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "passName": + err = unpopulate(val, "PassName", &a.PassName) + delete(rawMsg, key) + case "settingName": + err = unpopulate(val, "SettingName", &a.SettingName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationProfile. +func (a ApplicationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "galleryApplications", a.GalleryApplications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProfile. +func (a *ApplicationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "galleryApplications": + err = unpopulate(val, "GalleryApplications", &a.GalleryApplications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomaticOSUpgradePolicy. +func (a AutomaticOSUpgradePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableAutomaticRollback", a.DisableAutomaticRollback) + populate(objectMap, "enableAutomaticOSUpgrade", a.EnableAutomaticOSUpgrade) + populate(objectMap, "useRollingUpgradePolicy", a.UseRollingUpgradePolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticOSUpgradePolicy. +func (a *AutomaticOSUpgradePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disableAutomaticRollback": + err = unpopulate(val, "DisableAutomaticRollback", &a.DisableAutomaticRollback) + delete(rawMsg, key) + case "enableAutomaticOSUpgrade": + err = unpopulate(val, "EnableAutomaticOSUpgrade", &a.EnableAutomaticOSUpgrade) + delete(rawMsg, key) + case "useRollingUpgradePolicy": + err = unpopulate(val, "UseRollingUpgradePolicy", &a.UseRollingUpgradePolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomaticOSUpgradeProperties. +func (a AutomaticOSUpgradeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "automaticOSUpgradeSupported", a.AutomaticOSUpgradeSupported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticOSUpgradeProperties. +func (a *AutomaticOSUpgradeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "automaticOSUpgradeSupported": + err = unpopulate(val, "AutomaticOSUpgradeSupported", &a.AutomaticOSUpgradeSupported) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomaticRepairsPolicy. +func (a AutomaticRepairsPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "gracePeriod", a.GracePeriod) + populate(objectMap, "repairAction", a.RepairAction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticRepairsPolicy. +func (a *AutomaticRepairsPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "gracePeriod": + err = unpopulate(val, "GracePeriod", &a.GracePeriod) + delete(rawMsg, key) + case "repairAction": + err = unpopulate(val, "RepairAction", &a.RepairAction) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilitySet. +func (a AvailabilitySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySet. +func (a *AvailabilitySet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilitySetListResult. +func (a AvailabilitySetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetListResult. +func (a *AvailabilitySetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilitySetProperties. +func (a AvailabilitySetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "platformFaultDomainCount", a.PlatformFaultDomainCount) + populate(objectMap, "platformUpdateDomainCount", a.PlatformUpdateDomainCount) + populate(objectMap, "proximityPlacementGroup", a.ProximityPlacementGroup) + populate(objectMap, "statuses", a.Statuses) + populate(objectMap, "virtualMachines", a.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetProperties. +func (a *AvailabilitySetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &a.PlatformFaultDomainCount) + delete(rawMsg, key) + case "platformUpdateDomainCount": + err = unpopulate(val, "PlatformUpdateDomainCount", &a.PlatformUpdateDomainCount) + delete(rawMsg, key) + case "proximityPlacementGroup": + err = unpopulate(val, "ProximityPlacementGroup", &a.ProximityPlacementGroup) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &a.Statuses) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &a.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilitySetUpdate. +func (a AvailabilitySetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetUpdate. +func (a *AvailabilitySetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailablePatchSummary. +func (a AvailablePatchSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentActivityId", a.AssessmentActivityID) + populate(objectMap, "criticalAndSecurityPatchCount", a.CriticalAndSecurityPatchCount) + populate(objectMap, "error", a.Error) + populateTimeRFC3339(objectMap, "lastModifiedTime", a.LastModifiedTime) + populate(objectMap, "otherPatchCount", a.OtherPatchCount) + populate(objectMap, "rebootPending", a.RebootPending) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchSummary. +func (a *AvailablePatchSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentActivityId": + err = unpopulate(val, "AssessmentActivityID", &a.AssessmentActivityID) + delete(rawMsg, key) + case "criticalAndSecurityPatchCount": + err = unpopulate(val, "CriticalAndSecurityPatchCount", &a.CriticalAndSecurityPatchCount) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &a.LastModifiedTime) + delete(rawMsg, key) + case "otherPatchCount": + err = unpopulate(val, "OtherPatchCount", &a.OtherPatchCount) + delete(rawMsg, key) + case "rebootPending": + err = unpopulate(val, "RebootPending", &a.RebootPending) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingProfile. +func (b BillingProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxPrice", b.MaxPrice) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingProfile. +func (b *BillingProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxPrice": + err = unpopulate(val, "MaxPrice", &b.MaxPrice) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BootDiagnostics. +func (b BootDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", b.Enabled) + populate(objectMap, "storageUri", b.StorageURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BootDiagnostics. +func (b *BootDiagnostics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &b.Enabled) + delete(rawMsg, key) + case "storageUri": + err = unpopulate(val, "StorageURI", &b.StorageURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BootDiagnosticsInstanceView. +func (b BootDiagnosticsInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consoleScreenshotBlobUri", b.ConsoleScreenshotBlobURI) + populate(objectMap, "serialConsoleLogBlobUri", b.SerialConsoleLogBlobURI) + populate(objectMap, "status", b.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BootDiagnosticsInstanceView. +func (b *BootDiagnosticsInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consoleScreenshotBlobUri": + err = unpopulate(val, "ConsoleScreenshotBlobURI", &b.ConsoleScreenshotBlobURI) + delete(rawMsg, key) + case "serialConsoleLogBlobUri": + err = unpopulate(val, "SerialConsoleLogBlobURI", &b.SerialConsoleLogBlobURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservation. +func (c CapacityReservation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservation. +func (c *CapacityReservation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroup. +func (c CapacityReservationGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroup. +func (c *CapacityReservationGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupInstanceView. +func (c CapacityReservationGroupInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityReservations", c.CapacityReservations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupInstanceView. +func (c *CapacityReservationGroupInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityReservations": + err = unpopulate(val, "CapacityReservations", &c.CapacityReservations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupListResult. +func (c CapacityReservationGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupListResult. +func (c *CapacityReservationGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupProperties. +func (c CapacityReservationGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityReservations", c.CapacityReservations) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "virtualMachinesAssociated", c.VirtualMachinesAssociated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupProperties. +func (c *CapacityReservationGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityReservations": + err = unpopulate(val, "CapacityReservations", &c.CapacityReservations) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &c.InstanceView) + delete(rawMsg, key) + case "virtualMachinesAssociated": + err = unpopulate(val, "VirtualMachinesAssociated", &c.VirtualMachinesAssociated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupUpdate. +func (c CapacityReservationGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationGroupUpdate. +func (c *CapacityReservationGroupUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceView. +func (c CapacityReservationInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "statuses", c.Statuses) + populate(objectMap, "utilizationInfo", c.UtilizationInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationInstanceView. +func (c *CapacityReservationInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "statuses": + err = unpopulate(val, "Statuses", &c.Statuses) + delete(rawMsg, key) + case "utilizationInfo": + err = unpopulate(val, "UtilizationInfo", &c.UtilizationInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceViewWithName. +func (c CapacityReservationInstanceViewWithName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "statuses", c.Statuses) + populate(objectMap, "utilizationInfo", c.UtilizationInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationInstanceViewWithName. +func (c *CapacityReservationInstanceViewWithName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &c.Statuses) + delete(rawMsg, key) + case "utilizationInfo": + err = unpopulate(val, "UtilizationInfo", &c.UtilizationInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationListResult. +func (c CapacityReservationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationListResult. +func (c *CapacityReservationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationProfile. +func (c CapacityReservationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityReservationGroup", c.CapacityReservationGroup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProfile. +func (c *CapacityReservationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityReservationGroup": + err = unpopulate(val, "CapacityReservationGroup", &c.CapacityReservationGroup) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationProperties. +func (c CapacityReservationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "platformFaultDomainCount", c.PlatformFaultDomainCount) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateTimeRFC3339(objectMap, "provisioningTime", c.ProvisioningTime) + populate(objectMap, "reservationId", c.ReservationID) + populateTimeRFC3339(objectMap, "timeCreated", c.TimeCreated) + populate(objectMap, "virtualMachinesAssociated", c.VirtualMachinesAssociated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProperties. +func (c *CapacityReservationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceView": + err = unpopulate(val, "InstanceView", &c.InstanceView) + delete(rawMsg, key) + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &c.PlatformFaultDomainCount) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "provisioningTime": + err = unpopulateTimeRFC3339(val, "ProvisioningTime", &c.ProvisioningTime) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &c.ReservationID) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &c.TimeCreated) + delete(rawMsg, key) + case "virtualMachinesAssociated": + err = unpopulate(val, "VirtualMachinesAssociated", &c.VirtualMachinesAssociated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationUpdate. +func (c CapacityReservationUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationUpdate. +func (c *CapacityReservationUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationUtilization. +func (c CapacityReservationUtilization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentCapacity", c.CurrentCapacity) + populate(objectMap, "virtualMachinesAllocated", c.VirtualMachinesAllocated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationUtilization. +func (c *CapacityReservationUtilization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentCapacity": + err = unpopulate(val, "CurrentCapacity", &c.CurrentCapacity) + delete(rawMsg, key) + case "virtualMachinesAllocated": + err = unpopulate(val, "VirtualMachinesAllocated", &c.VirtualMachinesAllocated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudService. +func (c CloudService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudService. +func (c *CloudService) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceExtensionProfile. +func (c CloudServiceExtensionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensions", c.Extensions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceExtensionProfile. +func (c *CloudServiceExtensionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &c.Extensions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceExtensionProperties. +func (c CloudServiceExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", c.AutoUpgradeMinorVersion) + populate(objectMap, "forceUpdateTag", c.ForceUpdateTag) + populate(objectMap, "protectedSettings", &c.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", c.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "rolesAppliedTo", c.RolesAppliedTo) + populate(objectMap, "settings", &c.Settings) + populate(objectMap, "type", c.Type) + populate(objectMap, "typeHandlerVersion", c.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceExtensionProperties. +func (c *CloudServiceExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &c.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &c.ForceUpdateTag) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &c.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &c.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &c.Publisher) + delete(rawMsg, key) + case "rolesAppliedTo": + err = unpopulate(val, "RolesAppliedTo", &c.RolesAppliedTo) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &c.Settings) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &c.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceInstanceView. +func (c CloudServiceInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIds", c.PrivateIDs) + populate(objectMap, "roleInstance", c.RoleInstance) + populate(objectMap, "sdkVersion", c.SdkVersion) + populate(objectMap, "statuses", c.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceInstanceView. +func (c *CloudServiceInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIds": + err = unpopulate(val, "PrivateIDs", &c.PrivateIDs) + delete(rawMsg, key) + case "roleInstance": + err = unpopulate(val, "RoleInstance", &c.RoleInstance) + delete(rawMsg, key) + case "sdkVersion": + err = unpopulate(val, "SdkVersion", &c.SdkVersion) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &c.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceListResult. +func (c CloudServiceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceListResult. +func (c *CloudServiceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceNetworkProfile. +func (c CloudServiceNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loadBalancerConfigurations", c.LoadBalancerConfigurations) + populate(objectMap, "slotType", c.SlotType) + populate(objectMap, "swappableCloudService", c.SwappableCloudService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceNetworkProfile. +func (c *CloudServiceNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "loadBalancerConfigurations": + err = unpopulate(val, "LoadBalancerConfigurations", &c.LoadBalancerConfigurations) + delete(rawMsg, key) + case "slotType": + err = unpopulate(val, "SlotType", &c.SlotType) + delete(rawMsg, key) + case "swappableCloudService": + err = unpopulate(val, "SwappableCloudService", &c.SwappableCloudService) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceOsProfile. +func (c CloudServiceOsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secrets", c.Secrets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceOsProfile. +func (c *CloudServiceOsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secrets": + err = unpopulate(val, "Secrets", &c.Secrets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceProperties. +func (c CloudServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowModelOverride", c.AllowModelOverride) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "configurationUrl", c.ConfigurationURL) + populate(objectMap, "extensionProfile", c.ExtensionProfile) + populate(objectMap, "networkProfile", c.NetworkProfile) + populate(objectMap, "osProfile", c.OSProfile) + populate(objectMap, "packageUrl", c.PackageURL) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "roleProfile", c.RoleProfile) + populate(objectMap, "startCloudService", c.StartCloudService) + populate(objectMap, "uniqueId", c.UniqueID) + populate(objectMap, "upgradeMode", c.UpgradeMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceProperties. +func (c *CloudServiceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowModelOverride": + err = unpopulate(val, "AllowModelOverride", &c.AllowModelOverride) + delete(rawMsg, key) + case "configuration": + err = unpopulate(val, "Configuration", &c.Configuration) + delete(rawMsg, key) + case "configurationUrl": + err = unpopulate(val, "ConfigurationURL", &c.ConfigurationURL) + delete(rawMsg, key) + case "extensionProfile": + err = unpopulate(val, "ExtensionProfile", &c.ExtensionProfile) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &c.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &c.OSProfile) + delete(rawMsg, key) + case "packageUrl": + err = unpopulate(val, "PackageURL", &c.PackageURL) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "roleProfile": + err = unpopulate(val, "RoleProfile", &c.RoleProfile) + delete(rawMsg, key) + case "startCloudService": + err = unpopulate(val, "StartCloudService", &c.StartCloudService) + delete(rawMsg, key) + case "uniqueId": + err = unpopulate(val, "UniqueID", &c.UniqueID) + delete(rawMsg, key) + case "upgradeMode": + err = unpopulate(val, "UpgradeMode", &c.UpgradeMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRole. +func (c CloudServiceRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRole. +func (c *CloudServiceRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleListResult. +func (c CloudServiceRoleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleListResult. +func (c *CloudServiceRoleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProfile. +func (c CloudServiceRoleProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "roles", c.Roles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProfile. +func (c *CloudServiceRoleProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roles": + err = unpopulate(val, "Roles", &c.Roles) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProfileProperties. +func (c CloudServiceRoleProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProfileProperties. +func (c *CloudServiceRoleProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleProperties. +func (c CloudServiceRoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "uniqueId", c.UniqueID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleProperties. +func (c *CloudServiceRoleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uniqueId": + err = unpopulate(val, "UniqueID", &c.UniqueID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceRoleSKU. +func (c CloudServiceRoleSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", c.Capacity) + populate(objectMap, "name", c.Name) + populate(objectMap, "tier", c.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceRoleSKU. +func (c *CloudServiceRoleSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &c.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &c.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceUpdate. +func (c CloudServiceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceUpdate. +func (c *CloudServiceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultAndSecretReference. +func (c CloudServiceVaultAndSecretReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretUrl", c.SecretURL) + populate(objectMap, "sourceVault", c.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultAndSecretReference. +func (c *CloudServiceVaultAndSecretReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretUrl": + err = unpopulate(val, "SecretURL", &c.SecretURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &c.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultCertificate. +func (c CloudServiceVaultCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateUrl", c.CertificateURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultCertificate. +func (c *CloudServiceVaultCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateUrl": + err = unpopulate(val, "CertificateURL", &c.CertificateURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudServiceVaultSecretGroup. +func (c CloudServiceVaultSecretGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceVault", c.SourceVault) + populate(objectMap, "vaultCertificates", c.VaultCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudServiceVaultSecretGroup. +func (c *CloudServiceVaultSecretGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sourceVault": + err = unpopulate(val, "SourceVault", &c.SourceVault) + delete(rawMsg, key) + case "vaultCertificates": + err = unpopulate(val, "VaultCertificates", &c.VaultCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGallery. +func (c CommunityGallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", c.Identifier) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGallery. +func (c *CommunityGallery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &c.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryIdentifier. +func (c CommunityGalleryIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "uniqueId", c.UniqueID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryIdentifier. +func (c *CommunityGalleryIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uniqueId": + err = unpopulate(val, "UniqueID", &c.UniqueID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImage. +func (c CommunityGalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", c.Identifier) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImage. +func (c *CommunityGalleryImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &c.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageList. +func (c CommunityGalleryImageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageList. +func (c *CommunityGalleryImageList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageProperties. +func (c CommunityGalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", c.Architecture) + populate(objectMap, "disallowed", c.Disallowed) + populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) + populate(objectMap, "eula", c.Eula) + populate(objectMap, "features", c.Features) + populate(objectMap, "hyperVGeneration", c.HyperVGeneration) + populate(objectMap, "identifier", c.Identifier) + populate(objectMap, "osState", c.OSState) + populate(objectMap, "osType", c.OSType) + populate(objectMap, "privacyStatementUri", c.PrivacyStatementURI) + populate(objectMap, "purchasePlan", c.PurchasePlan) + populate(objectMap, "recommended", c.Recommended) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageProperties. +func (c *CommunityGalleryImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &c.Architecture) + delete(rawMsg, key) + case "disallowed": + err = unpopulate(val, "Disallowed", &c.Disallowed) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &c.EndOfLifeDate) + delete(rawMsg, key) + case "eula": + err = unpopulate(val, "Eula", &c.Eula) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &c.Features) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &c.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &c.Identifier) + delete(rawMsg, key) + case "osState": + err = unpopulate(val, "OSState", &c.OSState) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &c.OSType) + delete(rawMsg, key) + case "privacyStatementUri": + err = unpopulate(val, "PrivacyStatementURI", &c.PrivacyStatementURI) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &c.PurchasePlan) + delete(rawMsg, key) + case "recommended": + err = unpopulate(val, "Recommended", &c.Recommended) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersion. +func (c CommunityGalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", c.Identifier) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersion. +func (c *CommunityGalleryImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &c.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionList. +func (c CommunityGalleryImageVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersionList. +func (c *CommunityGalleryImageVersionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionProperties. +func (c CommunityGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", c.ExcludeFromLatest) + populateTimeRFC3339(objectMap, "publishedDate", c.PublishedDate) + populate(objectMap, "storageProfile", c.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersionProperties. +func (c *CommunityGalleryImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &c.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &c.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &c.PublishedDate) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &c.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryInfo. +func (c CommunityGalleryInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityGalleryEnabled", c.CommunityGalleryEnabled) + populate(objectMap, "eula", c.Eula) + populate(objectMap, "publicNamePrefix", c.PublicNamePrefix) + populate(objectMap, "publicNames", c.PublicNames) + populate(objectMap, "publisherContact", c.PublisherContact) + populate(objectMap, "publisherUri", c.PublisherURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryInfo. +func (c *CommunityGalleryInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryEnabled": + err = unpopulate(val, "CommunityGalleryEnabled", &c.CommunityGalleryEnabled) + delete(rawMsg, key) + case "eula": + err = unpopulate(val, "Eula", &c.Eula) + delete(rawMsg, key) + case "publicNamePrefix": + err = unpopulate(val, "PublicNamePrefix", &c.PublicNamePrefix) + delete(rawMsg, key) + case "publicNames": + err = unpopulate(val, "PublicNames", &c.PublicNames) + delete(rawMsg, key) + case "publisherContact": + err = unpopulate(val, "PublisherContact", &c.PublisherContact) + delete(rawMsg, key) + case "publisherUri": + err = unpopulate(val, "PublisherURI", &c.PublisherURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CopyCompletionError. +func (c CopyCompletionError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorCode", c.ErrorCode) + populate(objectMap, "errorMessage", c.ErrorMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyCompletionError. +func (c *CopyCompletionError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCode": + err = unpopulate(val, "ErrorCode", &c.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreationData. +func (c CreationData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createOption", c.CreateOption) + populate(objectMap, "galleryImageReference", c.GalleryImageReference) + populate(objectMap, "imageReference", c.ImageReference) + populate(objectMap, "logicalSectorSize", c.LogicalSectorSize) + populate(objectMap, "performancePlus", c.PerformancePlus) + populate(objectMap, "securityDataUri", c.SecurityDataURI) + populate(objectMap, "sourceResourceId", c.SourceResourceID) + populate(objectMap, "sourceUri", c.SourceURI) + populate(objectMap, "sourceUniqueId", c.SourceUniqueID) + populate(objectMap, "storageAccountId", c.StorageAccountID) + populate(objectMap, "uploadSizeBytes", c.UploadSizeBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreationData. +func (c *CreationData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createOption": + err = unpopulate(val, "CreateOption", &c.CreateOption) + delete(rawMsg, key) + case "galleryImageReference": + err = unpopulate(val, "GalleryImageReference", &c.GalleryImageReference) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &c.ImageReference) + delete(rawMsg, key) + case "logicalSectorSize": + err = unpopulate(val, "LogicalSectorSize", &c.LogicalSectorSize) + delete(rawMsg, key) + case "performancePlus": + err = unpopulate(val, "PerformancePlus", &c.PerformancePlus) + delete(rawMsg, key) + case "securityDataUri": + err = unpopulate(val, "SecurityDataURI", &c.SecurityDataURI) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &c.SourceResourceID) + delete(rawMsg, key) + case "sourceUri": + err = unpopulate(val, "SourceURI", &c.SourceURI) + delete(rawMsg, key) + case "sourceUniqueId": + err = unpopulate(val, "SourceUniqueID", &c.SourceUniqueID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &c.StorageAccountID) + delete(rawMsg, key) + case "uploadSizeBytes": + err = unpopulate(val, "UploadSizeBytes", &c.UploadSizeBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataDisk. +func (d DataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", d.Caching) + populate(objectMap, "createOption", d.CreateOption) + populate(objectMap, "deleteOption", d.DeleteOption) + populate(objectMap, "detachOption", d.DetachOption) + populate(objectMap, "diskIOPSReadWrite", d.DiskIOPSReadWrite) + populate(objectMap, "diskMBpsReadWrite", d.DiskMBpsReadWrite) + populate(objectMap, "diskSizeGB", d.DiskSizeGB) + populate(objectMap, "image", d.Image) + populate(objectMap, "lun", d.Lun) + populate(objectMap, "managedDisk", d.ManagedDisk) + populate(objectMap, "name", d.Name) + populate(objectMap, "toBeDetached", d.ToBeDetached) + populate(objectMap, "vhd", d.Vhd) + populate(objectMap, "writeAcceleratorEnabled", d.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDisk. +func (d *DataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &d.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &d.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &d.DeleteOption) + delete(rawMsg, key) + case "detachOption": + err = unpopulate(val, "DetachOption", &d.DetachOption) + delete(rawMsg, key) + case "diskIOPSReadWrite": + err = unpopulate(val, "DiskIOPSReadWrite", &d.DiskIOPSReadWrite) + delete(rawMsg, key) + case "diskMBpsReadWrite": + err = unpopulate(val, "DiskMBpsReadWrite", &d.DiskMBpsReadWrite) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &d.Image) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &d.Lun) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &d.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "toBeDetached": + err = unpopulate(val, "ToBeDetached", &d.ToBeDetached) + delete(rawMsg, key) + case "vhd": + err = unpopulate(val, "Vhd", &d.Vhd) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &d.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataDiskImage. +func (d DataDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lun", d.Lun) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDiskImage. +func (d *DataDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lun": + err = unpopulate(val, "Lun", &d.Lun) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataDiskImageEncryption. +func (d DataDiskImageEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSetId", d.DiskEncryptionSetID) + populate(objectMap, "lun", d.Lun) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataDiskImageEncryption. +func (d *DataDiskImageEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSetId": + err = unpopulate(val, "DiskEncryptionSetID", &d.DiskEncryptionSetID) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &d.Lun) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHost. +func (d DedicatedHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHost. +func (d *DedicatedHost) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostAllocatableVM. +func (d DedicatedHostAllocatableVM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", d.Count) + populate(objectMap, "vmSize", d.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostAllocatableVM. +func (d *DedicatedHostAllocatableVM) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &d.Count) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &d.VMSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostAvailableCapacity. +func (d DedicatedHostAvailableCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocatableVMs", d.AllocatableVMs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostAvailableCapacity. +func (d *DedicatedHostAvailableCapacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatableVMs": + err = unpopulate(val, "AllocatableVMs", &d.AllocatableVMs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroup. +func (d DedicatedHostGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + populate(objectMap, "zones", d.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroup. +func (d *DedicatedHostGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &d.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupInstanceView. +func (d DedicatedHostGroupInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hosts", d.Hosts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupInstanceView. +func (d *DedicatedHostGroupInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hosts": + err = unpopulate(val, "Hosts", &d.Hosts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupListResult. +func (d DedicatedHostGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupListResult. +func (d *DedicatedHostGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupProperties. +func (d DedicatedHostGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalCapabilities", d.AdditionalCapabilities) + populate(objectMap, "hosts", d.Hosts) + populate(objectMap, "instanceView", d.InstanceView) + populate(objectMap, "platformFaultDomainCount", d.PlatformFaultDomainCount) + populate(objectMap, "supportAutomaticPlacement", d.SupportAutomaticPlacement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupProperties. +func (d *DedicatedHostGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCapabilities": + err = unpopulate(val, "AdditionalCapabilities", &d.AdditionalCapabilities) + delete(rawMsg, key) + case "hosts": + err = unpopulate(val, "Hosts", &d.Hosts) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &d.InstanceView) + delete(rawMsg, key) + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &d.PlatformFaultDomainCount) + delete(rawMsg, key) + case "supportAutomaticPlacement": + err = unpopulate(val, "SupportAutomaticPlacement", &d.SupportAutomaticPlacement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupPropertiesAdditionalCapabilities. +func (d DedicatedHostGroupPropertiesAdditionalCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ultraSSDEnabled", d.UltraSSDEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupPropertiesAdditionalCapabilities. +func (d *DedicatedHostGroupPropertiesAdditionalCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ultraSSDEnabled": + err = unpopulate(val, "UltraSSDEnabled", &d.UltraSSDEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostGroupUpdate. +func (d DedicatedHostGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "zones", d.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostGroupUpdate. +func (d *DedicatedHostGroupUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &d.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostInstanceView. +func (d DedicatedHostInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetId", d.AssetID) + populate(objectMap, "availableCapacity", d.AvailableCapacity) + populate(objectMap, "statuses", d.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostInstanceView. +func (d *DedicatedHostInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assetId": + err = unpopulate(val, "AssetID", &d.AssetID) + delete(rawMsg, key) + case "availableCapacity": + err = unpopulate(val, "AvailableCapacity", &d.AvailableCapacity) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &d.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostInstanceViewWithName. +func (d DedicatedHostInstanceViewWithName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetId", d.AssetID) + populate(objectMap, "availableCapacity", d.AvailableCapacity) + populate(objectMap, "name", d.Name) + populate(objectMap, "statuses", d.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostInstanceViewWithName. +func (d *DedicatedHostInstanceViewWithName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assetId": + err = unpopulate(val, "AssetID", &d.AssetID) + delete(rawMsg, key) + case "availableCapacity": + err = unpopulate(val, "AvailableCapacity", &d.AvailableCapacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &d.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostListResult. +func (d DedicatedHostListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostListResult. +func (d *DedicatedHostListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostProperties. +func (d DedicatedHostProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoReplaceOnFailure", d.AutoReplaceOnFailure) + populate(objectMap, "hostId", d.HostID) + populate(objectMap, "instanceView", d.InstanceView) + populate(objectMap, "licenseType", d.LicenseType) + populate(objectMap, "platformFaultDomain", d.PlatformFaultDomain) + populate(objectMap, "provisioningState", d.ProvisioningState) + populateTimeRFC3339(objectMap, "provisioningTime", d.ProvisioningTime) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "virtualMachines", d.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostProperties. +func (d *DedicatedHostProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoReplaceOnFailure": + err = unpopulate(val, "AutoReplaceOnFailure", &d.AutoReplaceOnFailure) + delete(rawMsg, key) + case "hostId": + err = unpopulate(val, "HostID", &d.HostID) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &d.InstanceView) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &d.LicenseType) + delete(rawMsg, key) + case "platformFaultDomain": + err = unpopulate(val, "PlatformFaultDomain", &d.PlatformFaultDomain) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "provisioningTime": + err = unpopulateTimeRFC3339(val, "ProvisioningTime", &d.ProvisioningTime) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &d.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DedicatedHostUpdate. +func (d DedicatedHostUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DedicatedHostUpdate. +func (d *DedicatedHostUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticsProfile. +func (d DiagnosticsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bootDiagnostics", d.BootDiagnostics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticsProfile. +func (d *DiagnosticsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bootDiagnostics": + err = unpopulate(val, "BootDiagnostics", &d.BootDiagnostics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiffDiskSettings. +func (d DiffDiskSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "option", d.Option) + populate(objectMap, "placement", d.Placement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiffDiskSettings. +func (d *DiffDiskSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "option": + err = unpopulate(val, "Option", &d.Option) + delete(rawMsg, key) + case "placement": + err = unpopulate(val, "Placement", &d.Placement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Disallowed. +func (d Disallowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskTypes", d.DiskTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Disallowed. +func (d *Disallowed) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskTypes": + err = unpopulate(val, "DiskTypes", &d.DiskTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DisallowedConfiguration. +func (d DisallowedConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmDiskType", d.VMDiskType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DisallowedConfiguration. +func (d *DisallowedConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmDiskType": + err = unpopulate(val, "VMDiskType", &d.VMDiskType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", d.ExtendedLocation) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "managedBy", d.ManagedBy) + populate(objectMap, "managedByExtended", d.ManagedByExtended) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + populate(objectMap, "zones", d.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. +func (d *Disk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &d.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "managedBy": + err = unpopulate(val, "ManagedBy", &d.ManagedBy) + delete(rawMsg, key) + case "managedByExtended": + err = unpopulate(val, "ManagedByExtended", &d.ManagedByExtended) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &d.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskAccess. +func (d DiskAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", d.ExtendedLocation) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccess. +func (d *DiskAccess) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &d.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskAccessList. +func (d DiskAccessList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessList. +func (d *DiskAccessList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskAccessProperties. +func (d DiskAccessProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessProperties. +func (d *DiskAccessProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskAccessUpdate. +func (d DiskAccessUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskAccessUpdate. +func (d *DiskAccessUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSet. +func (d DiskEncryptionSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSet. +func (d *DiskEncryptionSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetList. +func (d DiskEncryptionSetList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetList. +func (d *DiskEncryptionSetList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetParameters. +func (d DiskEncryptionSetParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetParameters. +func (d *DiskEncryptionSetParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetUpdate. +func (d DiskEncryptionSetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetUpdate. +func (d *DiskEncryptionSetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetUpdateProperties. +func (d DiskEncryptionSetUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeKey", d.ActiveKey) + populate(objectMap, "encryptionType", d.EncryptionType) + populate(objectMap, "federatedClientId", d.FederatedClientID) + populate(objectMap, "rotationToLatestKeyVersionEnabled", d.RotationToLatestKeyVersionEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSetUpdateProperties. +func (d *DiskEncryptionSetUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activeKey": + err = unpopulate(val, "ActiveKey", &d.ActiveKey) + delete(rawMsg, key) + case "encryptionType": + err = unpopulate(val, "EncryptionType", &d.EncryptionType) + delete(rawMsg, key) + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &d.FederatedClientID) + delete(rawMsg, key) + case "rotationToLatestKeyVersionEnabled": + err = unpopulate(val, "RotationToLatestKeyVersionEnabled", &d.RotationToLatestKeyVersionEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSettings. +func (d DiskEncryptionSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionKey", d.DiskEncryptionKey) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "keyEncryptionKey", d.KeyEncryptionKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionSettings. +func (d *DiskEncryptionSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionKey": + err = unpopulate(val, "DiskEncryptionKey", &d.DiskEncryptionKey) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "keyEncryptionKey": + err = unpopulate(val, "KeyEncryptionKey", &d.KeyEncryptionKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskImageEncryption. +func (d DiskImageEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSetId", d.DiskEncryptionSetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskImageEncryption. +func (d *DiskImageEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSetId": + err = unpopulate(val, "DiskEncryptionSetID", &d.DiskEncryptionSetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskInstanceView. +func (d DiskInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionSettings", d.EncryptionSettings) + populate(objectMap, "name", d.Name) + populate(objectMap, "statuses", d.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskInstanceView. +func (d *DiskInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryptionSettings": + err = unpopulate(val, "EncryptionSettings", &d.EncryptionSettings) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &d.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskList. +func (d DiskList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskList. +func (d *DiskList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskProperties. +func (d DiskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "burstingEnabled", d.BurstingEnabled) + populateTimeRFC3339(objectMap, "burstingEnabledTime", d.BurstingEnabledTime) + populate(objectMap, "completionPercent", d.CompletionPercent) + populate(objectMap, "creationData", d.CreationData) + populate(objectMap, "dataAccessAuthMode", d.DataAccessAuthMode) + populate(objectMap, "diskAccessId", d.DiskAccessID) + populate(objectMap, "diskIOPSReadOnly", d.DiskIOPSReadOnly) + populate(objectMap, "diskIOPSReadWrite", d.DiskIOPSReadWrite) + populate(objectMap, "diskMBpsReadOnly", d.DiskMBpsReadOnly) + populate(objectMap, "diskMBpsReadWrite", d.DiskMBpsReadWrite) + populate(objectMap, "diskSizeBytes", d.DiskSizeBytes) + populate(objectMap, "diskSizeGB", d.DiskSizeGB) + populate(objectMap, "diskState", d.DiskState) + populate(objectMap, "encryption", d.Encryption) + populate(objectMap, "encryptionSettingsCollection", d.EncryptionSettingsCollection) + populate(objectMap, "hyperVGeneration", d.HyperVGeneration) + populate(objectMap, "maxShares", d.MaxShares) + populate(objectMap, "networkAccessPolicy", d.NetworkAccessPolicy) + populate(objectMap, "osType", d.OSType) + populate(objectMap, "optimizedForFrequentAttach", d.OptimizedForFrequentAttach) + populate(objectMap, "propertyUpdatesInProgress", d.PropertyUpdatesInProgress) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "purchasePlan", d.PurchasePlan) + populate(objectMap, "securityProfile", d.SecurityProfile) + populate(objectMap, "shareInfo", d.ShareInfo) + populate(objectMap, "supportedCapabilities", d.SupportedCapabilities) + populate(objectMap, "supportsHibernation", d.SupportsHibernation) + populate(objectMap, "tier", d.Tier) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "uniqueId", d.UniqueID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskProperties. +func (d *DiskProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "burstingEnabled": + err = unpopulate(val, "BurstingEnabled", &d.BurstingEnabled) + delete(rawMsg, key) + case "burstingEnabledTime": + err = unpopulateTimeRFC3339(val, "BurstingEnabledTime", &d.BurstingEnabledTime) + delete(rawMsg, key) + case "completionPercent": + err = unpopulate(val, "CompletionPercent", &d.CompletionPercent) + delete(rawMsg, key) + case "creationData": + err = unpopulate(val, "CreationData", &d.CreationData) + delete(rawMsg, key) + case "dataAccessAuthMode": + err = unpopulate(val, "DataAccessAuthMode", &d.DataAccessAuthMode) + delete(rawMsg, key) + case "diskAccessId": + err = unpopulate(val, "DiskAccessID", &d.DiskAccessID) + delete(rawMsg, key) + case "diskIOPSReadOnly": + err = unpopulate(val, "DiskIOPSReadOnly", &d.DiskIOPSReadOnly) + delete(rawMsg, key) + case "diskIOPSReadWrite": + err = unpopulate(val, "DiskIOPSReadWrite", &d.DiskIOPSReadWrite) + delete(rawMsg, key) + case "diskMBpsReadOnly": + err = unpopulate(val, "DiskMBpsReadOnly", &d.DiskMBpsReadOnly) + delete(rawMsg, key) + case "diskMBpsReadWrite": + err = unpopulate(val, "DiskMBpsReadWrite", &d.DiskMBpsReadWrite) + delete(rawMsg, key) + case "diskSizeBytes": + err = unpopulate(val, "DiskSizeBytes", &d.DiskSizeBytes) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) + delete(rawMsg, key) + case "diskState": + err = unpopulate(val, "DiskState", &d.DiskState) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &d.Encryption) + delete(rawMsg, key) + case "encryptionSettingsCollection": + err = unpopulate(val, "EncryptionSettingsCollection", &d.EncryptionSettingsCollection) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &d.HyperVGeneration) + delete(rawMsg, key) + case "maxShares": + err = unpopulate(val, "MaxShares", &d.MaxShares) + delete(rawMsg, key) + case "networkAccessPolicy": + err = unpopulate(val, "NetworkAccessPolicy", &d.NetworkAccessPolicy) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &d.OSType) + delete(rawMsg, key) + case "optimizedForFrequentAttach": + err = unpopulate(val, "OptimizedForFrequentAttach", &d.OptimizedForFrequentAttach) + delete(rawMsg, key) + case "propertyUpdatesInProgress": + err = unpopulate(val, "PropertyUpdatesInProgress", &d.PropertyUpdatesInProgress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &d.PurchasePlan) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &d.SecurityProfile) + delete(rawMsg, key) + case "shareInfo": + err = unpopulate(val, "ShareInfo", &d.ShareInfo) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &d.SupportedCapabilities) + delete(rawMsg, key) + case "supportsHibernation": + err = unpopulate(val, "SupportsHibernation", &d.SupportsHibernation) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &d.Tier) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "uniqueId": + err = unpopulate(val, "UniqueID", &d.UniqueID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskPurchasePlan. +func (d DiskPurchasePlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "product", d.Product) + populate(objectMap, "promotionCode", d.PromotionCode) + populate(objectMap, "publisher", d.Publisher) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskPurchasePlan. +func (d *DiskPurchasePlan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &d.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &d.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &d.Publisher) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePoint. +func (d DiskRestorePoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePoint. +func (d *DiskRestorePoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePointInstanceView. +func (d DiskRestorePointInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "replicationStatus", d.ReplicationStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointInstanceView. +func (d *DiskRestorePointInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "replicationStatus": + err = unpopulate(val, "ReplicationStatus", &d.ReplicationStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePointList. +func (d DiskRestorePointList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointList. +func (d *DiskRestorePointList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePointProperties. +func (d DiskRestorePointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "completionPercent", d.CompletionPercent) + populate(objectMap, "diskAccessId", d.DiskAccessID) + populate(objectMap, "encryption", d.Encryption) + populate(objectMap, "familyId", d.FamilyID) + populate(objectMap, "hyperVGeneration", d.HyperVGeneration) + populate(objectMap, "networkAccessPolicy", d.NetworkAccessPolicy) + populate(objectMap, "osType", d.OSType) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "purchasePlan", d.PurchasePlan) + populate(objectMap, "replicationState", d.ReplicationState) + populate(objectMap, "securityProfile", d.SecurityProfile) + populate(objectMap, "sourceResourceId", d.SourceResourceID) + populate(objectMap, "sourceResourceLocation", d.SourceResourceLocation) + populate(objectMap, "sourceUniqueId", d.SourceUniqueID) + populate(objectMap, "supportedCapabilities", d.SupportedCapabilities) + populate(objectMap, "supportsHibernation", d.SupportsHibernation) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointProperties. +func (d *DiskRestorePointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "completionPercent": + err = unpopulate(val, "CompletionPercent", &d.CompletionPercent) + delete(rawMsg, key) + case "diskAccessId": + err = unpopulate(val, "DiskAccessID", &d.DiskAccessID) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &d.Encryption) + delete(rawMsg, key) + case "familyId": + err = unpopulate(val, "FamilyID", &d.FamilyID) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &d.HyperVGeneration) + delete(rawMsg, key) + case "networkAccessPolicy": + err = unpopulate(val, "NetworkAccessPolicy", &d.NetworkAccessPolicy) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &d.OSType) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &d.PurchasePlan) + delete(rawMsg, key) + case "replicationState": + err = unpopulate(val, "ReplicationState", &d.ReplicationState) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &d.SecurityProfile) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &d.SourceResourceID) + delete(rawMsg, key) + case "sourceResourceLocation": + err = unpopulate(val, "SourceResourceLocation", &d.SourceResourceLocation) + delete(rawMsg, key) + case "sourceUniqueId": + err = unpopulate(val, "SourceUniqueID", &d.SourceUniqueID) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &d.SupportedCapabilities) + delete(rawMsg, key) + case "supportsHibernation": + err = unpopulate(val, "SupportsHibernation", &d.SupportsHibernation) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskRestorePointReplicationStatus. +func (d DiskRestorePointReplicationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "completionPercent", d.CompletionPercent) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskRestorePointReplicationStatus. +func (d *DiskRestorePointReplicationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "completionPercent": + err = unpopulate(val, "CompletionPercent", &d.CompletionPercent) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskSKU. +func (d DiskSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "tier", d.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskSKU. +func (d *DiskSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &d.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskSecurityProfile. +func (d DiskSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secureVMDiskEncryptionSetId", d.SecureVMDiskEncryptionSetID) + populate(objectMap, "securityType", d.SecurityType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskSecurityProfile. +func (d *DiskSecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secureVMDiskEncryptionSetId": + err = unpopulate(val, "SecureVMDiskEncryptionSetID", &d.SecureVMDiskEncryptionSetID) + delete(rawMsg, key) + case "securityType": + err = unpopulate(val, "SecurityType", &d.SecurityType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskUpdate. +func (d DiskUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskUpdate. +func (d *DiskUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiskUpdateProperties. +func (d DiskUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "burstingEnabled", d.BurstingEnabled) + populate(objectMap, "dataAccessAuthMode", d.DataAccessAuthMode) + populate(objectMap, "diskAccessId", d.DiskAccessID) + populate(objectMap, "diskIOPSReadOnly", d.DiskIOPSReadOnly) + populate(objectMap, "diskIOPSReadWrite", d.DiskIOPSReadWrite) + populate(objectMap, "diskMBpsReadOnly", d.DiskMBpsReadOnly) + populate(objectMap, "diskMBpsReadWrite", d.DiskMBpsReadWrite) + populate(objectMap, "diskSizeGB", d.DiskSizeGB) + populate(objectMap, "encryption", d.Encryption) + populate(objectMap, "encryptionSettingsCollection", d.EncryptionSettingsCollection) + populate(objectMap, "maxShares", d.MaxShares) + populate(objectMap, "networkAccessPolicy", d.NetworkAccessPolicy) + populate(objectMap, "osType", d.OSType) + populate(objectMap, "optimizedForFrequentAttach", d.OptimizedForFrequentAttach) + populate(objectMap, "propertyUpdatesInProgress", d.PropertyUpdatesInProgress) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "purchasePlan", d.PurchasePlan) + populate(objectMap, "supportedCapabilities", d.SupportedCapabilities) + populate(objectMap, "supportsHibernation", d.SupportsHibernation) + populate(objectMap, "tier", d.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskUpdateProperties. +func (d *DiskUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "burstingEnabled": + err = unpopulate(val, "BurstingEnabled", &d.BurstingEnabled) + delete(rawMsg, key) + case "dataAccessAuthMode": + err = unpopulate(val, "DataAccessAuthMode", &d.DataAccessAuthMode) + delete(rawMsg, key) + case "diskAccessId": + err = unpopulate(val, "DiskAccessID", &d.DiskAccessID) + delete(rawMsg, key) + case "diskIOPSReadOnly": + err = unpopulate(val, "DiskIOPSReadOnly", &d.DiskIOPSReadOnly) + delete(rawMsg, key) + case "diskIOPSReadWrite": + err = unpopulate(val, "DiskIOPSReadWrite", &d.DiskIOPSReadWrite) + delete(rawMsg, key) + case "diskMBpsReadOnly": + err = unpopulate(val, "DiskMBpsReadOnly", &d.DiskMBpsReadOnly) + delete(rawMsg, key) + case "diskMBpsReadWrite": + err = unpopulate(val, "DiskMBpsReadWrite", &d.DiskMBpsReadWrite) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &d.Encryption) + delete(rawMsg, key) + case "encryptionSettingsCollection": + err = unpopulate(val, "EncryptionSettingsCollection", &d.EncryptionSettingsCollection) + delete(rawMsg, key) + case "maxShares": + err = unpopulate(val, "MaxShares", &d.MaxShares) + delete(rawMsg, key) + case "networkAccessPolicy": + err = unpopulate(val, "NetworkAccessPolicy", &d.NetworkAccessPolicy) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &d.OSType) + delete(rawMsg, key) + case "optimizedForFrequentAttach": + err = unpopulate(val, "OptimizedForFrequentAttach", &d.OptimizedForFrequentAttach) + delete(rawMsg, key) + case "propertyUpdatesInProgress": + err = unpopulate(val, "PropertyUpdatesInProgress", &d.PropertyUpdatesInProgress) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &d.PurchasePlan) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &d.SupportedCapabilities) + delete(rawMsg, key) + case "supportsHibernation": + err = unpopulate(val, "SupportsHibernation", &d.SupportsHibernation) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &d.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Encryption. +func (e Encryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSetId", e.DiskEncryptionSetID) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Encryption. +func (e *Encryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSetId": + err = unpopulate(val, "DiskEncryptionSetID", &e.DiskEncryptionSetID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionImages. +func (e EncryptionImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDiskImages", e.DataDiskImages) + populate(objectMap, "osDiskImage", e.OSDiskImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionImages. +func (e *EncryptionImages) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDiskImages": + err = unpopulate(val, "DataDiskImages", &e.DataDiskImages) + delete(rawMsg, key) + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &e.OSDiskImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetIdentity. +func (e EncryptionSetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", e.PrincipalID) + populate(objectMap, "tenantId", e.TenantID) + populate(objectMap, "type", e.Type) + populate(objectMap, "userAssignedIdentities", e.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetIdentity. +func (e *EncryptionSetIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &e.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &e.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetProperties. +func (e EncryptionSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeKey", e.ActiveKey) + populate(objectMap, "autoKeyRotationError", e.AutoKeyRotationError) + populate(objectMap, "encryptionType", e.EncryptionType) + populate(objectMap, "federatedClientId", e.FederatedClientID) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", e.LastKeyRotationTimestamp) + populate(objectMap, "previousKeys", e.PreviousKeys) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "rotationToLatestKeyVersionEnabled", e.RotationToLatestKeyVersionEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetProperties. +func (e *EncryptionSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activeKey": + err = unpopulate(val, "ActiveKey", &e.ActiveKey) + delete(rawMsg, key) + case "autoKeyRotationError": + err = unpopulate(val, "AutoKeyRotationError", &e.AutoKeyRotationError) + delete(rawMsg, key) + case "encryptionType": + err = unpopulate(val, "EncryptionType", &e.EncryptionType) + delete(rawMsg, key) + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &e.FederatedClientID) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &e.LastKeyRotationTimestamp) + delete(rawMsg, key) + case "previousKeys": + err = unpopulate(val, "PreviousKeys", &e.PreviousKeys) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "rotationToLatestKeyVersionEnabled": + err = unpopulate(val, "RotationToLatestKeyVersionEnabled", &e.RotationToLatestKeyVersionEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSettingsCollection. +func (e EncryptionSettingsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", e.Enabled) + populate(objectMap, "encryptionSettings", e.EncryptionSettings) + populate(objectMap, "encryptionSettingsVersion", e.EncryptionSettingsVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSettingsCollection. +func (e *EncryptionSettingsCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &e.Enabled) + delete(rawMsg, key) + case "encryptionSettings": + err = unpopulate(val, "EncryptionSettings", &e.EncryptionSettings) + delete(rawMsg, key) + case "encryptionSettingsVersion": + err = unpopulate(val, "EncryptionSettingsVersion", &e.EncryptionSettingsVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSettingsElement. +func (e EncryptionSettingsElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionKey", e.DiskEncryptionKey) + populate(objectMap, "keyEncryptionKey", e.KeyEncryptionKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSettingsElement. +func (e *EncryptionSettingsElement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionKey": + err = unpopulate(val, "DiskEncryptionKey", &e.DiskEncryptionKey) + delete(rawMsg, key) + case "keyEncryptionKey": + err = unpopulate(val, "KeyEncryptionKey", &e.KeyEncryptionKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. +func (e *Extension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Gallery. +func (g Gallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Gallery. +func (g *Gallery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplication. +func (g GalleryApplication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplication. +func (g *GalleryApplication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationCustomAction. +func (g GalleryApplicationCustomAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", g.Description) + populate(objectMap, "name", g.Name) + populate(objectMap, "parameters", g.Parameters) + populate(objectMap, "script", g.Script) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationCustomAction. +func (g *GalleryApplicationCustomAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &g.Parameters) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &g.Script) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationCustomActionParameter. +func (g GalleryApplicationCustomActionParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultValue", g.DefaultValue) + populate(objectMap, "description", g.Description) + populate(objectMap, "name", g.Name) + populate(objectMap, "required", g.Required) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationCustomActionParameter. +func (g *GalleryApplicationCustomActionParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultValue": + err = unpopulate(val, "DefaultValue", &g.DefaultValue) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "required": + err = unpopulate(val, "Required", &g.Required) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationList. +func (g GalleryApplicationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationList. +func (g *GalleryApplicationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationProperties. +func (g GalleryApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customActions", g.CustomActions) + populate(objectMap, "description", g.Description) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "eula", g.Eula) + populate(objectMap, "privacyStatementUri", g.PrivacyStatementURI) + populate(objectMap, "releaseNoteUri", g.ReleaseNoteURI) + populate(objectMap, "supportedOSType", g.SupportedOSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationProperties. +func (g *GalleryApplicationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customActions": + err = unpopulate(val, "CustomActions", &g.CustomActions) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "eula": + err = unpopulate(val, "Eula", &g.Eula) + delete(rawMsg, key) + case "privacyStatementUri": + err = unpopulate(val, "PrivacyStatementURI", &g.PrivacyStatementURI) + delete(rawMsg, key) + case "releaseNoteUri": + err = unpopulate(val, "ReleaseNoteURI", &g.ReleaseNoteURI) + delete(rawMsg, key) + case "supportedOSType": + err = unpopulate(val, "SupportedOSType", &g.SupportedOSType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationUpdate. +func (g GalleryApplicationUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationUpdate. +func (g *GalleryApplicationUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersion. +func (g GalleryApplicationVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersion. +func (g *GalleryApplicationVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionList. +func (g GalleryApplicationVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionList. +func (g *GalleryApplicationVersionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionProperties. +func (g GalleryApplicationVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "publishingProfile", g.PublishingProfile) + populate(objectMap, "replicationStatus", g.ReplicationStatus) + populate(objectMap, "safetyProfile", g.SafetyProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionProperties. +func (g *GalleryApplicationVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "publishingProfile": + err = unpopulate(val, "PublishingProfile", &g.PublishingProfile) + delete(rawMsg, key) + case "replicationStatus": + err = unpopulate(val, "ReplicationStatus", &g.ReplicationStatus) + delete(rawMsg, key) + case "safetyProfile": + err = unpopulate(val, "SafetyProfile", &g.SafetyProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionPublishingProfile. +func (g GalleryApplicationVersionPublishingProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "advancedSettings", g.AdvancedSettings) + populate(objectMap, "customActions", g.CustomActions) + populate(objectMap, "enableHealthCheck", g.EnableHealthCheck) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populate(objectMap, "manageActions", g.ManageActions) + populateTimeRFC3339(objectMap, "publishedDate", g.PublishedDate) + populate(objectMap, "replicaCount", g.ReplicaCount) + populate(objectMap, "replicationMode", g.ReplicationMode) + populate(objectMap, "settings", g.Settings) + populate(objectMap, "source", g.Source) + populate(objectMap, "storageAccountType", g.StorageAccountType) + populate(objectMap, "targetExtendedLocations", g.TargetExtendedLocations) + populate(objectMap, "targetRegions", g.TargetRegions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionPublishingProfile. +func (g *GalleryApplicationVersionPublishingProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "advancedSettings": + err = unpopulate(val, "AdvancedSettings", &g.AdvancedSettings) + delete(rawMsg, key) + case "customActions": + err = unpopulate(val, "CustomActions", &g.CustomActions) + delete(rawMsg, key) + case "enableHealthCheck": + err = unpopulate(val, "EnableHealthCheck", &g.EnableHealthCheck) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &g.ExcludeFromLatest) + delete(rawMsg, key) + case "manageActions": + err = unpopulate(val, "ManageActions", &g.ManageActions) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &g.PublishedDate) + delete(rawMsg, key) + case "replicaCount": + err = unpopulate(val, "ReplicaCount", &g.ReplicaCount) + delete(rawMsg, key) + case "replicationMode": + err = unpopulate(val, "ReplicationMode", &g.ReplicationMode) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &g.Settings) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &g.Source) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &g.StorageAccountType) + delete(rawMsg, key) + case "targetExtendedLocations": + err = unpopulate(val, "TargetExtendedLocations", &g.TargetExtendedLocations) + delete(rawMsg, key) + case "targetRegions": + err = unpopulate(val, "TargetRegions", &g.TargetRegions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionSafetyProfile. +func (g GalleryApplicationVersionSafetyProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowDeletionOfReplicatedLocations", g.AllowDeletionOfReplicatedLocations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionSafetyProfile. +func (g *GalleryApplicationVersionSafetyProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowDeletionOfReplicatedLocations": + err = unpopulate(val, "AllowDeletionOfReplicatedLocations", &g.AllowDeletionOfReplicatedLocations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryApplicationVersionUpdate. +func (g GalleryApplicationVersionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryApplicationVersionUpdate. +func (g *GalleryApplicationVersionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryArtifactPublishingProfileBase. +func (g GalleryArtifactPublishingProfileBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populateTimeRFC3339(objectMap, "publishedDate", g.PublishedDate) + populate(objectMap, "replicaCount", g.ReplicaCount) + populate(objectMap, "replicationMode", g.ReplicationMode) + populate(objectMap, "storageAccountType", g.StorageAccountType) + populate(objectMap, "targetExtendedLocations", g.TargetExtendedLocations) + populate(objectMap, "targetRegions", g.TargetRegions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactPublishingProfileBase. +func (g *GalleryArtifactPublishingProfileBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &g.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &g.PublishedDate) + delete(rawMsg, key) + case "replicaCount": + err = unpopulate(val, "ReplicaCount", &g.ReplicaCount) + delete(rawMsg, key) + case "replicationMode": + err = unpopulate(val, "ReplicationMode", &g.ReplicationMode) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &g.StorageAccountType) + delete(rawMsg, key) + case "targetExtendedLocations": + err = unpopulate(val, "TargetExtendedLocations", &g.TargetExtendedLocations) + delete(rawMsg, key) + case "targetRegions": + err = unpopulate(val, "TargetRegions", &g.TargetRegions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryArtifactSafetyProfileBase. +func (g GalleryArtifactSafetyProfileBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowDeletionOfReplicatedLocations", g.AllowDeletionOfReplicatedLocations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactSafetyProfileBase. +func (g *GalleryArtifactSafetyProfileBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowDeletionOfReplicatedLocations": + err = unpopulate(val, "AllowDeletionOfReplicatedLocations", &g.AllowDeletionOfReplicatedLocations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryArtifactSource. +func (g GalleryArtifactSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managedImage", g.ManagedImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactSource. +func (g *GalleryArtifactSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "managedImage": + err = unpopulate(val, "ManagedImage", &g.ManagedImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryArtifactVersionFullSource. +func (g GalleryArtifactVersionFullSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityGalleryImageId", g.CommunityGalleryImageID) + populate(objectMap, "id", g.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactVersionFullSource. +func (g *GalleryArtifactVersionFullSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryImageId": + err = unpopulate(val, "CommunityGalleryImageID", &g.CommunityGalleryImageID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryArtifactVersionSource. +func (g GalleryArtifactVersionSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryArtifactVersionSource. +func (g *GalleryArtifactVersionSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryDataDiskImage. +func (g GalleryDataDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostCaching", g.HostCaching) + populate(objectMap, "lun", g.Lun) + populate(objectMap, "sizeInGB", g.SizeInGB) + populate(objectMap, "source", g.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDataDiskImage. +func (g *GalleryDataDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostCaching": + err = unpopulate(val, "HostCaching", &g.HostCaching) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &g.Lun) + delete(rawMsg, key) + case "sizeInGB": + err = unpopulate(val, "SizeInGB", &g.SizeInGB) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &g.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryDiskImage. +func (g GalleryDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostCaching", g.HostCaching) + populate(objectMap, "sizeInGB", g.SizeInGB) + populate(objectMap, "source", g.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDiskImage. +func (g *GalleryDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostCaching": + err = unpopulate(val, "HostCaching", &g.HostCaching) + delete(rawMsg, key) + case "sizeInGB": + err = unpopulate(val, "SizeInGB", &g.SizeInGB) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &g.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryDiskImageSource. +func (g GalleryDiskImageSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "storageAccountId", g.StorageAccountID) + populate(objectMap, "uri", g.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryDiskImageSource. +func (g *GalleryDiskImageSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &g.StorageAccountID) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &g.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryExtendedLocation. +func (g GalleryExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", g.Name) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryExtendedLocation. +func (g *GalleryExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryIdentifier. +func (g GalleryIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "uniqueName", g.UniqueName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryIdentifier. +func (g *GalleryIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uniqueName": + err = unpopulate(val, "UniqueName", &g.UniqueName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImage. +func (g GalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImage. +func (g *GalleryImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageFeature. +func (g GalleryImageFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", g.Name) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageFeature. +func (g *GalleryImageFeature) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. +func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offer", g.Offer) + populate(objectMap, "publisher", g.Publisher) + populate(objectMap, "sku", g.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier. +func (g *GalleryImageIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "offer": + err = unpopulate(val, "Offer", &g.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &g.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageList. +func (g GalleryImageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageList. +func (g *GalleryImageList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. +func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", g.Architecture) + populate(objectMap, "description", g.Description) + populate(objectMap, "disallowed", g.Disallowed) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "eula", g.Eula) + populate(objectMap, "features", g.Features) + populate(objectMap, "hyperVGeneration", g.HyperVGeneration) + populate(objectMap, "identifier", g.Identifier) + populate(objectMap, "osState", g.OSState) + populate(objectMap, "osType", g.OSType) + populate(objectMap, "privacyStatementUri", g.PrivacyStatementURI) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "purchasePlan", g.PurchasePlan) + populate(objectMap, "recommended", g.Recommended) + populate(objectMap, "releaseNoteUri", g.ReleaseNoteURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. +func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &g.Architecture) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "disallowed": + err = unpopulate(val, "Disallowed", &g.Disallowed) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "eula": + err = unpopulate(val, "Eula", &g.Eula) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &g.Features) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &g.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &g.Identifier) + delete(rawMsg, key) + case "osState": + err = unpopulate(val, "OSState", &g.OSState) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &g.OSType) + delete(rawMsg, key) + case "privacyStatementUri": + err = unpopulate(val, "PrivacyStatementURI", &g.PrivacyStatementURI) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &g.PurchasePlan) + delete(rawMsg, key) + case "recommended": + err = unpopulate(val, "Recommended", &g.Recommended) + delete(rawMsg, key) + case "releaseNoteUri": + err = unpopulate(val, "ReleaseNoteURI", &g.ReleaseNoteURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageUpdate. +func (g GalleryImageUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageUpdate. +func (g *GalleryImageUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. +func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion. +func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionList. +func (g GalleryImageVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionList. +func (g *GalleryImageVersionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. +func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "publishingProfile", g.PublishingProfile) + populate(objectMap, "replicationStatus", g.ReplicationStatus) + populate(objectMap, "safetyProfile", g.SafetyProfile) + populate(objectMap, "storageProfile", g.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties. +func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "publishingProfile": + err = unpopulate(val, "PublishingProfile", &g.PublishingProfile) + delete(rawMsg, key) + case "replicationStatus": + err = unpopulate(val, "ReplicationStatus", &g.ReplicationStatus) + delete(rawMsg, key) + case "safetyProfile": + err = unpopulate(val, "SafetyProfile", &g.SafetyProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &g.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionPublishingProfile. +func (g GalleryImageVersionPublishingProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) + populateTimeRFC3339(objectMap, "publishedDate", g.PublishedDate) + populate(objectMap, "replicaCount", g.ReplicaCount) + populate(objectMap, "replicationMode", g.ReplicationMode) + populate(objectMap, "storageAccountType", g.StorageAccountType) + populate(objectMap, "targetExtendedLocations", g.TargetExtendedLocations) + populate(objectMap, "targetRegions", g.TargetRegions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionPublishingProfile. +func (g *GalleryImageVersionPublishingProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &g.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &g.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &g.PublishedDate) + delete(rawMsg, key) + case "replicaCount": + err = unpopulate(val, "ReplicaCount", &g.ReplicaCount) + delete(rawMsg, key) + case "replicationMode": + err = unpopulate(val, "ReplicationMode", &g.ReplicationMode) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &g.StorageAccountType) + delete(rawMsg, key) + case "targetExtendedLocations": + err = unpopulate(val, "TargetExtendedLocations", &g.TargetExtendedLocations) + delete(rawMsg, key) + case "targetRegions": + err = unpopulate(val, "TargetRegions", &g.TargetRegions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionSafetyProfile. +func (g GalleryImageVersionSafetyProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowDeletionOfReplicatedLocations", g.AllowDeletionOfReplicatedLocations) + populate(objectMap, "policyViolations", g.PolicyViolations) + populate(objectMap, "reportedForPolicyViolation", g.ReportedForPolicyViolation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionSafetyProfile. +func (g *GalleryImageVersionSafetyProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowDeletionOfReplicatedLocations": + err = unpopulate(val, "AllowDeletionOfReplicatedLocations", &g.AllowDeletionOfReplicatedLocations) + delete(rawMsg, key) + case "policyViolations": + err = unpopulate(val, "PolicyViolations", &g.PolicyViolations) + delete(rawMsg, key) + case "reportedForPolicyViolation": + err = unpopulate(val, "ReportedForPolicyViolation", &g.ReportedForPolicyViolation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. +func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDiskImages", g.DataDiskImages) + populate(objectMap, "osDiskImage", g.OSDiskImage) + populate(objectMap, "source", g.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile. +func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDiskImages": + err = unpopulate(val, "DataDiskImages", &g.DataDiskImages) + delete(rawMsg, key) + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &g.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionUpdate. +func (g GalleryImageVersionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionUpdate. +func (g *GalleryImageVersionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryList. +func (g GalleryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryList. +func (g *GalleryList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. +func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostCaching", g.HostCaching) + populate(objectMap, "sizeInGB", g.SizeInGB) + populate(objectMap, "source", g.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage. +func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostCaching": + err = unpopulate(val, "HostCaching", &g.HostCaching) + delete(rawMsg, key) + case "sizeInGB": + err = unpopulate(val, "SizeInGB", &g.SizeInGB) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &g.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryProperties. +func (g GalleryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", g.Description) + populate(objectMap, "identifier", g.Identifier) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "sharingProfile", g.SharingProfile) + populate(objectMap, "sharingStatus", g.SharingStatus) + populate(objectMap, "softDeletePolicy", g.SoftDeletePolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryProperties. +func (g *GalleryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &g.Identifier) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "sharingProfile": + err = unpopulate(val, "SharingProfile", &g.SharingProfile) + delete(rawMsg, key) + case "sharingStatus": + err = unpopulate(val, "SharingStatus", &g.SharingStatus) + delete(rawMsg, key) + case "softDeletePolicy": + err = unpopulate(val, "SoftDeletePolicy", &g.SoftDeletePolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryTargetExtendedLocation. +func (g GalleryTargetExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", g.Encryption) + populate(objectMap, "extendedLocation", g.ExtendedLocation) + populate(objectMap, "extendedLocationReplicaCount", g.ExtendedLocationReplicaCount) + populate(objectMap, "name", g.Name) + populate(objectMap, "storageAccountType", g.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryTargetExtendedLocation. +func (g *GalleryTargetExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryption": + err = unpopulate(val, "Encryption", &g.Encryption) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) + delete(rawMsg, key) + case "extendedLocationReplicaCount": + err = unpopulate(val, "ExtendedLocationReplicaCount", &g.ExtendedLocationReplicaCount) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &g.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryUpdate. +func (g GalleryUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryUpdate. +func (g *GalleryUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GrantAccessData. +func (g GrantAccessData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", g.Access) + populate(objectMap, "durationInSeconds", g.DurationInSeconds) + populate(objectMap, "getSecureVMGuestStateSAS", g.GetSecureVMGuestStateSAS) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GrantAccessData. +func (g *GrantAccessData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &g.Access) + delete(rawMsg, key) + case "durationInSeconds": + err = unpopulate(val, "DurationInSeconds", &g.DurationInSeconds) + delete(rawMsg, key) + case "getSecureVMGuestStateSAS": + err = unpopulate(val, "GetSecureVMGuestStateSAS", &g.GetSecureVMGuestStateSAS) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HardwareProfile. +func (h HardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmSize", h.VMSize) + populate(objectMap, "vmSizeProperties", h.VMSizeProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfile. +func (h *HardwareProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmSize": + err = unpopulate(val, "VMSize", &h.VMSize) + delete(rawMsg, key) + case "vmSizeProperties": + err = unpopulate(val, "VMSizeProperties", &h.VMSizeProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Image. +func (i Image) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", i.ExtendedLocation) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Image. +func (i *Image) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &i.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageDataDisk. +func (i ImageDataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobUri", i.BlobURI) + populate(objectMap, "caching", i.Caching) + populate(objectMap, "diskEncryptionSet", i.DiskEncryptionSet) + populate(objectMap, "diskSizeGB", i.DiskSizeGB) + populate(objectMap, "lun", i.Lun) + populate(objectMap, "managedDisk", i.ManagedDisk) + populate(objectMap, "snapshot", i.Snapshot) + populate(objectMap, "storageAccountType", i.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDataDisk. +func (i *ImageDataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobUri": + err = unpopulate(val, "BlobURI", &i.BlobURI) + delete(rawMsg, key) + case "caching": + err = unpopulate(val, "Caching", &i.Caching) + delete(rawMsg, key) + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &i.DiskEncryptionSet) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &i.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &i.Lun) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &i.ManagedDisk) + delete(rawMsg, key) + case "snapshot": + err = unpopulate(val, "Snapshot", &i.Snapshot) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &i.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageDisk. +func (i ImageDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobUri", i.BlobURI) + populate(objectMap, "caching", i.Caching) + populate(objectMap, "diskEncryptionSet", i.DiskEncryptionSet) + populate(objectMap, "diskSizeGB", i.DiskSizeGB) + populate(objectMap, "managedDisk", i.ManagedDisk) + populate(objectMap, "snapshot", i.Snapshot) + populate(objectMap, "storageAccountType", i.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDisk. +func (i *ImageDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobUri": + err = unpopulate(val, "BlobURI", &i.BlobURI) + delete(rawMsg, key) + case "caching": + err = unpopulate(val, "Caching", &i.Caching) + delete(rawMsg, key) + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &i.DiskEncryptionSet) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &i.DiskSizeGB) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &i.ManagedDisk) + delete(rawMsg, key) + case "snapshot": + err = unpopulate(val, "Snapshot", &i.Snapshot) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &i.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageDiskReference. +func (i ImageDiskReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityGalleryImageId", i.CommunityGalleryImageID) + populate(objectMap, "id", i.ID) + populate(objectMap, "lun", i.Lun) + populate(objectMap, "sharedGalleryImageId", i.SharedGalleryImageID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDiskReference. +func (i *ImageDiskReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryImageId": + err = unpopulate(val, "CommunityGalleryImageID", &i.CommunityGalleryImageID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &i.Lun) + delete(rawMsg, key) + case "sharedGalleryImageId": + err = unpopulate(val, "SharedGalleryImageID", &i.SharedGalleryImageID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageListResult. +func (i ImageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageListResult. +func (i *ImageListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageOSDisk. +func (i ImageOSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobUri", i.BlobURI) + populate(objectMap, "caching", i.Caching) + populate(objectMap, "diskEncryptionSet", i.DiskEncryptionSet) + populate(objectMap, "diskSizeGB", i.DiskSizeGB) + populate(objectMap, "managedDisk", i.ManagedDisk) + populate(objectMap, "osState", i.OSState) + populate(objectMap, "osType", i.OSType) + populate(objectMap, "snapshot", i.Snapshot) + populate(objectMap, "storageAccountType", i.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageOSDisk. +func (i *ImageOSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobUri": + err = unpopulate(val, "BlobURI", &i.BlobURI) + delete(rawMsg, key) + case "caching": + err = unpopulate(val, "Caching", &i.Caching) + delete(rawMsg, key) + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &i.DiskEncryptionSet) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &i.DiskSizeGB) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &i.ManagedDisk) + delete(rawMsg, key) + case "osState": + err = unpopulate(val, "OSState", &i.OSState) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &i.OSType) + delete(rawMsg, key) + case "snapshot": + err = unpopulate(val, "Snapshot", &i.Snapshot) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &i.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageProperties. +func (i ImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hyperVGeneration", i.HyperVGeneration) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "sourceVirtualMachine", i.SourceVirtualMachine) + populate(objectMap, "storageProfile", i.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageProperties. +func (i *ImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &i.HyperVGeneration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "sourceVirtualMachine": + err = unpopulate(val, "SourceVirtualMachine", &i.SourceVirtualMachine) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &i.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImagePurchasePlan. +func (i ImagePurchasePlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", i.Name) + populate(objectMap, "product", i.Product) + populate(objectMap, "publisher", i.Publisher) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImagePurchasePlan. +func (i *ImagePurchasePlan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &i.Product) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &i.Publisher) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageReference. +func (i ImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityGalleryImageId", i.CommunityGalleryImageID) + populate(objectMap, "exactVersion", i.ExactVersion) + populate(objectMap, "id", i.ID) + populate(objectMap, "offer", i.Offer) + populate(objectMap, "publisher", i.Publisher) + populate(objectMap, "sku", i.SKU) + populate(objectMap, "sharedGalleryImageId", i.SharedGalleryImageID) + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. +func (i *ImageReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryImageId": + err = unpopulate(val, "CommunityGalleryImageID", &i.CommunityGalleryImageID) + delete(rawMsg, key) + case "exactVersion": + err = unpopulate(val, "ExactVersion", &i.ExactVersion) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "offer": + err = unpopulate(val, "Offer", &i.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &i.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &i.SKU) + delete(rawMsg, key) + case "sharedGalleryImageId": + err = unpopulate(val, "SharedGalleryImageID", &i.SharedGalleryImageID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &i.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageStorageProfile. +func (i ImageStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", i.DataDisks) + populate(objectMap, "osDisk", i.OSDisk) + populate(objectMap, "zoneResilient", i.ZoneResilient) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageStorageProfile. +func (i *ImageStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &i.DataDisks) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &i.OSDisk) + delete(rawMsg, key) + case "zoneResilient": + err = unpopulate(val, "ZoneResilient", &i.ZoneResilient) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageUpdate. +func (i ImageUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdate. +func (i *ImageUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errordetail", i.Errordetail) + populate(objectMap, "exceptiontype", i.Exceptiontype) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. +func (i *InnerError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errordetail": + err = unpopulate(val, "Errordetail", &i.Errordetail) + delete(rawMsg, key) + case "exceptiontype": + err = unpopulate(val, "Exceptiontype", &i.Exceptiontype) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceSKU. +func (i InstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", i.Name) + populate(objectMap, "tier", i.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceSKU. +func (i *InstanceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &i.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus. +func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", i.Code) + populate(objectMap, "displayStatus", i.DisplayStatus) + populate(objectMap, "level", i.Level) + populate(objectMap, "message", i.Message) + populateTimeRFC3339(objectMap, "time", i.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatus. +func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &i.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &i.Time) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatusesSummary. +func (i InstanceViewStatusesSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "statusesSummary", i.StatusesSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceViewStatusesSummary. +func (i *InstanceViewStatusesSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "statusesSummary": + err = unpopulate(val, "StatusesSummary", &i.StatusesSummary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyForDiskEncryptionSet. +func (k KeyForDiskEncryptionSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyUrl", k.KeyURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyForDiskEncryptionSet. +func (k *KeyForDiskEncryptionSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyUrl": + err = unpopulate(val, "KeyURL", &k.KeyURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultAndKeyReference. +func (k KeyVaultAndKeyReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyUrl", k.KeyURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultAndKeyReference. +func (k *KeyVaultAndKeyReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyUrl": + err = unpopulate(val, "KeyURL", &k.KeyURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultAndSecretReference. +func (k KeyVaultAndSecretReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretUrl", k.SecretURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultAndSecretReference. +func (k *KeyVaultAndSecretReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretUrl": + err = unpopulate(val, "SecretURL", &k.SecretURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultKeyReference. +func (k KeyVaultKeyReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyUrl", k.KeyURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultKeyReference. +func (k *KeyVaultKeyReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyUrl": + err = unpopulate(val, "KeyURL", &k.KeyURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultSecretReference. +func (k KeyVaultSecretReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretUrl", k.SecretURL) + populate(objectMap, "sourceVault", k.SourceVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultSecretReference. +func (k *KeyVaultSecretReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretUrl": + err = unpopulate(val, "SecretURL", &k.SecretURL) + delete(rawMsg, key) + case "sourceVault": + err = unpopulate(val, "SourceVault", &k.SourceVault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LastPatchInstallationSummary. +func (l LastPatchInstallationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", l.Error) + populate(objectMap, "excludedPatchCount", l.ExcludedPatchCount) + populate(objectMap, "failedPatchCount", l.FailedPatchCount) + populate(objectMap, "installationActivityId", l.InstallationActivityID) + populate(objectMap, "installedPatchCount", l.InstalledPatchCount) + populateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) + populate(objectMap, "maintenanceWindowExceeded", l.MaintenanceWindowExceeded) + populate(objectMap, "notSelectedPatchCount", l.NotSelectedPatchCount) + populate(objectMap, "pendingPatchCount", l.PendingPatchCount) + populateTimeRFC3339(objectMap, "startTime", l.StartTime) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LastPatchInstallationSummary. +func (l *LastPatchInstallationSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &l.Error) + delete(rawMsg, key) + case "excludedPatchCount": + err = unpopulate(val, "ExcludedPatchCount", &l.ExcludedPatchCount) + delete(rawMsg, key) + case "failedPatchCount": + err = unpopulate(val, "FailedPatchCount", &l.FailedPatchCount) + delete(rawMsg, key) + case "installationActivityId": + err = unpopulate(val, "InstallationActivityID", &l.InstallationActivityID) + delete(rawMsg, key) + case "installedPatchCount": + err = unpopulate(val, "InstalledPatchCount", &l.InstalledPatchCount) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &l.LastModifiedTime) + delete(rawMsg, key) + case "maintenanceWindowExceeded": + err = unpopulate(val, "MaintenanceWindowExceeded", &l.MaintenanceWindowExceeded) + delete(rawMsg, key) + case "notSelectedPatchCount": + err = unpopulate(val, "NotSelectedPatchCount", &l.NotSelectedPatchCount) + delete(rawMsg, key) + case "pendingPatchCount": + err = unpopulate(val, "PendingPatchCount", &l.PendingPatchCount) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &l.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LatestGalleryImageVersion. +func (l LatestGalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "latestVersionName", l.LatestVersionName) + populate(objectMap, "location", l.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LatestGalleryImageVersion. +func (l *LatestGalleryImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "latestVersionName": + err = unpopulate(val, "LatestVersionName", &l.LatestVersionName) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxConfiguration. +func (l LinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disablePasswordAuthentication", l.DisablePasswordAuthentication) + populate(objectMap, "enableVMAgentPlatformUpdates", l.EnableVMAgentPlatformUpdates) + populate(objectMap, "patchSettings", l.PatchSettings) + populate(objectMap, "provisionVMAgent", l.ProvisionVMAgent) + populate(objectMap, "ssh", l.SSH) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxConfiguration. +func (l *LinuxConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disablePasswordAuthentication": + err = unpopulate(val, "DisablePasswordAuthentication", &l.DisablePasswordAuthentication) + delete(rawMsg, key) + case "enableVMAgentPlatformUpdates": + err = unpopulate(val, "EnableVMAgentPlatformUpdates", &l.EnableVMAgentPlatformUpdates) + delete(rawMsg, key) + case "patchSettings": + err = unpopulate(val, "PatchSettings", &l.PatchSettings) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &l.ProvisionVMAgent) + delete(rawMsg, key) + case "ssh": + err = unpopulate(val, "SSH", &l.SSH) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxParameters. +func (l LinuxParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classificationsToInclude", l.ClassificationsToInclude) + populate(objectMap, "maintenanceRunId", l.MaintenanceRunID) + populate(objectMap, "packageNameMasksToExclude", l.PackageNameMasksToExclude) + populate(objectMap, "packageNameMasksToInclude", l.PackageNameMasksToInclude) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxParameters. +func (l *LinuxParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &l.ClassificationsToInclude) + delete(rawMsg, key) + case "maintenanceRunId": + err = unpopulate(val, "MaintenanceRunID", &l.MaintenanceRunID) + delete(rawMsg, key) + case "packageNameMasksToExclude": + err = unpopulate(val, "PackageNameMasksToExclude", &l.PackageNameMasksToExclude) + delete(rawMsg, key) + case "packageNameMasksToInclude": + err = unpopulate(val, "PackageNameMasksToInclude", &l.PackageNameMasksToInclude) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxPatchSettings. +func (l LinuxPatchSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentMode", l.AssessmentMode) + populate(objectMap, "automaticByPlatformSettings", l.AutomaticByPlatformSettings) + populate(objectMap, "patchMode", l.PatchMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxPatchSettings. +func (l *LinuxPatchSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentMode": + err = unpopulate(val, "AssessmentMode", &l.AssessmentMode) + delete(rawMsg, key) + case "automaticByPlatformSettings": + err = unpopulate(val, "AutomaticByPlatformSettings", &l.AutomaticByPlatformSettings) + delete(rawMsg, key) + case "patchMode": + err = unpopulate(val, "PatchMode", &l.PatchMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings. +func (l LinuxVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rebootSetting", l.RebootSetting) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxVMGuestPatchAutomaticByPlatformSettings. +func (l *LinuxVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &l.RebootSetting) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. +func (l ListUsagesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListUsagesResult. +func (l *ListUsagesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfiguration. +func (l LoadBalancerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerConfiguration. +func (l *LoadBalancerConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfigurationProperties. +func (l LoadBalancerConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "frontendIPConfigurations", l.FrontendIPConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerConfigurationProperties. +func (l *LoadBalancerConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frontendIPConfigurations": + err = unpopulate(val, "FrontendIPConfigurations", &l.FrontendIPConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerFrontendIPConfiguration. +func (l LoadBalancerFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerFrontendIPConfiguration. +func (l *LoadBalancerFrontendIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerFrontendIPConfigurationProperties. +func (l LoadBalancerFrontendIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", l.PrivateIPAddress) + populate(objectMap, "publicIPAddress", l.PublicIPAddress) + populate(objectMap, "subnet", l.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerFrontendIPConfigurationProperties. +func (l *LoadBalancerFrontendIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &l.PrivateIPAddress) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &l.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &l.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsInputBase. +func (l LogAnalyticsInputBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobContainerSasUri", l.BlobContainerSasURI) + populateTimeRFC3339(objectMap, "fromTime", l.FromTime) + populate(objectMap, "groupByClientApplicationId", l.GroupByClientApplicationID) + populate(objectMap, "groupByOperationName", l.GroupByOperationName) + populate(objectMap, "groupByResourceName", l.GroupByResourceName) + populate(objectMap, "groupByThrottlePolicy", l.GroupByThrottlePolicy) + populate(objectMap, "groupByUserAgent", l.GroupByUserAgent) + populateTimeRFC3339(objectMap, "toTime", l.ToTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsInputBase. +func (l *LogAnalyticsInputBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobContainerSasUri": + err = unpopulate(val, "BlobContainerSasURI", &l.BlobContainerSasURI) + delete(rawMsg, key) + case "fromTime": + err = unpopulateTimeRFC3339(val, "FromTime", &l.FromTime) + delete(rawMsg, key) + case "groupByClientApplicationId": + err = unpopulate(val, "GroupByClientApplicationID", &l.GroupByClientApplicationID) + delete(rawMsg, key) + case "groupByOperationName": + err = unpopulate(val, "GroupByOperationName", &l.GroupByOperationName) + delete(rawMsg, key) + case "groupByResourceName": + err = unpopulate(val, "GroupByResourceName", &l.GroupByResourceName) + delete(rawMsg, key) + case "groupByThrottlePolicy": + err = unpopulate(val, "GroupByThrottlePolicy", &l.GroupByThrottlePolicy) + delete(rawMsg, key) + case "groupByUserAgent": + err = unpopulate(val, "GroupByUserAgent", &l.GroupByUserAgent) + delete(rawMsg, key) + case "toTime": + err = unpopulateTimeRFC3339(val, "ToTime", &l.ToTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsOperationResult. +func (l LogAnalyticsOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsOperationResult. +func (l *LogAnalyticsOperationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsOutput. +func (l LogAnalyticsOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "output", l.Output) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsOutput. +func (l *LogAnalyticsOutput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "output": + err = unpopulate(val, "Output", &l.Output) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceRedeployStatus. +func (m MaintenanceRedeployStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isCustomerInitiatedMaintenanceAllowed", m.IsCustomerInitiatedMaintenanceAllowed) + populate(objectMap, "lastOperationMessage", m.LastOperationMessage) + populate(objectMap, "lastOperationResultCode", m.LastOperationResultCode) + populateTimeRFC3339(objectMap, "maintenanceWindowEndTime", m.MaintenanceWindowEndTime) + populateTimeRFC3339(objectMap, "maintenanceWindowStartTime", m.MaintenanceWindowStartTime) + populateTimeRFC3339(objectMap, "preMaintenanceWindowEndTime", m.PreMaintenanceWindowEndTime) + populateTimeRFC3339(objectMap, "preMaintenanceWindowStartTime", m.PreMaintenanceWindowStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceRedeployStatus. +func (m *MaintenanceRedeployStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isCustomerInitiatedMaintenanceAllowed": + err = unpopulate(val, "IsCustomerInitiatedMaintenanceAllowed", &m.IsCustomerInitiatedMaintenanceAllowed) + delete(rawMsg, key) + case "lastOperationMessage": + err = unpopulate(val, "LastOperationMessage", &m.LastOperationMessage) + delete(rawMsg, key) + case "lastOperationResultCode": + err = unpopulate(val, "LastOperationResultCode", &m.LastOperationResultCode) + delete(rawMsg, key) + case "maintenanceWindowEndTime": + err = unpopulateTimeRFC3339(val, "MaintenanceWindowEndTime", &m.MaintenanceWindowEndTime) + delete(rawMsg, key) + case "maintenanceWindowStartTime": + err = unpopulateTimeRFC3339(val, "MaintenanceWindowStartTime", &m.MaintenanceWindowStartTime) + delete(rawMsg, key) + case "preMaintenanceWindowEndTime": + err = unpopulateTimeRFC3339(val, "PreMaintenanceWindowEndTime", &m.PreMaintenanceWindowEndTime) + delete(rawMsg, key) + case "preMaintenanceWindowStartTime": + err = unpopulateTimeRFC3339(val, "PreMaintenanceWindowStartTime", &m.PreMaintenanceWindowStartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedArtifact. +func (m ManagedArtifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedArtifact. +func (m *ManagedArtifact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDiskParameters. +func (m ManagedDiskParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSet", m.DiskEncryptionSet) + populate(objectMap, "id", m.ID) + populate(objectMap, "securityProfile", m.SecurityProfile) + populate(objectMap, "storageAccountType", m.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDiskParameters. +func (m *ManagedDiskParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &m.DiskEncryptionSet) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &m.SecurityProfile) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &m.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceReference. +func (n NetworkInterfaceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", n.ID) + populate(objectMap, "properties", n.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceReference. +func (n *NetworkInterfaceReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceReferenceProperties. +func (n NetworkInterfaceReferenceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteOption", n.DeleteOption) + populate(objectMap, "primary", n.Primary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceReferenceProperties. +func (n *NetworkInterfaceReferenceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deleteOption": + err = unpopulate(val, "DeleteOption", &n.DeleteOption) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &n.Primary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkApiVersion", n.NetworkAPIVersion) + populate(objectMap, "networkInterfaceConfigurations", n.NetworkInterfaceConfigurations) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkApiVersion": + err = unpopulate(val, "NetworkAPIVersion", &n.NetworkAPIVersion) + delete(rawMsg, key) + case "networkInterfaceConfigurations": + err = unpopulate(val, "NetworkInterfaceConfigurations", &n.NetworkInterfaceConfigurations) + delete(rawMsg, key) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSDisk. +func (o OSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", o.Caching) + populate(objectMap, "createOption", o.CreateOption) + populate(objectMap, "deleteOption", o.DeleteOption) + populate(objectMap, "diffDiskSettings", o.DiffDiskSettings) + populate(objectMap, "diskSizeGB", o.DiskSizeGB) + populate(objectMap, "encryptionSettings", o.EncryptionSettings) + populate(objectMap, "image", o.Image) + populate(objectMap, "managedDisk", o.ManagedDisk) + populate(objectMap, "name", o.Name) + populate(objectMap, "osType", o.OSType) + populate(objectMap, "vhd", o.Vhd) + populate(objectMap, "writeAcceleratorEnabled", o.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSDisk. +func (o *OSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &o.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &o.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &o.DeleteOption) + delete(rawMsg, key) + case "diffDiskSettings": + err = unpopulate(val, "DiffDiskSettings", &o.DiffDiskSettings) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &o.DiskSizeGB) + delete(rawMsg, key) + case "encryptionSettings": + err = unpopulate(val, "EncryptionSettings", &o.EncryptionSettings) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &o.Image) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &o.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &o.OSType) + delete(rawMsg, key) + case "vhd": + err = unpopulate(val, "Vhd", &o.Vhd) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &o.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSDiskImage. +func (o OSDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operatingSystem", o.OperatingSystem) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImage. +func (o *OSDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operatingSystem": + err = unpopulate(val, "OperatingSystem", &o.OperatingSystem) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSDiskImageEncryption. +func (o OSDiskImageEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSetId", o.DiskEncryptionSetID) + populate(objectMap, "securityProfile", o.SecurityProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImageEncryption. +func (o *OSDiskImageEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSetId": + err = unpopulate(val, "DiskEncryptionSetID", &o.DiskEncryptionSetID) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &o.SecurityProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSDiskImageSecurityProfile. +func (o OSDiskImageSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "confidentialVMEncryptionType", o.ConfidentialVMEncryptionType) + populate(objectMap, "secureVMDiskEncryptionSetId", o.SecureVMDiskEncryptionSetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSDiskImageSecurityProfile. +func (o *OSDiskImageSecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "confidentialVMEncryptionType": + err = unpopulate(val, "ConfidentialVMEncryptionType", &o.ConfidentialVMEncryptionType) + delete(rawMsg, key) + case "secureVMDiskEncryptionSetId": + err = unpopulate(val, "SecureVMDiskEncryptionSetID", &o.SecureVMDiskEncryptionSetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSFamily. +func (o OSFamily) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", o.ID) + populate(objectMap, "location", o.Location) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSFamily. +func (o *OSFamily) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &o.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSFamilyListResult. +func (o OSFamilyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSFamilyListResult. +func (o *OSFamilyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSFamilyProperties. +func (o OSFamilyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", o.Label) + populate(objectMap, "name", o.Name) + populate(objectMap, "versions", o.Versions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSFamilyProperties. +func (o *OSFamilyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "label": + err = unpopulate(val, "Label", &o.Label) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "versions": + err = unpopulate(val, "Versions", &o.Versions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSProfile. +func (o OSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminPassword", o.AdminPassword) + populate(objectMap, "adminUsername", o.AdminUsername) + populate(objectMap, "allowExtensionOperations", o.AllowExtensionOperations) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "customData", o.CustomData) + populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) + populate(objectMap, "requireGuestProvisionSignal", o.RequireGuestProvisionSignal) + populate(objectMap, "secrets", o.Secrets) + populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfile. +func (o *OSProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminPassword": + err = unpopulate(val, "AdminPassword", &o.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &o.AdminUsername) + delete(rawMsg, key) + case "allowExtensionOperations": + err = unpopulate(val, "AllowExtensionOperations", &o.AllowExtensionOperations) + delete(rawMsg, key) + case "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "customData": + err = unpopulate(val, "CustomData", &o.CustomData) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + delete(rawMsg, key) + case "requireGuestProvisionSignal": + err = unpopulate(val, "RequireGuestProvisionSignal", &o.RequireGuestProvisionSignal) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &o.Secrets) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSVersion. +func (o OSVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", o.ID) + populate(objectMap, "location", o.Location) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSVersion. +func (o *OSVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &o.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSVersionListResult. +func (o OSVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSVersionListResult. +func (o *OSVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSVersionProperties. +func (o OSVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "family", o.Family) + populate(objectMap, "familyLabel", o.FamilyLabel) + populate(objectMap, "isActive", o.IsActive) + populate(objectMap, "isDefault", o.IsDefault) + populate(objectMap, "label", o.Label) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSVersionProperties. +func (o *OSVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "family": + err = unpopulate(val, "Family", &o.Family) + delete(rawMsg, key) + case "familyLabel": + err = unpopulate(val, "FamilyLabel", &o.FamilyLabel) + delete(rawMsg, key) + case "isActive": + err = unpopulate(val, "IsActive", &o.IsActive) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, "IsDefault", &o.IsDefault) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &o.Label) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSVersionPropertiesBase. +func (o OSVersionPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isActive", o.IsActive) + populate(objectMap, "isDefault", o.IsDefault) + populate(objectMap, "label", o.Label) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSVersionPropertiesBase. +func (o *OSVersionPropertiesBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isActive": + err = unpopulate(val, "IsActive", &o.IsActive) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, "IsDefault", &o.IsDefault) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &o.Label) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationValue. +func (o OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationValue. +func (o *OperationValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationValueDisplay. +func (o OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationValueDisplay. +func (o *OperationValueDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrchestrationServiceStateInput. +func (o OrchestrationServiceStateInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", o.Action) + populate(objectMap, "serviceName", o.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrchestrationServiceStateInput. +func (o *OrchestrationServiceStateInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &o.Action) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &o.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrchestrationServiceSummary. +func (o OrchestrationServiceSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceName", o.ServiceName) + populate(objectMap, "serviceState", o.ServiceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrchestrationServiceSummary. +func (o *OrchestrationServiceSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceName": + err = unpopulate(val, "ServiceName", &o.ServiceName) + delete(rawMsg, key) + case "serviceState": + err = unpopulate(val, "ServiceState", &o.ServiceState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchInstallationDetail. +func (p PatchInstallationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classifications", p.Classifications) + populate(objectMap, "installationState", p.InstallationState) + populate(objectMap, "kbId", p.KbID) + populate(objectMap, "name", p.Name) + populate(objectMap, "patchId", p.PatchID) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchInstallationDetail. +func (p *PatchInstallationDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classifications": + err = unpopulate(val, "Classifications", &p.Classifications) + delete(rawMsg, key) + case "installationState": + err = unpopulate(val, "InstallationState", &p.InstallationState) + delete(rawMsg, key) + case "kbId": + err = unpopulate(val, "KbID", &p.KbID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "patchId": + err = unpopulate(val, "PatchID", &p.PatchID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchSettings. +func (p PatchSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentMode", p.AssessmentMode) + populate(objectMap, "automaticByPlatformSettings", p.AutomaticByPlatformSettings) + populate(objectMap, "enableHotpatching", p.EnableHotpatching) + populate(objectMap, "patchMode", p.PatchMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettings. +func (p *PatchSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentMode": + err = unpopulate(val, "AssessmentMode", &p.AssessmentMode) + delete(rawMsg, key) + case "automaticByPlatformSettings": + err = unpopulate(val, "AutomaticByPlatformSettings", &p.AutomaticByPlatformSettings) + delete(rawMsg, key) + case "enableHotpatching": + err = unpopulate(val, "EnableHotpatching", &p.EnableHotpatching) + delete(rawMsg, key) + case "patchMode": + err = unpopulate(val, "PatchMode", &p.PatchMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PirCommunityGalleryResource. +func (p PirCommunityGalleryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", p.Identifier) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PirCommunityGalleryResource. +func (p *PirCommunityGalleryResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &p.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PirResource. +func (p PirResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PirResource. +func (p *PirResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PirSharedGalleryResource. +func (p PirSharedGalleryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", p.Identifier) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PirSharedGalleryResource. +func (p *PirSharedGalleryResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &p.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Plan. +func (p Plan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "product", p.Product) + populate(objectMap, "promotionCode", p.PromotionCode) + populate(objectMap, "publisher", p.Publisher) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Plan. +func (p *Plan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &p.Product) + delete(rawMsg, key) + case "promotionCode": + err = unpopulate(val, "PromotionCode", &p.PromotionCode) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &p.Publisher) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyViolation. +func (p PolicyViolation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", p.Category) + populate(objectMap, "details", p.Details) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyViolation. +func (p *PolicyViolation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &p.Category) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &p.Details) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PriorityMixPolicy. +func (p PriorityMixPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseRegularPriorityCount", p.BaseRegularPriorityCount) + populate(objectMap, "regularPriorityPercentageAboveBase", p.RegularPriorityPercentageAboveBase) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PriorityMixPolicy. +func (p *PriorityMixPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseRegularPriorityCount": + err = unpopulate(val, "BaseRegularPriorityCount", &p.BaseRegularPriorityCount) + delete(rawMsg, key) + case "regularPriorityPercentageAboveBase": + err = unpopulate(val, "RegularPriorityPercentageAboveBase", &p.RegularPriorityPercentageAboveBase) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyUpdatesInProgress. +func (p PropertyUpdatesInProgress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targetTier", p.TargetTier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyUpdatesInProgress. +func (p *PropertyUpdatesInProgress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetTier": + err = unpopulate(val, "TargetTier", &p.TargetTier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProximityPlacementGroup. +func (p ProximityPlacementGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + populate(objectMap, "zones", p.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProximityPlacementGroup. +func (p *ProximityPlacementGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &p.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProximityPlacementGroupListResult. +func (p ProximityPlacementGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProximityPlacementGroupListResult. +func (p *ProximityPlacementGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProximityPlacementGroupProperties. +func (p ProximityPlacementGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilitySets", p.AvailabilitySets) + populate(objectMap, "colocationStatus", p.ColocationStatus) + populate(objectMap, "intent", p.Intent) + populate(objectMap, "proximityPlacementGroupType", p.ProximityPlacementGroupType) + populate(objectMap, "virtualMachineScaleSets", p.VirtualMachineScaleSets) + populate(objectMap, "virtualMachines", p.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProximityPlacementGroupProperties. +func (p *ProximityPlacementGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilitySets": + err = unpopulate(val, "AvailabilitySets", &p.AvailabilitySets) + delete(rawMsg, key) + case "colocationStatus": + err = unpopulate(val, "ColocationStatus", &p.ColocationStatus) + delete(rawMsg, key) + case "intent": + err = unpopulate(val, "Intent", &p.Intent) + delete(rawMsg, key) + case "proximityPlacementGroupType": + err = unpopulate(val, "ProximityPlacementGroupType", &p.ProximityPlacementGroupType) + delete(rawMsg, key) + case "virtualMachineScaleSets": + err = unpopulate(val, "VirtualMachineScaleSets", &p.VirtualMachineScaleSets) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &p.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProximityPlacementGroupPropertiesIntent. +func (p ProximityPlacementGroupPropertiesIntent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmSizes", p.VMSizes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProximityPlacementGroupPropertiesIntent. +func (p *ProximityPlacementGroupPropertiesIntent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmSizes": + err = unpopulate(val, "VMSizes", &p.VMSizes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProximityPlacementGroupUpdate. +func (p ProximityPlacementGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProximityPlacementGroupUpdate. +func (p *ProximityPlacementGroupUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyOnlyResource. +func (p ProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyOnlyResource. +func (p *ProxyOnlyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressSKU. +func (p PublicIPAddressSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "tier", p.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressSKU. +func (p *PublicIPAddressSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PurchasePlan. +func (p PurchasePlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "product", p.Product) + populate(objectMap, "publisher", p.Publisher) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurchasePlan. +func (p *PurchasePlan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &p.Product) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &p.Publisher) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedMachineConfiguration. +func (r RecommendedMachineConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "memory", r.Memory) + populate(objectMap, "vCPUs", r.VCPUs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedMachineConfiguration. +func (r *RecommendedMachineConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "memory": + err = unpopulate(val, "Memory", &r.Memory) + delete(rawMsg, key) + case "vCPUs": + err = unpopulate(val, "VCPUs", &r.VCPUs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecoveryWalkResponse. +func (r RecoveryWalkResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextPlatformUpdateDomain", r.NextPlatformUpdateDomain) + populate(objectMap, "walkPerformed", r.WalkPerformed) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryWalkResponse. +func (r *RecoveryWalkResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextPlatformUpdateDomain": + err = unpopulate(val, "NextPlatformUpdateDomain", &r.NextPlatformUpdateDomain) + delete(rawMsg, key) + case "walkPerformed": + err = unpopulate(val, "WalkPerformed", &r.WalkPerformed) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionalReplicationStatus. +func (r RegionalReplicationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "details", r.Details) + populate(objectMap, "progress", r.Progress) + populate(objectMap, "region", r.Region) + populate(objectMap, "state", r.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionalReplicationStatus. +func (r *RegionalReplicationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "details": + err = unpopulate(val, "Details", &r.Details) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, "Progress", &r.Progress) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &r.Region) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionalSharingStatus. +func (r RegionalSharingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "details", r.Details) + populate(objectMap, "region", r.Region) + populate(objectMap, "state", r.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionalSharingStatus. +func (r *RegionalSharingStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "details": + err = unpopulate(val, "Details", &r.Details) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &r.Region) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicationStatus. +func (r ReplicationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregatedState", r.AggregatedState) + populate(objectMap, "summary", r.Summary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationStatus. +func (r *ReplicationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregatedState": + err = unpopulate(val, "AggregatedState", &r.AggregatedState) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &r.Summary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestRateByIntervalInput. +func (r RequestRateByIntervalInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobContainerSasUri", r.BlobContainerSasURI) + populateTimeRFC3339(objectMap, "fromTime", r.FromTime) + populate(objectMap, "groupByClientApplicationId", r.GroupByClientApplicationID) + populate(objectMap, "groupByOperationName", r.GroupByOperationName) + populate(objectMap, "groupByResourceName", r.GroupByResourceName) + populate(objectMap, "groupByThrottlePolicy", r.GroupByThrottlePolicy) + populate(objectMap, "groupByUserAgent", r.GroupByUserAgent) + populate(objectMap, "intervalLength", r.IntervalLength) + populateTimeRFC3339(objectMap, "toTime", r.ToTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestRateByIntervalInput. +func (r *RequestRateByIntervalInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobContainerSasUri": + err = unpopulate(val, "BlobContainerSasURI", &r.BlobContainerSasURI) + delete(rawMsg, key) + case "fromTime": + err = unpopulateTimeRFC3339(val, "FromTime", &r.FromTime) + delete(rawMsg, key) + case "groupByClientApplicationId": + err = unpopulate(val, "GroupByClientApplicationID", &r.GroupByClientApplicationID) + delete(rawMsg, key) + case "groupByOperationName": + err = unpopulate(val, "GroupByOperationName", &r.GroupByOperationName) + delete(rawMsg, key) + case "groupByResourceName": + err = unpopulate(val, "GroupByResourceName", &r.GroupByResourceName) + delete(rawMsg, key) + case "groupByThrottlePolicy": + err = unpopulate(val, "GroupByThrottlePolicy", &r.GroupByThrottlePolicy) + delete(rawMsg, key) + case "groupByUserAgent": + err = unpopulate(val, "GroupByUserAgent", &r.GroupByUserAgent) + delete(rawMsg, key) + case "intervalLength": + err = unpopulate(val, "IntervalLength", &r.IntervalLength) + delete(rawMsg, key) + case "toTime": + err = unpopulateTimeRFC3339(val, "ToTime", &r.ToTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceInstanceViewStatus. +func (r ResourceInstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", r.Code) + populate(objectMap, "displayStatus", r.DisplayStatus) + populate(objectMap, "level", r.Level) + populate(objectMap, "message", r.Message) + populateTimeRFC3339(objectMap, "time", r.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceInstanceViewStatus. +func (r *ResourceInstanceViewStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &r.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &r.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &r.Time) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceRange. +func (r ResourceRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "max", r.Max) + populate(objectMap, "min", r.Min) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRange. +func (r *ResourceRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "max": + err = unpopulate(val, "Max", &r.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &r.Min) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. +func (r ResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiVersions", r.APIVersions) + populate(objectMap, "capabilities", r.Capabilities) + populate(objectMap, "capacity", r.Capacity) + populate(objectMap, "costs", r.Costs) + populate(objectMap, "family", r.Family) + populate(objectMap, "kind", r.Kind) + populate(objectMap, "locationInfo", r.LocationInfo) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "restrictions", r.Restrictions) + populate(objectMap, "size", r.Size) + populate(objectMap, "tier", r.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. +func (r *ResourceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiVersions": + err = unpopulate(val, "APIVersions", &r.APIVersions) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &r.Capabilities) + delete(rawMsg, key) + case "capacity": + err = unpopulate(val, "Capacity", &r.Capacity) + delete(rawMsg, key) + case "costs": + err = unpopulate(val, "Costs", &r.Costs) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &r.Family) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "locationInfo": + err = unpopulate(val, "LocationInfo", &r.LocationInfo) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &r.Restrictions) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &r.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &r.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUCapabilities. +func (r ResourceSKUCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUCapabilities. +func (r *ResourceSKUCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUCapacity. +func (r ResourceSKUCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "default", r.Default) + populate(objectMap, "maximum", r.Maximum) + populate(objectMap, "minimum", r.Minimum) + populate(objectMap, "scaleType", r.ScaleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUCapacity. +func (r *ResourceSKUCapacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &r.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &r.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &r.Minimum) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &r.ScaleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUCosts. +func (r ResourceSKUCosts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedUnit", r.ExtendedUnit) + populate(objectMap, "meterID", r.MeterID) + populate(objectMap, "quantity", r.Quantity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUCosts. +func (r *ResourceSKUCosts) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedUnit": + err = unpopulate(val, "ExtendedUnit", &r.ExtendedUnit) + delete(rawMsg, key) + case "meterID": + err = unpopulate(val, "MeterID", &r.MeterID) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. +func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocations", r.ExtendedLocations) + populate(objectMap, "location", r.Location) + populate(objectMap, "type", r.Type) + populate(objectMap, "zoneDetails", r.ZoneDetails) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKULocationInfo. +func (r *ResourceSKULocationInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocations": + err = unpopulate(val, "ExtendedLocations", &r.ExtendedLocations) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "zoneDetails": + err = unpopulate(val, "ZoneDetails", &r.ZoneDetails) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &r.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKURestrictionInfo. +func (r ResourceSKURestrictionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKURestrictionInfo. +func (r *ResourceSKURestrictionInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &r.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKURestrictions. +func (r ResourceSKURestrictions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reasonCode", r.ReasonCode) + populate(objectMap, "restrictionInfo", r.RestrictionInfo) + populate(objectMap, "type", r.Type) + populate(objectMap, "values", r.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKURestrictions. +func (r *ResourceSKURestrictions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reasonCode": + err = unpopulate(val, "ReasonCode", &r.ReasonCode) + delete(rawMsg, key) + case "restrictionInfo": + err = unpopulate(val, "RestrictionInfo", &r.RestrictionInfo) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &r.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUZoneDetails. +func (r ResourceSKUZoneDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capabilities", r.Capabilities) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUZoneDetails. +func (r *ResourceSKUZoneDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &r.Capabilities) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUsResult. +func (r ResourceSKUsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUsResult. +func (r *ResourceSKUsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceURIList. +func (r ResourceURIList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceURIList. +func (r *ResourceURIList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceWithOptionalLocation. +func (r ResourceWithOptionalLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceWithOptionalLocation. +func (r *ResourceWithOptionalLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePoint. +func (r RestorePoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePoint. +func (r *RestorePoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointCollection. +func (r RestorePointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointCollection. +func (r *RestorePointCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointCollectionListResult. +func (r RestorePointCollectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointCollectionListResult. +func (r *RestorePointCollectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointCollectionProperties. +func (r RestorePointCollectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "restorePointCollectionId", r.RestorePointCollectionID) + populate(objectMap, "restorePoints", r.RestorePoints) + populate(objectMap, "source", r.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointCollectionProperties. +func (r *RestorePointCollectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "restorePointCollectionId": + err = unpopulate(val, "RestorePointCollectionID", &r.RestorePointCollectionID) + delete(rawMsg, key) + case "restorePoints": + err = unpopulate(val, "RestorePoints", &r.RestorePoints) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointCollectionSourceProperties. +func (r RestorePointCollectionSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointCollectionSourceProperties. +func (r *RestorePointCollectionSourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointCollectionUpdate. +func (r RestorePointCollectionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointCollectionUpdate. +func (r *RestorePointCollectionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointInstanceView. +func (r RestorePointInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskRestorePoints", r.DiskRestorePoints) + populate(objectMap, "statuses", r.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointInstanceView. +func (r *RestorePointInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskRestorePoints": + err = unpopulate(val, "DiskRestorePoints", &r.DiskRestorePoints) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &r.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointProperties. +func (r RestorePointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consistencyMode", r.ConsistencyMode) + populate(objectMap, "excludeDisks", r.ExcludeDisks) + populate(objectMap, "instanceView", r.InstanceView) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "sourceMetadata", r.SourceMetadata) + populate(objectMap, "sourceRestorePoint", r.SourceRestorePoint) + populateTimeRFC3339(objectMap, "timeCreated", r.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointProperties. +func (r *RestorePointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consistencyMode": + err = unpopulate(val, "ConsistencyMode", &r.ConsistencyMode) + delete(rawMsg, key) + case "excludeDisks": + err = unpopulate(val, "ExcludeDisks", &r.ExcludeDisks) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &r.InstanceView) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "sourceMetadata": + err = unpopulate(val, "SourceMetadata", &r.SourceMetadata) + delete(rawMsg, key) + case "sourceRestorePoint": + err = unpopulate(val, "SourceRestorePoint", &r.SourceRestorePoint) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &r.TimeCreated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointSourceMetadata. +func (r RestorePointSourceMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diagnosticsProfile", r.DiagnosticsProfile) + populate(objectMap, "hardwareProfile", r.HardwareProfile) + populate(objectMap, "licenseType", r.LicenseType) + populate(objectMap, "location", r.Location) + populate(objectMap, "osProfile", r.OSProfile) + populate(objectMap, "securityProfile", r.SecurityProfile) + populate(objectMap, "storageProfile", r.StorageProfile) + populate(objectMap, "vmId", r.VMID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointSourceMetadata. +func (r *RestorePointSourceMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &r.DiagnosticsProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &r.HardwareProfile) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &r.LicenseType) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &r.OSProfile) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &r.SecurityProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &r.StorageProfile) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &r.VMID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointSourceVMDataDisk. +func (r RestorePointSourceVMDataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", r.Caching) + populate(objectMap, "diskRestorePoint", r.DiskRestorePoint) + populate(objectMap, "diskSizeGB", r.DiskSizeGB) + populate(objectMap, "lun", r.Lun) + populate(objectMap, "managedDisk", r.ManagedDisk) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointSourceVMDataDisk. +func (r *RestorePointSourceVMDataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &r.Caching) + delete(rawMsg, key) + case "diskRestorePoint": + err = unpopulate(val, "DiskRestorePoint", &r.DiskRestorePoint) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &r.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &r.Lun) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &r.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointSourceVMOSDisk. +func (r RestorePointSourceVMOSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", r.Caching) + populate(objectMap, "diskRestorePoint", r.DiskRestorePoint) + populate(objectMap, "diskSizeGB", r.DiskSizeGB) + populate(objectMap, "encryptionSettings", r.EncryptionSettings) + populate(objectMap, "managedDisk", r.ManagedDisk) + populate(objectMap, "name", r.Name) + populate(objectMap, "osType", r.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointSourceVMOSDisk. +func (r *RestorePointSourceVMOSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &r.Caching) + delete(rawMsg, key) + case "diskRestorePoint": + err = unpopulate(val, "DiskRestorePoint", &r.DiskRestorePoint) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &r.DiskSizeGB) + delete(rawMsg, key) + case "encryptionSettings": + err = unpopulate(val, "EncryptionSettings", &r.EncryptionSettings) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &r.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &r.OSType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointSourceVMStorageProfile. +func (r RestorePointSourceVMStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", r.DataDisks) + populate(objectMap, "osDisk", r.OSDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointSourceVMStorageProfile. +func (r *RestorePointSourceVMStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &r.DataDisks) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &r.OSDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetrieveBootDiagnosticsDataResult. +func (r RetrieveBootDiagnosticsDataResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consoleScreenshotBlobUri", r.ConsoleScreenshotBlobURI) + populate(objectMap, "serialConsoleLogBlobUri", r.SerialConsoleLogBlobURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetrieveBootDiagnosticsDataResult. +func (r *RetrieveBootDiagnosticsDataResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consoleScreenshotBlobUri": + err = unpopulate(val, "ConsoleScreenshotBlobURI", &r.ConsoleScreenshotBlobURI) + delete(rawMsg, key) + case "serialConsoleLogBlobUri": + err = unpopulate(val, "SerialConsoleLogBlobURI", &r.SerialConsoleLogBlobURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstance. +func (r RoleInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstance. +func (r *RoleInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstanceListResult. +func (r RoleInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstanceListResult. +func (r *RoleInstanceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstanceNetworkProfile. +func (r RoleInstanceNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaces", r.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstanceNetworkProfile. +func (r *RoleInstanceNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &r.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstanceProperties. +func (r RoleInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceView", r.InstanceView) + populate(objectMap, "networkProfile", r.NetworkProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstanceProperties. +func (r *RoleInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceView": + err = unpopulate(val, "InstanceView", &r.InstanceView) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &r.NetworkProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstanceView. +func (r RoleInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "platformFaultDomain", r.PlatformFaultDomain) + populate(objectMap, "platformUpdateDomain", r.PlatformUpdateDomain) + populate(objectMap, "privateId", r.PrivateID) + populate(objectMap, "statuses", r.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstanceView. +func (r *RoleInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "platformFaultDomain": + err = unpopulate(val, "PlatformFaultDomain", &r.PlatformFaultDomain) + delete(rawMsg, key) + case "platformUpdateDomain": + err = unpopulate(val, "PlatformUpdateDomain", &r.PlatformUpdateDomain) + delete(rawMsg, key) + case "privateId": + err = unpopulate(val, "PrivateID", &r.PrivateID) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &r.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleInstances. +func (r RoleInstances) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "roleInstances", r.RoleInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleInstances. +func (r *RoleInstances) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roleInstances": + err = unpopulate(val, "RoleInstances", &r.RoleInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollbackStatusInfo. +func (r RollbackStatusInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failedRolledbackInstanceCount", r.FailedRolledbackInstanceCount) + populate(objectMap, "rollbackError", r.RollbackError) + populate(objectMap, "successfullyRolledbackInstanceCount", r.SuccessfullyRolledbackInstanceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollbackStatusInfo. +func (r *RollbackStatusInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "failedRolledbackInstanceCount": + err = unpopulate(val, "FailedRolledbackInstanceCount", &r.FailedRolledbackInstanceCount) + delete(rawMsg, key) + case "rollbackError": + err = unpopulate(val, "RollbackError", &r.RollbackError) + delete(rawMsg, key) + case "successfullyRolledbackInstanceCount": + err = unpopulate(val, "SuccessfullyRolledbackInstanceCount", &r.SuccessfullyRolledbackInstanceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollingUpgradePolicy. +func (r RollingUpgradePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableCrossZoneUpgrade", r.EnableCrossZoneUpgrade) + populate(objectMap, "maxBatchInstancePercent", r.MaxBatchInstancePercent) + populate(objectMap, "maxUnhealthyInstancePercent", r.MaxUnhealthyInstancePercent) + populate(objectMap, "maxUnhealthyUpgradedInstancePercent", r.MaxUnhealthyUpgradedInstancePercent) + populate(objectMap, "pauseTimeBetweenBatches", r.PauseTimeBetweenBatches) + populate(objectMap, "prioritizeUnhealthyInstances", r.PrioritizeUnhealthyInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradePolicy. +func (r *RollingUpgradePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableCrossZoneUpgrade": + err = unpopulate(val, "EnableCrossZoneUpgrade", &r.EnableCrossZoneUpgrade) + delete(rawMsg, key) + case "maxBatchInstancePercent": + err = unpopulate(val, "MaxBatchInstancePercent", &r.MaxBatchInstancePercent) + delete(rawMsg, key) + case "maxUnhealthyInstancePercent": + err = unpopulate(val, "MaxUnhealthyInstancePercent", &r.MaxUnhealthyInstancePercent) + delete(rawMsg, key) + case "maxUnhealthyUpgradedInstancePercent": + err = unpopulate(val, "MaxUnhealthyUpgradedInstancePercent", &r.MaxUnhealthyUpgradedInstancePercent) + delete(rawMsg, key) + case "pauseTimeBetweenBatches": + err = unpopulate(val, "PauseTimeBetweenBatches", &r.PauseTimeBetweenBatches) + delete(rawMsg, key) + case "prioritizeUnhealthyInstances": + err = unpopulate(val, "PrioritizeUnhealthyInstances", &r.PrioritizeUnhealthyInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollingUpgradeProgressInfo. +func (r RollingUpgradeProgressInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failedInstanceCount", r.FailedInstanceCount) + populate(objectMap, "inProgressInstanceCount", r.InProgressInstanceCount) + populate(objectMap, "pendingInstanceCount", r.PendingInstanceCount) + populate(objectMap, "successfulInstanceCount", r.SuccessfulInstanceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradeProgressInfo. +func (r *RollingUpgradeProgressInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "failedInstanceCount": + err = unpopulate(val, "FailedInstanceCount", &r.FailedInstanceCount) + delete(rawMsg, key) + case "inProgressInstanceCount": + err = unpopulate(val, "InProgressInstanceCount", &r.InProgressInstanceCount) + delete(rawMsg, key) + case "pendingInstanceCount": + err = unpopulate(val, "PendingInstanceCount", &r.PendingInstanceCount) + delete(rawMsg, key) + case "successfulInstanceCount": + err = unpopulate(val, "SuccessfulInstanceCount", &r.SuccessfulInstanceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollingUpgradeRunningStatus. +func (r RollingUpgradeRunningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", r.Code) + populate(objectMap, "lastAction", r.LastAction) + populateTimeRFC3339(objectMap, "lastActionTime", r.LastActionTime) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradeRunningStatus. +func (r *RollingUpgradeRunningStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "lastAction": + err = unpopulate(val, "LastAction", &r.LastAction) + delete(rawMsg, key) + case "lastActionTime": + err = unpopulateTimeRFC3339(val, "LastActionTime", &r.LastActionTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollingUpgradeStatusInfo. +func (r RollingUpgradeStatusInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradeStatusInfo. +func (r *RollingUpgradeStatusInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RollingUpgradeStatusInfoProperties. +func (r RollingUpgradeStatusInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", r.Error) + populate(objectMap, "policy", r.Policy) + populate(objectMap, "progress", r.Progress) + populate(objectMap, "runningStatus", r.RunningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradeStatusInfoProperties. +func (r *RollingUpgradeStatusInfoProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + case "policy": + err = unpopulate(val, "Policy", &r.Policy) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, "Progress", &r.Progress) + delete(rawMsg, key) + case "runningStatus": + err = unpopulate(val, "RunningStatus", &r.RunningStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandDocument. +func (r RunCommandDocument) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "id", r.ID) + populate(objectMap, "label", r.Label) + populate(objectMap, "osType", r.OSType) + populate(objectMap, "parameters", r.Parameters) + populate(objectMap, "$schema", r.Schema) + populate(objectMap, "script", r.Script) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandDocument. +func (r *RunCommandDocument) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &r.Label) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &r.OSType) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &r.Parameters) + delete(rawMsg, key) + case "$schema": + err = unpopulate(val, "Schema", &r.Schema) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &r.Script) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandDocumentBase. +func (r RunCommandDocumentBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "id", r.ID) + populate(objectMap, "label", r.Label) + populate(objectMap, "osType", r.OSType) + populate(objectMap, "$schema", r.Schema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandDocumentBase. +func (r *RunCommandDocumentBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &r.Label) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &r.OSType) + delete(rawMsg, key) + case "$schema": + err = unpopulate(val, "Schema", &r.Schema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandInput. +func (r RunCommandInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commandId", r.CommandID) + populate(objectMap, "parameters", r.Parameters) + populate(objectMap, "script", r.Script) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandInput. +func (r *RunCommandInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commandId": + err = unpopulate(val, "CommandID", &r.CommandID) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &r.Parameters) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &r.Script) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandInputParameter. +func (r RunCommandInputParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandInputParameter. +func (r *RunCommandInputParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandListResult. +func (r RunCommandListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandListResult. +func (r *RunCommandListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandParameterDefinition. +func (r RunCommandParameterDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultValue", r.DefaultValue) + populate(objectMap, "name", r.Name) + populate(objectMap, "required", r.Required) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandParameterDefinition. +func (r *RunCommandParameterDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultValue": + err = unpopulate(val, "DefaultValue", &r.DefaultValue) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "required": + err = unpopulate(val, "Required", &r.Required) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandResult. +func (r RunCommandResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandResult. +func (r *RunCommandResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. +func (s SSHConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicKeys", s.PublicKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. +func (s *SSHConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicKeys": + err = unpopulate(val, "PublicKeys", &s.PublicKeys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKey. +func (s SSHPublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyData", s.KeyData) + populate(objectMap, "path", s.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. +func (s *SSHPublicKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyData": + err = unpopulate(val, "KeyData", &s.KeyData) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKeyGenerateKeyPairResult. +func (s SSHPublicKeyGenerateKeyPairResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "privateKey", s.PrivateKey) + populate(objectMap, "publicKey", s.PublicKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKeyGenerateKeyPairResult. +func (s *SSHPublicKeyGenerateKeyPairResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "privateKey": + err = unpopulate(val, "PrivateKey", &s.PrivateKey) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &s.PublicKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKeyResource. +func (s SSHPublicKeyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKeyResource. +func (s *SSHPublicKeyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKeyResourceProperties. +func (s SSHPublicKeyResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicKey", s.PublicKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKeyResourceProperties. +func (s *SSHPublicKeyResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicKey": + err = unpopulate(val, "PublicKey", &s.PublicKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKeyUpdateResource. +func (s SSHPublicKeyUpdateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKeyUpdateResource. +func (s *SSHPublicKeyUpdateResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSHPublicKeysGroupListResult. +func (s SSHPublicKeysGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKeysGroupListResult. +func (s *SSHPublicKeysGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleInPolicy. +func (s ScaleInPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "forceDeletion", s.ForceDeletion) + populate(objectMap, "rules", s.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleInPolicy. +func (s *ScaleInPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "forceDeletion": + err = unpopulate(val, "ForceDeletion", &s.ForceDeletion) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &s.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledEventsProfile. +func (s ScheduledEventsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "terminateNotificationProfile", s.TerminateNotificationProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledEventsProfile. +func (s *ScheduledEventsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "terminateNotificationProfile": + err = unpopulate(val, "TerminateNotificationProfile", &s.TerminateNotificationProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityProfile. +func (s SecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionAtHost", s.EncryptionAtHost) + populate(objectMap, "securityType", s.SecurityType) + populate(objectMap, "uefiSettings", s.UefiSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityProfile. +func (s *SecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryptionAtHost": + err = unpopulate(val, "EncryptionAtHost", &s.EncryptionAtHost) + delete(rawMsg, key) + case "securityType": + err = unpopulate(val, "SecurityType", &s.SecurityType) + delete(rawMsg, key) + case "uefiSettings": + err = unpopulate(val, "UefiSettings", &s.UefiSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ShareInfoElement. +func (s ShareInfoElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmUri", s.VMURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShareInfoElement. +func (s *ShareInfoElement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmUri": + err = unpopulate(val, "VMURI", &s.VMURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGallery. +func (s SharedGallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", s.Identifier) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGallery. +func (s *SharedGallery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &s.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryDataDiskImage. +func (s SharedGalleryDataDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskSizeGB", s.DiskSizeGB) + populate(objectMap, "hostCaching", s.HostCaching) + populate(objectMap, "lun", s.Lun) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryDataDiskImage. +func (s *SharedGalleryDataDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &s.DiskSizeGB) + delete(rawMsg, key) + case "hostCaching": + err = unpopulate(val, "HostCaching", &s.HostCaching) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &s.Lun) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryDiskImage. +func (s SharedGalleryDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskSizeGB", s.DiskSizeGB) + populate(objectMap, "hostCaching", s.HostCaching) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryDiskImage. +func (s *SharedGalleryDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &s.DiskSizeGB) + delete(rawMsg, key) + case "hostCaching": + err = unpopulate(val, "HostCaching", &s.HostCaching) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryIdentifier. +func (s SharedGalleryIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "uniqueId", s.UniqueID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryIdentifier. +func (s *SharedGalleryIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uniqueId": + err = unpopulate(val, "UniqueID", &s.UniqueID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImage. +func (s SharedGalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", s.Identifier) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImage. +func (s *SharedGalleryImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &s.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageList. +func (s SharedGalleryImageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageList. +func (s *SharedGalleryImageList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageProperties. +func (s SharedGalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", s.Architecture) + populate(objectMap, "disallowed", s.Disallowed) + populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) + populate(objectMap, "eula", s.Eula) + populate(objectMap, "features", s.Features) + populate(objectMap, "hyperVGeneration", s.HyperVGeneration) + populate(objectMap, "identifier", s.Identifier) + populate(objectMap, "osState", s.OSState) + populate(objectMap, "osType", s.OSType) + populate(objectMap, "privacyStatementUri", s.PrivacyStatementURI) + populate(objectMap, "purchasePlan", s.PurchasePlan) + populate(objectMap, "recommended", s.Recommended) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageProperties. +func (s *SharedGalleryImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &s.Architecture) + delete(rawMsg, key) + case "disallowed": + err = unpopulate(val, "Disallowed", &s.Disallowed) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &s.EndOfLifeDate) + delete(rawMsg, key) + case "eula": + err = unpopulate(val, "Eula", &s.Eula) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &s.Features) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &s.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &s.Identifier) + delete(rawMsg, key) + case "osState": + err = unpopulate(val, "OSState", &s.OSState) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &s.OSType) + delete(rawMsg, key) + case "privacyStatementUri": + err = unpopulate(val, "PrivacyStatementURI", &s.PrivacyStatementURI) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &s.PurchasePlan) + delete(rawMsg, key) + case "recommended": + err = unpopulate(val, "Recommended", &s.Recommended) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersion. +func (s SharedGalleryImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", s.Identifier) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageVersion. +func (s *SharedGalleryImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &s.Identifier) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersionList. +func (s SharedGalleryImageVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageVersionList. +func (s *SharedGalleryImageVersionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersionProperties. +func (s SharedGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) + populate(objectMap, "excludeFromLatest", s.ExcludeFromLatest) + populateTimeRFC3339(objectMap, "publishedDate", s.PublishedDate) + populate(objectMap, "storageProfile", s.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageVersionProperties. +func (s *SharedGalleryImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, "EndOfLifeDate", &s.EndOfLifeDate) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &s.ExcludeFromLatest) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &s.PublishedDate) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &s.StorageProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersionStorageProfile. +func (s SharedGalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDiskImages", s.DataDiskImages) + populate(objectMap, "osDiskImage", s.OSDiskImage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryImageVersionStorageProfile. +func (s *SharedGalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDiskImages": + err = unpopulate(val, "DataDiskImages", &s.DataDiskImages) + delete(rawMsg, key) + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &s.OSDiskImage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryList. +func (s SharedGalleryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryList. +func (s *SharedGalleryList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedGalleryOSDiskImage. +func (s SharedGalleryOSDiskImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskSizeGB", s.DiskSizeGB) + populate(objectMap, "hostCaching", s.HostCaching) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedGalleryOSDiskImage. +func (s *SharedGalleryOSDiskImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &s.DiskSizeGB) + delete(rawMsg, key) + case "hostCaching": + err = unpopulate(val, "HostCaching", &s.HostCaching) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharingProfile. +func (s SharingProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityGalleryInfo", s.CommunityGalleryInfo) + populate(objectMap, "groups", s.Groups) + populate(objectMap, "permissions", s.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharingProfile. +func (s *SharingProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityGalleryInfo": + err = unpopulate(val, "CommunityGalleryInfo", &s.CommunityGalleryInfo) + delete(rawMsg, key) + case "groups": + err = unpopulate(val, "Groups", &s.Groups) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &s.Permissions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharingProfileGroup. +func (s SharingProfileGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ids", s.IDs) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharingProfileGroup. +func (s *SharingProfileGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ids": + err = unpopulate(val, "IDs", &s.IDs) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharingStatus. +func (s SharingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregatedState", s.AggregatedState) + populate(objectMap, "summary", s.Summary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharingStatus. +func (s *SharingStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregatedState": + err = unpopulate(val, "AggregatedState", &s.AggregatedState) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &s.Summary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharingUpdate. +func (s SharingUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groups", s.Groups) + populate(objectMap, "operationType", s.OperationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharingUpdate. +func (s *SharingUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groups": + err = unpopulate(val, "Groups", &s.Groups) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &s.OperationType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "managedBy", s.ManagedBy) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Snapshot. +func (s *Snapshot) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "managedBy": + err = unpopulate(val, "ManagedBy", &s.ManagedBy) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotList. +func (s SnapshotList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotList. +func (s *SnapshotList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "completionPercent", s.CompletionPercent) + populate(objectMap, "copyCompletionError", s.CopyCompletionError) + populate(objectMap, "creationData", s.CreationData) + populate(objectMap, "dataAccessAuthMode", s.DataAccessAuthMode) + populate(objectMap, "diskAccessId", s.DiskAccessID) + populate(objectMap, "diskSizeBytes", s.DiskSizeBytes) + populate(objectMap, "diskSizeGB", s.DiskSizeGB) + populate(objectMap, "diskState", s.DiskState) + populate(objectMap, "encryption", s.Encryption) + populate(objectMap, "encryptionSettingsCollection", s.EncryptionSettingsCollection) + populate(objectMap, "hyperVGeneration", s.HyperVGeneration) + populate(objectMap, "incremental", s.Incremental) + populate(objectMap, "incrementalSnapshotFamilyId", s.IncrementalSnapshotFamilyID) + populate(objectMap, "networkAccessPolicy", s.NetworkAccessPolicy) + populate(objectMap, "osType", s.OSType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "purchasePlan", s.PurchasePlan) + populate(objectMap, "securityProfile", s.SecurityProfile) + populate(objectMap, "supportedCapabilities", s.SupportedCapabilities) + populate(objectMap, "supportsHibernation", s.SupportsHibernation) + populateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) + populate(objectMap, "uniqueId", s.UniqueID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties. +func (s *SnapshotProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "completionPercent": + err = unpopulate(val, "CompletionPercent", &s.CompletionPercent) + delete(rawMsg, key) + case "copyCompletionError": + err = unpopulate(val, "CopyCompletionError", &s.CopyCompletionError) + delete(rawMsg, key) + case "creationData": + err = unpopulate(val, "CreationData", &s.CreationData) + delete(rawMsg, key) + case "dataAccessAuthMode": + err = unpopulate(val, "DataAccessAuthMode", &s.DataAccessAuthMode) + delete(rawMsg, key) + case "diskAccessId": + err = unpopulate(val, "DiskAccessID", &s.DiskAccessID) + delete(rawMsg, key) + case "diskSizeBytes": + err = unpopulate(val, "DiskSizeBytes", &s.DiskSizeBytes) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &s.DiskSizeGB) + delete(rawMsg, key) + case "diskState": + err = unpopulate(val, "DiskState", &s.DiskState) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &s.Encryption) + delete(rawMsg, key) + case "encryptionSettingsCollection": + err = unpopulate(val, "EncryptionSettingsCollection", &s.EncryptionSettingsCollection) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &s.HyperVGeneration) + delete(rawMsg, key) + case "incremental": + err = unpopulate(val, "Incremental", &s.Incremental) + delete(rawMsg, key) + case "incrementalSnapshotFamilyId": + err = unpopulate(val, "IncrementalSnapshotFamilyID", &s.IncrementalSnapshotFamilyID) + delete(rawMsg, key) + case "networkAccessPolicy": + err = unpopulate(val, "NetworkAccessPolicy", &s.NetworkAccessPolicy) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &s.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, "PurchasePlan", &s.PurchasePlan) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &s.SecurityProfile) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &s.SupportedCapabilities) + delete(rawMsg, key) + case "supportsHibernation": + err = unpopulate(val, "SupportsHibernation", &s.SupportsHibernation) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &s.TimeCreated) + delete(rawMsg, key) + case "uniqueId": + err = unpopulate(val, "UniqueID", &s.UniqueID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotSKU. +func (s SnapshotSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotSKU. +func (s *SnapshotSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotUpdate. +func (s SnapshotUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotUpdate. +func (s *SnapshotUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SnapshotUpdateProperties. +func (s SnapshotUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataAccessAuthMode", s.DataAccessAuthMode) + populate(objectMap, "diskAccessId", s.DiskAccessID) + populate(objectMap, "diskSizeGB", s.DiskSizeGB) + populate(objectMap, "encryption", s.Encryption) + populate(objectMap, "encryptionSettingsCollection", s.EncryptionSettingsCollection) + populate(objectMap, "networkAccessPolicy", s.NetworkAccessPolicy) + populate(objectMap, "osType", s.OSType) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "supportedCapabilities", s.SupportedCapabilities) + populate(objectMap, "supportsHibernation", s.SupportsHibernation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotUpdateProperties. +func (s *SnapshotUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataAccessAuthMode": + err = unpopulate(val, "DataAccessAuthMode", &s.DataAccessAuthMode) + delete(rawMsg, key) + case "diskAccessId": + err = unpopulate(val, "DiskAccessID", &s.DiskAccessID) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &s.DiskSizeGB) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &s.Encryption) + delete(rawMsg, key) + case "encryptionSettingsCollection": + err = unpopulate(val, "EncryptionSettingsCollection", &s.EncryptionSettingsCollection) + delete(rawMsg, key) + case "networkAccessPolicy": + err = unpopulate(val, "NetworkAccessPolicy", &s.NetworkAccessPolicy) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &s.OSType) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &s.SupportedCapabilities) + delete(rawMsg, key) + case "supportsHibernation": + err = unpopulate(val, "SupportsHibernation", &s.SupportsHibernation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftDeletePolicy. +func (s SoftDeletePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isSoftDeleteEnabled", s.IsSoftDeleteEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeletePolicy. +func (s *SoftDeletePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isSoftDeleteEnabled": + err = unpopulate(val, "IsSoftDeleteEnabled", &s.IsSoftDeleteEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceVault. +func (s SourceVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceVault. +func (s *SourceVault) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpotRestorePolicy. +func (s SpotRestorePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "restoreTimeout", s.RestoreTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpotRestorePolicy. +func (s *SpotRestorePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + case "restoreTimeout": + err = unpopulate(val, "RestoreTimeout", &s.RestoreTimeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StatusCodeCount. +func (s StatusCodeCount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", s.Code) + populate(objectMap, "count", s.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StatusCodeCount. +func (s *StatusCodeCount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &s.Count) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", s.DataDisks) + populate(objectMap, "diskControllerType", s.DiskControllerType) + populate(objectMap, "imageReference", s.ImageReference) + populate(objectMap, "osDisk", s.OSDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. +func (s *StorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) + delete(rawMsg, key) + case "diskControllerType": + err = unpopulate(val, "DiskControllerType", &s.DiskControllerType) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &s.ImageReference) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &s.OSDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResourceReadOnly. +func (s SubResourceReadOnly) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResourceReadOnly. +func (s *SubResourceReadOnly) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResourceWithColocationStatus. +func (s SubResourceWithColocationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "colocationStatus", s.ColocationStatus) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResourceWithColocationStatus. +func (s *SubResourceWithColocationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "colocationStatus": + err = unpopulate(val, "ColocationStatus", &s.ColocationStatus) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SupportedCapabilities. +func (s SupportedCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acceleratedNetwork", s.AcceleratedNetwork) + populate(objectMap, "architecture", s.Architecture) + populate(objectMap, "diskControllerTypes", s.DiskControllerTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SupportedCapabilities. +func (s *SupportedCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "acceleratedNetwork": + err = unpopulate(val, "AcceleratedNetwork", &s.AcceleratedNetwork) + delete(rawMsg, key) + case "architecture": + err = unpopulate(val, "Architecture", &s.Architecture) + delete(rawMsg, key) + case "diskControllerTypes": + err = unpopulate(val, "DiskControllerTypes", &s.DiskControllerTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TargetRegion. +func (t TargetRegion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", t.Encryption) + populate(objectMap, "excludeFromLatest", t.ExcludeFromLatest) + populate(objectMap, "name", t.Name) + populate(objectMap, "regionalReplicaCount", t.RegionalReplicaCount) + populate(objectMap, "storageAccountType", t.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetRegion. +func (t *TargetRegion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encryption": + err = unpopulate(val, "Encryption", &t.Encryption) + delete(rawMsg, key) + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &t.ExcludeFromLatest) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "regionalReplicaCount": + err = unpopulate(val, "RegionalReplicaCount", &t.RegionalReplicaCount) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &t.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerminateNotificationProfile. +func (t TerminateNotificationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enable", t.Enable) + populate(objectMap, "notBeforeTimeout", t.NotBeforeTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerminateNotificationProfile. +func (t *TerminateNotificationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enable": + err = unpopulate(val, "Enable", &t.Enable) + delete(rawMsg, key) + case "notBeforeTimeout": + err = unpopulate(val, "NotBeforeTimeout", &t.NotBeforeTimeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThrottledRequestsInput. +func (t ThrottledRequestsInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobContainerSasUri", t.BlobContainerSasURI) + populateTimeRFC3339(objectMap, "fromTime", t.FromTime) + populate(objectMap, "groupByClientApplicationId", t.GroupByClientApplicationID) + populate(objectMap, "groupByOperationName", t.GroupByOperationName) + populate(objectMap, "groupByResourceName", t.GroupByResourceName) + populate(objectMap, "groupByThrottlePolicy", t.GroupByThrottlePolicy) + populate(objectMap, "groupByUserAgent", t.GroupByUserAgent) + populateTimeRFC3339(objectMap, "toTime", t.ToTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThrottledRequestsInput. +func (t *ThrottledRequestsInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobContainerSasUri": + err = unpopulate(val, "BlobContainerSasURI", &t.BlobContainerSasURI) + delete(rawMsg, key) + case "fromTime": + err = unpopulateTimeRFC3339(val, "FromTime", &t.FromTime) + delete(rawMsg, key) + case "groupByClientApplicationId": + err = unpopulate(val, "GroupByClientApplicationID", &t.GroupByClientApplicationID) + delete(rawMsg, key) + case "groupByOperationName": + err = unpopulate(val, "GroupByOperationName", &t.GroupByOperationName) + delete(rawMsg, key) + case "groupByResourceName": + err = unpopulate(val, "GroupByResourceName", &t.GroupByResourceName) + delete(rawMsg, key) + case "groupByThrottlePolicy": + err = unpopulate(val, "GroupByThrottlePolicy", &t.GroupByThrottlePolicy) + delete(rawMsg, key) + case "groupByUserAgent": + err = unpopulate(val, "GroupByUserAgent", &t.GroupByUserAgent) + delete(rawMsg, key) + case "toTime": + err = unpopulateTimeRFC3339(val, "ToTime", &t.ToTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UefiSettings. +func (u UefiSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secureBootEnabled", u.SecureBootEnabled) + populate(objectMap, "vTpmEnabled", u.VTpmEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UefiSettings. +func (u *UefiSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secureBootEnabled": + err = unpopulate(val, "SecureBootEnabled", &u.SecureBootEnabled) + delete(rawMsg, key) + case "vTpmEnabled": + err = unpopulate(val, "VTpmEnabled", &u.VTpmEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateDomain. +func (u UpdateDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + populate(objectMap, "name", u.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateDomain. +func (u *UpdateDomain) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateDomainListResult. +func (u UpdateDomainListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateDomainListResult. +func (u *UpdateDomainListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateResource. +func (u UpdateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateResource. +func (u *UpdateResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateResourceDefinition. +func (u UpdateResourceDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + populate(objectMap, "name", u.Name) + populate(objectMap, "tags", u.Tags) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateResourceDefinition. +func (u *UpdateResourceDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpgradeOperationHistoricalStatusInfo. +func (u UpgradeOperationHistoricalStatusInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", u.Location) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradeOperationHistoricalStatusInfo. +func (u *UpgradeOperationHistoricalStatusInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpgradeOperationHistoricalStatusInfoProperties. +func (u UpgradeOperationHistoricalStatusInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", u.Error) + populate(objectMap, "progress", u.Progress) + populate(objectMap, "rollbackInfo", u.RollbackInfo) + populate(objectMap, "runningStatus", u.RunningStatus) + populate(objectMap, "startedBy", u.StartedBy) + populate(objectMap, "targetImageReference", u.TargetImageReference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradeOperationHistoricalStatusInfoProperties. +func (u *UpgradeOperationHistoricalStatusInfoProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &u.Error) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, "Progress", &u.Progress) + delete(rawMsg, key) + case "rollbackInfo": + err = unpopulate(val, "RollbackInfo", &u.RollbackInfo) + delete(rawMsg, key) + case "runningStatus": + err = unpopulate(val, "RunningStatus", &u.RunningStatus) + delete(rawMsg, key) + case "startedBy": + err = unpopulate(val, "StartedBy", &u.StartedBy) + delete(rawMsg, key) + case "targetImageReference": + err = unpopulate(val, "TargetImageReference", &u.TargetImageReference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpgradeOperationHistoryStatus. +func (u UpgradeOperationHistoryStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", u.Code) + populateTimeRFC3339(objectMap, "endTime", u.EndTime) + populateTimeRFC3339(objectMap, "startTime", u.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradeOperationHistoryStatus. +func (u *UpgradeOperationHistoryStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &u.Code) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &u.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &u.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpgradePolicy. +func (u UpgradePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "automaticOSUpgradePolicy", u.AutomaticOSUpgradePolicy) + populate(objectMap, "mode", u.Mode) + populate(objectMap, "rollingUpgradePolicy", u.RollingUpgradePolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradePolicy. +func (u *UpgradePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "automaticOSUpgradePolicy": + err = unpopulate(val, "AutomaticOSUpgradePolicy", &u.AutomaticOSUpgradePolicy) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &u.Mode) + delete(rawMsg, key) + case "rollingUpgradePolicy": + err = unpopulate(val, "RollingUpgradePolicy", &u.RollingUpgradePolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + objectMap["unit"] = "Count" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. +func (u *Usage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", u.LocalizedValue) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageName. +func (u *UsageName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &u.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserArtifactManage. +func (u UserArtifactManage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "install", u.Install) + populate(objectMap, "remove", u.Remove) + populate(objectMap, "update", u.Update) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserArtifactManage. +func (u *UserArtifactManage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "install": + err = unpopulate(val, "Install", &u.Install) + delete(rawMsg, key) + case "remove": + err = unpopulate(val, "Remove", &u.Remove) + delete(rawMsg, key) + case "update": + err = unpopulate(val, "Update", &u.Update) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserArtifactSettings. +func (u UserArtifactSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configFileName", u.ConfigFileName) + populate(objectMap, "packageFileName", u.PackageFileName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserArtifactSettings. +func (u *UserArtifactSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configFileName": + err = unpopulate(val, "ConfigFileName", &u.ConfigFileName) + delete(rawMsg, key) + case "packageFileName": + err = unpopulate(val, "PackageFileName", &u.PackageFileName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserArtifactSource. +func (u UserArtifactSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultConfigurationLink", u.DefaultConfigurationLink) + populate(objectMap, "mediaLink", u.MediaLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserArtifactSource. +func (u *UserArtifactSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultConfigurationLink": + err = unpopulate(val, "DefaultConfigurationLink", &u.DefaultConfigurationLink) + delete(rawMsg, key) + case "mediaLink": + err = unpopulate(val, "MediaLink", &u.MediaLink) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentitiesValue. +func (u UserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentitiesValue. +func (u *UserAssignedIdentitiesValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMDiskSecurityProfile. +func (v VMDiskSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSet", v.DiskEncryptionSet) + populate(objectMap, "securityEncryptionType", v.SecurityEncryptionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMDiskSecurityProfile. +func (v *VMDiskSecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &v.DiskEncryptionSet) + delete(rawMsg, key) + case "securityEncryptionType": + err = unpopulate(val, "SecurityEncryptionType", &v.SecurityEncryptionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMGalleryApplication. +func (v VMGalleryApplication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationReference", v.ConfigurationReference) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "order", v.Order) + populate(objectMap, "packageReferenceId", v.PackageReferenceID) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "treatFailureAsDeploymentFailure", v.TreatFailureAsDeploymentFailure) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMGalleryApplication. +func (v *VMGalleryApplication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationReference": + err = unpopulate(val, "ConfigurationReference", &v.ConfigurationReference) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &v.Order) + delete(rawMsg, key) + case "packageReferenceId": + err = unpopulate(val, "PackageReferenceID", &v.PackageReferenceID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "treatFailureAsDeploymentFailure": + err = unpopulate(val, "TreatFailureAsDeploymentFailure", &v.TreatFailureAsDeploymentFailure) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMImagesInEdgeZoneListResult. +func (v VMImagesInEdgeZoneListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMImagesInEdgeZoneListResult. +func (v *VMImagesInEdgeZoneListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMScaleSetConvertToSinglePlacementGroupInput. +func (v VMScaleSetConvertToSinglePlacementGroupInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activePlacementGroupId", v.ActivePlacementGroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMScaleSetConvertToSinglePlacementGroupInput. +func (v *VMScaleSetConvertToSinglePlacementGroupInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activePlacementGroupId": + err = unpopulate(val, "ActivePlacementGroupID", &v.ActivePlacementGroupID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSizeProperties. +func (v VMSizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vCPUsAvailable", v.VCPUsAvailable) + populate(objectMap, "vCPUsPerCore", v.VCPUsPerCore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSizeProperties. +func (v *VMSizeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vCPUsAvailable": + err = unpopulate(val, "VCPUsAvailable", &v.VCPUsAvailable) + delete(rawMsg, key) + case "vCPUsPerCore": + err = unpopulate(val, "VCPUsPerCore", &v.VCPUsPerCore) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultCertificate. +func (v VaultCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateStore", v.CertificateStore) + populate(objectMap, "certificateUrl", v.CertificateURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultCertificate. +func (v *VaultCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateStore": + err = unpopulate(val, "CertificateStore", &v.CertificateStore) + delete(rawMsg, key) + case "certificateUrl": + err = unpopulate(val, "CertificateURL", &v.CertificateURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultSecretGroup. +func (v VaultSecretGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceVault", v.SourceVault) + populate(objectMap, "vaultCertificates", v.VaultCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultSecretGroup. +func (v *VaultSecretGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sourceVault": + err = unpopulate(val, "SourceVault", &v.SourceVault) + delete(rawMsg, key) + case "vaultCertificates": + err = unpopulate(val, "VaultCertificates", &v.VaultCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHardDisk. +func (v VirtualHardDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "uri", v.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHardDisk. +func (v *VirtualHardDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "uri": + err = unpopulate(val, "URI", &v.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachine. +func (v VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "plan", v.Plan) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "resources", v.Resources) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + populate(objectMap, "zones", v.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachine. +func (v *VirtualMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &v.Resources) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &v.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineAgentInstanceView. +func (v VirtualMachineAgentInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensionHandlers", v.ExtensionHandlers) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "vmAgentVersion", v.VMAgentVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineAgentInstanceView. +func (v *VirtualMachineAgentInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensionHandlers": + err = unpopulate(val, "ExtensionHandlers", &v.ExtensionHandlers) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "vmAgentVersion": + err = unpopulate(val, "VMAgentVersion", &v.VMAgentVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineAssessPatchesResult. +func (v VirtualMachineAssessPatchesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentActivityId", v.AssessmentActivityID) + populate(objectMap, "availablePatches", v.AvailablePatches) + populate(objectMap, "criticalAndSecurityPatchCount", v.CriticalAndSecurityPatchCount) + populate(objectMap, "error", v.Error) + populate(objectMap, "otherPatchCount", v.OtherPatchCount) + populate(objectMap, "rebootPending", v.RebootPending) + populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineAssessPatchesResult. +func (v *VirtualMachineAssessPatchesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentActivityId": + err = unpopulate(val, "AssessmentActivityID", &v.AssessmentActivityID) + delete(rawMsg, key) + case "availablePatches": + err = unpopulate(val, "AvailablePatches", &v.AvailablePatches) + delete(rawMsg, key) + case "criticalAndSecurityPatchCount": + err = unpopulate(val, "CriticalAndSecurityPatchCount", &v.CriticalAndSecurityPatchCount) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &v.Error) + delete(rawMsg, key) + case "otherPatchCount": + err = unpopulate(val, "OtherPatchCount", &v.OtherPatchCount) + delete(rawMsg, key) + case "rebootPending": + err = unpopulate(val, "RebootPending", &v.RebootPending) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateTimeRFC3339(val, "StartDateTime", &v.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineCaptureParameters. +func (v VirtualMachineCaptureParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationContainerName", v.DestinationContainerName) + populate(objectMap, "overwriteVhds", v.OverwriteVhds) + populate(objectMap, "vhdPrefix", v.VhdPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineCaptureParameters. +func (v *VirtualMachineCaptureParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationContainerName": + err = unpopulate(val, "DestinationContainerName", &v.DestinationContainerName) + delete(rawMsg, key) + case "overwriteVhds": + err = unpopulate(val, "OverwriteVhds", &v.OverwriteVhds) + delete(rawMsg, key) + case "vhdPrefix": + err = unpopulate(val, "VhdPrefix", &v.VhdPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineCaptureResult. +func (v VirtualMachineCaptureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentVersion", v.ContentVersion) + populate(objectMap, "id", v.ID) + populate(objectMap, "parameters", &v.Parameters) + populate(objectMap, "resources", v.Resources) + populate(objectMap, "$schema", v.Schema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineCaptureResult. +func (v *VirtualMachineCaptureResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentVersion": + err = unpopulate(val, "ContentVersion", &v.ContentVersion) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &v.Parameters) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &v.Resources) + delete(rawMsg, key) + case "$schema": + err = unpopulate(val, "Schema", &v.Schema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtension. +func (v VirtualMachineExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtension. +func (v *VirtualMachineExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionHandlerInstanceView. +func (v VirtualMachineExtensionHandlerInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", v.Status) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionHandlerInstanceView. +func (v *VirtualMachineExtensionHandlerInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionImage. +func (v VirtualMachineExtensionImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionImage. +func (v *VirtualMachineExtensionImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionImageProperties. +func (v VirtualMachineExtensionImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "computeRole", v.ComputeRole) + populate(objectMap, "handlerSchema", v.HandlerSchema) + populate(objectMap, "operatingSystem", v.OperatingSystem) + populate(objectMap, "supportsMultipleExtensions", v.SupportsMultipleExtensions) + populate(objectMap, "vmScaleSetEnabled", v.VMScaleSetEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionImageProperties. +func (v *VirtualMachineExtensionImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computeRole": + err = unpopulate(val, "ComputeRole", &v.ComputeRole) + delete(rawMsg, key) + case "handlerSchema": + err = unpopulate(val, "HandlerSchema", &v.HandlerSchema) + delete(rawMsg, key) + case "operatingSystem": + err = unpopulate(val, "OperatingSystem", &v.OperatingSystem) + delete(rawMsg, key) + case "supportsMultipleExtensions": + err = unpopulate(val, "SupportsMultipleExtensions", &v.SupportsMultipleExtensions) + delete(rawMsg, key) + case "vmScaleSetEnabled": + err = unpopulate(val, "VMScaleSetEnabled", &v.VMScaleSetEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionInstanceView. +func (v VirtualMachineExtensionInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "substatuses", v.Substatuses) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionInstanceView. +func (v *VirtualMachineExtensionInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "substatuses": + err = unpopulate(val, "Substatuses", &v.Substatuses) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionProperties. +func (v VirtualMachineExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "protectedSettings", &v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populate(objectMap, "settings", &v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionProperties. +func (v *VirtualMachineExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &v.ForceUpdateTag) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "suppressFailures": + err = unpopulate(val, "SuppressFailures", &v.SuppressFailures) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionUpdate. +func (v VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionUpdate. +func (v *VirtualMachineExtensionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionUpdateProperties. +func (v VirtualMachineExtensionUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populate(objectMap, "protectedSettings", &v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "publisher", v.Publisher) + populate(objectMap, "settings", &v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionUpdateProperties. +func (v *VirtualMachineExtensionUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &v.ForceUpdateTag) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "suppressFailures": + err = unpopulate(val, "SuppressFailures", &v.SuppressFailures) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineExtensionsListResult. +func (v VirtualMachineExtensionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineExtensionsListResult. +func (v *VirtualMachineExtensionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineHealthStatus. +func (v VirtualMachineHealthStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineHealthStatus. +func (v *VirtualMachineHealthStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineIPTag. +func (v VirtualMachineIPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipTagType", v.IPTagType) + populate(objectMap, "tag", v.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineIPTag. +func (v *VirtualMachineIPTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipTagType": + err = unpopulate(val, "IPTagType", &v.IPTagType) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &v.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineIdentity. +func (v VirtualMachineIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", v.PrincipalID) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "type", v.Type) + populate(objectMap, "userAssignedIdentities", v.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineIdentity. +func (v *VirtualMachineIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &v.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &v.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineImage. +func (v VirtualMachineImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineImage. +func (v *VirtualMachineImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineImageFeature. +func (v VirtualMachineImageFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineImageFeature. +func (v *VirtualMachineImageFeature) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineImageProperties. +func (v VirtualMachineImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "architecture", v.Architecture) + populate(objectMap, "automaticOSUpgradeProperties", v.AutomaticOSUpgradeProperties) + populate(objectMap, "dataDiskImages", v.DataDiskImages) + populate(objectMap, "disallowed", v.Disallowed) + populate(objectMap, "features", v.Features) + populate(objectMap, "hyperVGeneration", v.HyperVGeneration) + populate(objectMap, "osDiskImage", v.OSDiskImage) + populate(objectMap, "plan", v.Plan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineImageProperties. +func (v *VirtualMachineImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &v.Architecture) + delete(rawMsg, key) + case "automaticOSUpgradeProperties": + err = unpopulate(val, "AutomaticOSUpgradeProperties", &v.AutomaticOSUpgradeProperties) + delete(rawMsg, key) + case "dataDiskImages": + err = unpopulate(val, "DataDiskImages", &v.DataDiskImages) + delete(rawMsg, key) + case "disallowed": + err = unpopulate(val, "Disallowed", &v.Disallowed) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &v.Features) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &v.HyperVGeneration) + delete(rawMsg, key) + case "osDiskImage": + err = unpopulate(val, "OSDiskImage", &v.OSDiskImage) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineImageResource. +func (v VirtualMachineImageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineImageResource. +func (v *VirtualMachineImageResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstallPatchesParameters. +func (v VirtualMachineInstallPatchesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linuxParameters", v.LinuxParameters) + populate(objectMap, "maximumDuration", v.MaximumDuration) + populate(objectMap, "rebootSetting", v.RebootSetting) + populate(objectMap, "windowsParameters", v.WindowsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstallPatchesParameters. +func (v *VirtualMachineInstallPatchesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linuxParameters": + err = unpopulate(val, "LinuxParameters", &v.LinuxParameters) + delete(rawMsg, key) + case "maximumDuration": + err = unpopulate(val, "MaximumDuration", &v.MaximumDuration) + delete(rawMsg, key) + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &v.RebootSetting) + delete(rawMsg, key) + case "windowsParameters": + err = unpopulate(val, "WindowsParameters", &v.WindowsParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstallPatchesResult. +func (v VirtualMachineInstallPatchesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", v.Error) + populate(objectMap, "excludedPatchCount", v.ExcludedPatchCount) + populate(objectMap, "failedPatchCount", v.FailedPatchCount) + populate(objectMap, "installationActivityId", v.InstallationActivityID) + populate(objectMap, "installedPatchCount", v.InstalledPatchCount) + populate(objectMap, "maintenanceWindowExceeded", v.MaintenanceWindowExceeded) + populate(objectMap, "notSelectedPatchCount", v.NotSelectedPatchCount) + populate(objectMap, "patches", v.Patches) + populate(objectMap, "pendingPatchCount", v.PendingPatchCount) + populate(objectMap, "rebootStatus", v.RebootStatus) + populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstallPatchesResult. +func (v *VirtualMachineInstallPatchesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &v.Error) + delete(rawMsg, key) + case "excludedPatchCount": + err = unpopulate(val, "ExcludedPatchCount", &v.ExcludedPatchCount) + delete(rawMsg, key) + case "failedPatchCount": + err = unpopulate(val, "FailedPatchCount", &v.FailedPatchCount) + delete(rawMsg, key) + case "installationActivityId": + err = unpopulate(val, "InstallationActivityID", &v.InstallationActivityID) + delete(rawMsg, key) + case "installedPatchCount": + err = unpopulate(val, "InstalledPatchCount", &v.InstalledPatchCount) + delete(rawMsg, key) + case "maintenanceWindowExceeded": + err = unpopulate(val, "MaintenanceWindowExceeded", &v.MaintenanceWindowExceeded) + delete(rawMsg, key) + case "notSelectedPatchCount": + err = unpopulate(val, "NotSelectedPatchCount", &v.NotSelectedPatchCount) + delete(rawMsg, key) + case "patches": + err = unpopulate(val, "Patches", &v.Patches) + delete(rawMsg, key) + case "pendingPatchCount": + err = unpopulate(val, "PendingPatchCount", &v.PendingPatchCount) + delete(rawMsg, key) + case "rebootStatus": + err = unpopulate(val, "RebootStatus", &v.RebootStatus) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateTimeRFC3339(val, "StartDateTime", &v.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineInstanceView. +func (v VirtualMachineInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignedHost", v.AssignedHost) + populate(objectMap, "bootDiagnostics", v.BootDiagnostics) + populate(objectMap, "computerName", v.ComputerName) + populate(objectMap, "disks", v.Disks) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "hyperVGeneration", v.HyperVGeneration) + populate(objectMap, "maintenanceRedeployStatus", v.MaintenanceRedeployStatus) + populate(objectMap, "osName", v.OSName) + populate(objectMap, "osVersion", v.OSVersion) + populate(objectMap, "patchStatus", v.PatchStatus) + populate(objectMap, "platformFaultDomain", v.PlatformFaultDomain) + populate(objectMap, "platformUpdateDomain", v.PlatformUpdateDomain) + populate(objectMap, "rdpThumbPrint", v.RdpThumbPrint) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "vmAgent", v.VMAgent) + populate(objectMap, "vmHealth", v.VMHealth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineInstanceView. +func (v *VirtualMachineInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedHost": + err = unpopulate(val, "AssignedHost", &v.AssignedHost) + delete(rawMsg, key) + case "bootDiagnostics": + err = unpopulate(val, "BootDiagnostics", &v.BootDiagnostics) + delete(rawMsg, key) + case "computerName": + err = unpopulate(val, "ComputerName", &v.ComputerName) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &v.Disks) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, "HyperVGeneration", &v.HyperVGeneration) + delete(rawMsg, key) + case "maintenanceRedeployStatus": + err = unpopulate(val, "MaintenanceRedeployStatus", &v.MaintenanceRedeployStatus) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &v.OSName) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &v.OSVersion) + delete(rawMsg, key) + case "patchStatus": + err = unpopulate(val, "PatchStatus", &v.PatchStatus) + delete(rawMsg, key) + case "platformFaultDomain": + err = unpopulate(val, "PlatformFaultDomain", &v.PlatformFaultDomain) + delete(rawMsg, key) + case "platformUpdateDomain": + err = unpopulate(val, "PlatformUpdateDomain", &v.PlatformUpdateDomain) + delete(rawMsg, key) + case "rdpThumbPrint": + err = unpopulate(val, "RdpThumbPrint", &v.RdpThumbPrint) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "vmAgent": + err = unpopulate(val, "VMAgent", &v.VMAgent) + delete(rawMsg, key) + case "vmHealth": + err = unpopulate(val, "VMHealth", &v.VMHealth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineListResult. +func (v VirtualMachineListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineListResult. +func (v *VirtualMachineListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineNetworkInterfaceConfiguration. +func (v VirtualMachineNetworkInterfaceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineNetworkInterfaceConfiguration. +func (v *VirtualMachineNetworkInterfaceConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineNetworkInterfaceConfigurationProperties. +func (v VirtualMachineNetworkInterfaceConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "disableTcpStateTracking", v.DisableTCPStateTracking) + populate(objectMap, "dscpConfiguration", v.DscpConfiguration) + populate(objectMap, "enableAcceleratedNetworking", v.EnableAcceleratedNetworking) + populate(objectMap, "enableFpga", v.EnableFpga) + populate(objectMap, "enableIPForwarding", v.EnableIPForwarding) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "networkSecurityGroup", v.NetworkSecurityGroup) + populate(objectMap, "primary", v.Primary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineNetworkInterfaceConfigurationProperties. +func (v *VirtualMachineNetworkInterfaceConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "disableTcpStateTracking": + err = unpopulate(val, "DisableTCPStateTracking", &v.DisableTCPStateTracking) + delete(rawMsg, key) + case "dscpConfiguration": + err = unpopulate(val, "DscpConfiguration", &v.DscpConfiguration) + delete(rawMsg, key) + case "enableAcceleratedNetworking": + err = unpopulate(val, "EnableAcceleratedNetworking", &v.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "enableFpga": + err = unpopulate(val, "EnableFpga", &v.EnableFpga) + delete(rawMsg, key) + case "enableIPForwarding": + err = unpopulate(val, "EnableIPForwarding", &v.EnableIPForwarding) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &v.NetworkSecurityGroup) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineNetworkInterfaceDNSSettingsConfiguration. +func (v VirtualMachineNetworkInterfaceDNSSettingsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServers", v.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineNetworkInterfaceDNSSettingsConfiguration. +func (v *VirtualMachineNetworkInterfaceDNSSettingsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &v.DNSServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineNetworkInterfaceIPConfiguration. +func (v VirtualMachineNetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineNetworkInterfaceIPConfiguration. +func (v *VirtualMachineNetworkInterfaceIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineNetworkInterfaceIPConfigurationProperties. +func (v VirtualMachineNetworkInterfaceIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationGatewayBackendAddressPools", v.ApplicationGatewayBackendAddressPools) + populate(objectMap, "applicationSecurityGroups", v.ApplicationSecurityGroups) + populate(objectMap, "loadBalancerBackendAddressPools", v.LoadBalancerBackendAddressPools) + populate(objectMap, "primary", v.Primary) + populate(objectMap, "privateIPAddressVersion", v.PrivateIPAddressVersion) + populate(objectMap, "publicIPAddressConfiguration", v.PublicIPAddressConfiguration) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineNetworkInterfaceIPConfigurationProperties. +func (v *VirtualMachineNetworkInterfaceIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGatewayBackendAddressPools": + err = unpopulate(val, "ApplicationGatewayBackendAddressPools", &v.ApplicationGatewayBackendAddressPools) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &v.ApplicationSecurityGroups) + delete(rawMsg, key) + case "loadBalancerBackendAddressPools": + err = unpopulate(val, "LoadBalancerBackendAddressPools", &v.LoadBalancerBackendAddressPools) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &v.PrivateIPAddressVersion) + delete(rawMsg, key) + case "publicIPAddressConfiguration": + err = unpopulate(val, "PublicIPAddressConfiguration", &v.PublicIPAddressConfiguration) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachinePatchStatus. +func (v VirtualMachinePatchStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availablePatchSummary", v.AvailablePatchSummary) + populate(objectMap, "configurationStatuses", v.ConfigurationStatuses) + populate(objectMap, "lastPatchInstallationSummary", v.LastPatchInstallationSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinePatchStatus. +func (v *VirtualMachinePatchStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availablePatchSummary": + err = unpopulate(val, "AvailablePatchSummary", &v.AvailablePatchSummary) + delete(rawMsg, key) + case "configurationStatuses": + err = unpopulate(val, "ConfigurationStatuses", &v.ConfigurationStatuses) + delete(rawMsg, key) + case "lastPatchInstallationSummary": + err = unpopulate(val, "LastPatchInstallationSummary", &v.LastPatchInstallationSummary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineProperties. +func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "applicationProfile", v.ApplicationProfile) + populate(objectMap, "availabilitySet", v.AvailabilitySet) + populate(objectMap, "billingProfile", v.BillingProfile) + populate(objectMap, "capacityReservation", v.CapacityReservation) + populate(objectMap, "diagnosticsProfile", v.DiagnosticsProfile) + populate(objectMap, "evictionPolicy", v.EvictionPolicy) + populate(objectMap, "extensionsTimeBudget", v.ExtensionsTimeBudget) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "host", v.Host) + populate(objectMap, "hostGroup", v.HostGroup) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "platformFaultDomain", v.PlatformFaultDomain) + populate(objectMap, "priority", v.Priority) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) + populate(objectMap, "scheduledEventsProfile", v.ScheduledEventsProfile) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageProfile", v.StorageProfile) + populateTimeRFC3339(objectMap, "timeCreated", v.TimeCreated) + populate(objectMap, "userData", v.UserData) + populate(objectMap, "vmId", v.VMID) + populate(objectMap, "virtualMachineScaleSet", v.VirtualMachineScaleSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineProperties. +func (v *VirtualMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCapabilities": + err = unpopulate(val, "AdditionalCapabilities", &v.AdditionalCapabilities) + delete(rawMsg, key) + case "applicationProfile": + err = unpopulate(val, "ApplicationProfile", &v.ApplicationProfile) + delete(rawMsg, key) + case "availabilitySet": + err = unpopulate(val, "AvailabilitySet", &v.AvailabilitySet) + delete(rawMsg, key) + case "billingProfile": + err = unpopulate(val, "BillingProfile", &v.BillingProfile) + delete(rawMsg, key) + case "capacityReservation": + err = unpopulate(val, "CapacityReservation", &v.CapacityReservation) + delete(rawMsg, key) + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &v.DiagnosticsProfile) + delete(rawMsg, key) + case "evictionPolicy": + err = unpopulate(val, "EvictionPolicy", &v.EvictionPolicy) + delete(rawMsg, key) + case "extensionsTimeBudget": + err = unpopulate(val, "ExtensionsTimeBudget", &v.ExtensionsTimeBudget) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &v.Host) + delete(rawMsg, key) + case "hostGroup": + err = unpopulate(val, "HostGroup", &v.HostGroup) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "platformFaultDomain": + err = unpopulate(val, "PlatformFaultDomain", &v.PlatformFaultDomain) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &v.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "proximityPlacementGroup": + err = unpopulate(val, "ProximityPlacementGroup", &v.ProximityPlacementGroup) + delete(rawMsg, key) + case "scheduledEventsProfile": + err = unpopulate(val, "ScheduledEventsProfile", &v.ScheduledEventsProfile) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &v.TimeCreated) + delete(rawMsg, key) + case "userData": + err = unpopulate(val, "UserData", &v.UserData) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &v.VMID) + delete(rawMsg, key) + case "virtualMachineScaleSet": + err = unpopulate(val, "VirtualMachineScaleSet", &v.VirtualMachineScaleSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachinePublicIPAddressConfiguration. +func (v VirtualMachinePublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "sku", v.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinePublicIPAddressConfiguration. +func (v *VirtualMachinePublicIPAddressConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachinePublicIPAddressConfigurationProperties. +func (v VirtualMachinePublicIPAddressConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "ipTags", v.IPTags) + populate(objectMap, "idleTimeoutInMinutes", v.IdleTimeoutInMinutes) + populate(objectMap, "publicIPAddressVersion", v.PublicIPAddressVersion) + populate(objectMap, "publicIPAllocationMethod", v.PublicIPAllocationMethod) + populate(objectMap, "publicIPPrefix", v.PublicIPPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinePublicIPAddressConfigurationProperties. +func (v *VirtualMachinePublicIPAddressConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "ipTags": + err = unpopulate(val, "IPTags", &v.IPTags) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &v.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "publicIPAddressVersion": + err = unpopulate(val, "PublicIPAddressVersion", &v.PublicIPAddressVersion) + delete(rawMsg, key) + case "publicIPAllocationMethod": + err = unpopulate(val, "PublicIPAllocationMethod", &v.PublicIPAllocationMethod) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &v.PublicIPPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachinePublicIPAddressDNSSettingsConfiguration. +func (v VirtualMachinePublicIPAddressDNSSettingsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domainNameLabel", v.DomainNameLabel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachinePublicIPAddressDNSSettingsConfiguration. +func (v *VirtualMachinePublicIPAddressDNSSettingsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainNameLabel": + err = unpopulate(val, "DomainNameLabel", &v.DomainNameLabel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineReimageParameters. +func (v VirtualMachineReimageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tempDisk", v.TempDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineReimageParameters. +func (v *VirtualMachineReimageParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tempDisk": + err = unpopulate(val, "TempDisk", &v.TempDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommand. +func (v VirtualMachineRunCommand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommand. +func (v *VirtualMachineRunCommand) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandInstanceView. +func (v VirtualMachineRunCommandInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", v.EndTime) + populate(objectMap, "error", v.Error) + populate(objectMap, "executionMessage", v.ExecutionMessage) + populate(objectMap, "executionState", v.ExecutionState) + populate(objectMap, "exitCode", v.ExitCode) + populate(objectMap, "output", v.Output) + populateTimeRFC3339(objectMap, "startTime", v.StartTime) + populate(objectMap, "statuses", v.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommandInstanceView. +func (v *VirtualMachineRunCommandInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &v.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &v.Error) + delete(rawMsg, key) + case "executionMessage": + err = unpopulate(val, "ExecutionMessage", &v.ExecutionMessage) + delete(rawMsg, key) + case "executionState": + err = unpopulate(val, "ExecutionState", &v.ExecutionState) + delete(rawMsg, key) + case "exitCode": + err = unpopulate(val, "ExitCode", &v.ExitCode) + delete(rawMsg, key) + case "output": + err = unpopulate(val, "Output", &v.Output) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &v.StartTime) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandProperties. +func (v VirtualMachineRunCommandProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asyncExecution", v.AsyncExecution) + populate(objectMap, "errorBlobUri", v.ErrorBlobURI) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "outputBlobUri", v.OutputBlobURI) + populate(objectMap, "parameters", v.Parameters) + populate(objectMap, "protectedParameters", v.ProtectedParameters) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "runAsPassword", v.RunAsPassword) + populate(objectMap, "runAsUser", v.RunAsUser) + populate(objectMap, "source", v.Source) + populate(objectMap, "timeoutInSeconds", v.TimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommandProperties. +func (v *VirtualMachineRunCommandProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asyncExecution": + err = unpopulate(val, "AsyncExecution", &v.AsyncExecution) + delete(rawMsg, key) + case "errorBlobUri": + err = unpopulate(val, "ErrorBlobURI", &v.ErrorBlobURI) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + delete(rawMsg, key) + case "outputBlobUri": + err = unpopulate(val, "OutputBlobURI", &v.OutputBlobURI) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &v.Parameters) + delete(rawMsg, key) + case "protectedParameters": + err = unpopulate(val, "ProtectedParameters", &v.ProtectedParameters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "runAsPassword": + err = unpopulate(val, "RunAsPassword", &v.RunAsPassword) + delete(rawMsg, key) + case "runAsUser": + err = unpopulate(val, "RunAsUser", &v.RunAsUser) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &v.Source) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &v.TimeoutInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandScriptSource. +func (v VirtualMachineRunCommandScriptSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commandId", v.CommandID) + populate(objectMap, "script", v.Script) + populate(objectMap, "scriptUri", v.ScriptURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommandScriptSource. +func (v *VirtualMachineRunCommandScriptSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commandId": + err = unpopulate(val, "CommandID", &v.CommandID) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &v.Script) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, "ScriptURI", &v.ScriptURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandUpdate. +func (v VirtualMachineRunCommandUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommandUpdate. +func (v *VirtualMachineRunCommandUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandsListResult. +func (v VirtualMachineRunCommandsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineRunCommandsListResult. +func (v *VirtualMachineRunCommandsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSet. +func (v VirtualMachineScaleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "plan", v.Plan) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + populate(objectMap, "zones", v.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSet. +func (v *VirtualMachineScaleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &v.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetDataDisk. +func (v VirtualMachineScaleSetDataDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", v.Caching) + populate(objectMap, "createOption", v.CreateOption) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "diskIOPSReadWrite", v.DiskIOPSReadWrite) + populate(objectMap, "diskMBpsReadWrite", v.DiskMBpsReadWrite) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "lun", v.Lun) + populate(objectMap, "managedDisk", v.ManagedDisk) + populate(objectMap, "name", v.Name) + populate(objectMap, "writeAcceleratorEnabled", v.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetDataDisk. +func (v *VirtualMachineScaleSetDataDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &v.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &v.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "diskIOPSReadWrite": + err = unpopulate(val, "DiskIOPSReadWrite", &v.DiskIOPSReadWrite) + delete(rawMsg, key) + case "diskMBpsReadWrite": + err = unpopulate(val, "DiskMBpsReadWrite", &v.DiskMBpsReadWrite) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "lun": + err = unpopulate(val, "Lun", &v.Lun) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &v.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &v.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtension. +func (v VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtension. +func (v *VirtualMachineScaleSetExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionListResult. +func (v VirtualMachineScaleSetExtensionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionListResult. +func (v *VirtualMachineScaleSetExtensionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionProfile. +func (v VirtualMachineScaleSetExtensionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "extensionsTimeBudget", v.ExtensionsTimeBudget) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionProfile. +func (v *VirtualMachineScaleSetExtensionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "extensionsTimeBudget": + err = unpopulate(val, "ExtensionsTimeBudget", &v.ExtensionsTimeBudget) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionProperties. +func (v VirtualMachineScaleSetExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", v.ForceUpdateTag) + populate(objectMap, "protectedSettings", &v.ProtectedSettings) + populate(objectMap, "protectedSettingsFromKeyVault", v.ProtectedSettingsFromKeyVault) + populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publisher", v.Publisher) + populate(objectMap, "settings", &v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) + populate(objectMap, "type", v.Type) + populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionProperties. +func (v *VirtualMachineScaleSetExtensionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &v.ForceUpdateTag) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) + delete(rawMsg, key) + case "protectedSettingsFromKeyVault": + err = unpopulate(val, "ProtectedSettingsFromKeyVault", &v.ProtectedSettingsFromKeyVault) + delete(rawMsg, key) + case "provisionAfterExtensions": + err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &v.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &v.Settings) + delete(rawMsg, key) + case "suppressFailures": + err = unpopulate(val, "SuppressFailures", &v.SuppressFailures) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetExtensionUpdate. +func (v VirtualMachineScaleSetExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetExtensionUpdate. +func (v *VirtualMachineScaleSetExtensionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetHardwareProfile. +func (v VirtualMachineScaleSetHardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vmSizeProperties", v.VMSizeProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetHardwareProfile. +func (v *VirtualMachineScaleSetHardwareProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vmSizeProperties": + err = unpopulate(val, "VMSizeProperties", &v.VMSizeProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfiguration. +func (v VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPConfiguration. +func (v *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPConfigurationProperties. +func (v VirtualMachineScaleSetIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationGatewayBackendAddressPools", v.ApplicationGatewayBackendAddressPools) + populate(objectMap, "applicationSecurityGroups", v.ApplicationSecurityGroups) + populate(objectMap, "loadBalancerBackendAddressPools", v.LoadBalancerBackendAddressPools) + populate(objectMap, "loadBalancerInboundNatPools", v.LoadBalancerInboundNatPools) + populate(objectMap, "primary", v.Primary) + populate(objectMap, "privateIPAddressVersion", v.PrivateIPAddressVersion) + populate(objectMap, "publicIPAddressConfiguration", v.PublicIPAddressConfiguration) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPConfigurationProperties. +func (v *VirtualMachineScaleSetIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGatewayBackendAddressPools": + err = unpopulate(val, "ApplicationGatewayBackendAddressPools", &v.ApplicationGatewayBackendAddressPools) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &v.ApplicationSecurityGroups) + delete(rawMsg, key) + case "loadBalancerBackendAddressPools": + err = unpopulate(val, "LoadBalancerBackendAddressPools", &v.LoadBalancerBackendAddressPools) + delete(rawMsg, key) + case "loadBalancerInboundNatPools": + err = unpopulate(val, "LoadBalancerInboundNatPools", &v.LoadBalancerInboundNatPools) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &v.PrivateIPAddressVersion) + delete(rawMsg, key) + case "publicIPAddressConfiguration": + err = unpopulate(val, "PublicIPAddressConfiguration", &v.PublicIPAddressConfiguration) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIPTag. +func (v VirtualMachineScaleSetIPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipTagType", v.IPTagType) + populate(objectMap, "tag", v.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIPTag. +func (v *VirtualMachineScaleSetIPTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipTagType": + err = unpopulate(val, "IPTagType", &v.IPTagType) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &v.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetIdentity. +func (v VirtualMachineScaleSetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", v.PrincipalID) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "type", v.Type) + populate(objectMap, "userAssignedIdentities", v.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetIdentity. +func (v *VirtualMachineScaleSetIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &v.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &v.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetInstanceView. +func (v VirtualMachineScaleSetInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "orchestrationServices", v.OrchestrationServices) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "virtualMachine", v.VirtualMachine) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetInstanceView. +func (v *VirtualMachineScaleSetInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "orchestrationServices": + err = unpopulate(val, "OrchestrationServices", &v.OrchestrationServices) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "virtualMachine": + err = unpopulate(val, "VirtualMachine", &v.VirtualMachine) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetInstanceViewStatusesSummary. +func (v VirtualMachineScaleSetInstanceViewStatusesSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "statusesSummary", v.StatusesSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetInstanceViewStatusesSummary. +func (v *VirtualMachineScaleSetInstanceViewStatusesSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "statusesSummary": + err = unpopulate(val, "StatusesSummary", &v.StatusesSummary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetListOSUpgradeHistory. +func (v VirtualMachineScaleSetListOSUpgradeHistory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetListOSUpgradeHistory. +func (v *VirtualMachineScaleSetListOSUpgradeHistory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetListResult. +func (v VirtualMachineScaleSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetListResult. +func (v *VirtualMachineScaleSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetListSKUsResult. +func (v VirtualMachineScaleSetListSKUsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetListSKUsResult. +func (v *VirtualMachineScaleSetListSKUsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetListWithLinkResult. +func (v VirtualMachineScaleSetListWithLinkResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetListWithLinkResult. +func (v *VirtualMachineScaleSetListWithLinkResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetManagedDiskParameters. +func (v VirtualMachineScaleSetManagedDiskParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskEncryptionSet", v.DiskEncryptionSet) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageAccountType", v.StorageAccountType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetManagedDiskParameters. +func (v *VirtualMachineScaleSetManagedDiskParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskEncryptionSet": + err = unpopulate(val, "DiskEncryptionSet", &v.DiskEncryptionSet) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &v.StorageAccountType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfiguration. +func (v VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfiguration. +func (v *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfigurationDNSSettings. +func (v VirtualMachineScaleSetNetworkConfigurationDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServers", v.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfigurationDNSSettings. +func (v *VirtualMachineScaleSetNetworkConfigurationDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &v.DNSServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkConfigurationProperties. +func (v VirtualMachineScaleSetNetworkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "disableTcpStateTracking", v.DisableTCPStateTracking) + populate(objectMap, "enableAcceleratedNetworking", v.EnableAcceleratedNetworking) + populate(objectMap, "enableFpga", v.EnableFpga) + populate(objectMap, "enableIPForwarding", v.EnableIPForwarding) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "networkSecurityGroup", v.NetworkSecurityGroup) + populate(objectMap, "primary", v.Primary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkConfigurationProperties. +func (v *VirtualMachineScaleSetNetworkConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "disableTcpStateTracking": + err = unpopulate(val, "DisableTCPStateTracking", &v.DisableTCPStateTracking) + delete(rawMsg, key) + case "enableAcceleratedNetworking": + err = unpopulate(val, "EnableAcceleratedNetworking", &v.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "enableFpga": + err = unpopulate(val, "EnableFpga", &v.EnableFpga) + delete(rawMsg, key) + case "enableIPForwarding": + err = unpopulate(val, "EnableIPForwarding", &v.EnableIPForwarding) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &v.NetworkSecurityGroup) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetNetworkProfile. +func (v VirtualMachineScaleSetNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "healthProbe", v.HealthProbe) + populate(objectMap, "networkApiVersion", v.NetworkAPIVersion) + populate(objectMap, "networkInterfaceConfigurations", v.NetworkInterfaceConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetNetworkProfile. +func (v *VirtualMachineScaleSetNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "healthProbe": + err = unpopulate(val, "HealthProbe", &v.HealthProbe) + delete(rawMsg, key) + case "networkApiVersion": + err = unpopulate(val, "NetworkAPIVersion", &v.NetworkAPIVersion) + delete(rawMsg, key) + case "networkInterfaceConfigurations": + err = unpopulate(val, "NetworkInterfaceConfigurations", &v.NetworkInterfaceConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetOSDisk. +func (v VirtualMachineScaleSetOSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", v.Caching) + populate(objectMap, "createOption", v.CreateOption) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "diffDiskSettings", v.DiffDiskSettings) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "image", v.Image) + populate(objectMap, "managedDisk", v.ManagedDisk) + populate(objectMap, "name", v.Name) + populate(objectMap, "osType", v.OSType) + populate(objectMap, "vhdContainers", v.VhdContainers) + populate(objectMap, "writeAcceleratorEnabled", v.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetOSDisk. +func (v *VirtualMachineScaleSetOSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &v.Caching) + delete(rawMsg, key) + case "createOption": + err = unpopulate(val, "CreateOption", &v.CreateOption) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "diffDiskSettings": + err = unpopulate(val, "DiffDiskSettings", &v.DiffDiskSettings) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &v.Image) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &v.ManagedDisk) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) + delete(rawMsg, key) + case "vhdContainers": + err = unpopulate(val, "VhdContainers", &v.VhdContainers) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &v.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetOSProfile. +func (v VirtualMachineScaleSetOSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminPassword", v.AdminPassword) + populate(objectMap, "adminUsername", v.AdminUsername) + populate(objectMap, "allowExtensionOperations", v.AllowExtensionOperations) + populate(objectMap, "computerNamePrefix", v.ComputerNamePrefix) + populate(objectMap, "customData", v.CustomData) + populate(objectMap, "linuxConfiguration", v.LinuxConfiguration) + populate(objectMap, "secrets", v.Secrets) + populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetOSProfile. +func (v *VirtualMachineScaleSetOSProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminPassword": + err = unpopulate(val, "AdminPassword", &v.AdminPassword) + delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &v.AdminUsername) + delete(rawMsg, key) + case "allowExtensionOperations": + err = unpopulate(val, "AllowExtensionOperations", &v.AllowExtensionOperations) + delete(rawMsg, key) + case "computerNamePrefix": + err = unpopulate(val, "ComputerNamePrefix", &v.ComputerNamePrefix) + delete(rawMsg, key) + case "customData": + err = unpopulate(val, "CustomData", &v.CustomData) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &v.LinuxConfiguration) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &v.Secrets) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetProperties. +func (v VirtualMachineScaleSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "automaticRepairsPolicy", v.AutomaticRepairsPolicy) + populate(objectMap, "doNotRunExtensionsOnOverprovisionedVMs", v.DoNotRunExtensionsOnOverprovisionedVMs) + populate(objectMap, "hostGroup", v.HostGroup) + populate(objectMap, "orchestrationMode", v.OrchestrationMode) + populate(objectMap, "overprovision", v.Overprovision) + populate(objectMap, "platformFaultDomainCount", v.PlatformFaultDomainCount) + populate(objectMap, "priorityMixPolicy", v.PriorityMixPolicy) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) + populate(objectMap, "scaleInPolicy", v.ScaleInPolicy) + populate(objectMap, "singlePlacementGroup", v.SinglePlacementGroup) + populate(objectMap, "spotRestorePolicy", v.SpotRestorePolicy) + populateTimeRFC3339(objectMap, "timeCreated", v.TimeCreated) + populate(objectMap, "uniqueId", v.UniqueID) + populate(objectMap, "upgradePolicy", v.UpgradePolicy) + populate(objectMap, "virtualMachineProfile", v.VirtualMachineProfile) + populate(objectMap, "zoneBalance", v.ZoneBalance) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetProperties. +func (v *VirtualMachineScaleSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCapabilities": + err = unpopulate(val, "AdditionalCapabilities", &v.AdditionalCapabilities) + delete(rawMsg, key) + case "automaticRepairsPolicy": + err = unpopulate(val, "AutomaticRepairsPolicy", &v.AutomaticRepairsPolicy) + delete(rawMsg, key) + case "doNotRunExtensionsOnOverprovisionedVMs": + err = unpopulate(val, "DoNotRunExtensionsOnOverprovisionedVMs", &v.DoNotRunExtensionsOnOverprovisionedVMs) + delete(rawMsg, key) + case "hostGroup": + err = unpopulate(val, "HostGroup", &v.HostGroup) + delete(rawMsg, key) + case "orchestrationMode": + err = unpopulate(val, "OrchestrationMode", &v.OrchestrationMode) + delete(rawMsg, key) + case "overprovision": + err = unpopulate(val, "Overprovision", &v.Overprovision) + delete(rawMsg, key) + case "platformFaultDomainCount": + err = unpopulate(val, "PlatformFaultDomainCount", &v.PlatformFaultDomainCount) + delete(rawMsg, key) + case "priorityMixPolicy": + err = unpopulate(val, "PriorityMixPolicy", &v.PriorityMixPolicy) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "proximityPlacementGroup": + err = unpopulate(val, "ProximityPlacementGroup", &v.ProximityPlacementGroup) + delete(rawMsg, key) + case "scaleInPolicy": + err = unpopulate(val, "ScaleInPolicy", &v.ScaleInPolicy) + delete(rawMsg, key) + case "singlePlacementGroup": + err = unpopulate(val, "SinglePlacementGroup", &v.SinglePlacementGroup) + delete(rawMsg, key) + case "spotRestorePolicy": + err = unpopulate(val, "SpotRestorePolicy", &v.SpotRestorePolicy) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &v.TimeCreated) + delete(rawMsg, key) + case "uniqueId": + err = unpopulate(val, "UniqueID", &v.UniqueID) + delete(rawMsg, key) + case "upgradePolicy": + err = unpopulate(val, "UpgradePolicy", &v.UpgradePolicy) + delete(rawMsg, key) + case "virtualMachineProfile": + err = unpopulate(val, "VirtualMachineProfile", &v.VirtualMachineProfile) + delete(rawMsg, key) + case "zoneBalance": + err = unpopulate(val, "ZoneBalance", &v.ZoneBalance) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfiguration. +func (v VirtualMachineScaleSetPublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "sku", v.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfiguration. +func (v *VirtualMachineScaleSetPublicIPAddressConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings. +func (v VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domainNameLabel", v.DomainNameLabel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings. +func (v *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainNameLabel": + err = unpopulate(val, "DomainNameLabel", &v.DomainNameLabel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationProperties. +func (v VirtualMachineScaleSetPublicIPAddressConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "ipTags", v.IPTags) + populate(objectMap, "idleTimeoutInMinutes", v.IdleTimeoutInMinutes) + populate(objectMap, "publicIPAddressVersion", v.PublicIPAddressVersion) + populate(objectMap, "publicIPPrefix", v.PublicIPPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetPublicIPAddressConfigurationProperties. +func (v *VirtualMachineScaleSetPublicIPAddressConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "ipTags": + err = unpopulate(val, "IPTags", &v.IPTags) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &v.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "publicIPAddressVersion": + err = unpopulate(val, "PublicIPAddressVersion", &v.PublicIPAddressVersion) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &v.PublicIPPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetReimageParameters. +func (v VirtualMachineScaleSetReimageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceIds", v.InstanceIDs) + populate(objectMap, "tempDisk", v.TempDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetReimageParameters. +func (v *VirtualMachineScaleSetReimageParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceIds": + err = unpopulate(val, "InstanceIDs", &v.InstanceIDs) + delete(rawMsg, key) + case "tempDisk": + err = unpopulate(val, "TempDisk", &v.TempDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetSKU. +func (v VirtualMachineScaleSetSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", v.Capacity) + populate(objectMap, "resourceType", v.ResourceType) + populate(objectMap, "sku", v.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetSKU. +func (v *VirtualMachineScaleSetSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &v.Capacity) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &v.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetSKUCapacity. +func (v VirtualMachineScaleSetSKUCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultCapacity", v.DefaultCapacity) + populate(objectMap, "maximum", v.Maximum) + populate(objectMap, "minimum", v.Minimum) + populate(objectMap, "scaleType", v.ScaleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetSKUCapacity. +func (v *VirtualMachineScaleSetSKUCapacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultCapacity": + err = unpopulate(val, "DefaultCapacity", &v.DefaultCapacity) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &v.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &v.Minimum) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &v.ScaleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetStorageProfile. +func (v VirtualMachineScaleSetStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", v.DataDisks) + populate(objectMap, "diskControllerType", v.DiskControllerType) + populate(objectMap, "imageReference", v.ImageReference) + populate(objectMap, "osDisk", v.OSDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetStorageProfile. +func (v *VirtualMachineScaleSetStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) + delete(rawMsg, key) + case "diskControllerType": + err = unpopulate(val, "DiskControllerType", &v.DiskControllerType) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdate. +func (v VirtualMachineScaleSetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "plan", v.Plan) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdate. +func (v *VirtualMachineScaleSetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateIPConfiguration. +func (v VirtualMachineScaleSetUpdateIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateIPConfiguration. +func (v *VirtualMachineScaleSetUpdateIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateIPConfigurationProperties. +func (v VirtualMachineScaleSetUpdateIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationGatewayBackendAddressPools", v.ApplicationGatewayBackendAddressPools) + populate(objectMap, "applicationSecurityGroups", v.ApplicationSecurityGroups) + populate(objectMap, "loadBalancerBackendAddressPools", v.LoadBalancerBackendAddressPools) + populate(objectMap, "loadBalancerInboundNatPools", v.LoadBalancerInboundNatPools) + populate(objectMap, "primary", v.Primary) + populate(objectMap, "privateIPAddressVersion", v.PrivateIPAddressVersion) + populate(objectMap, "publicIPAddressConfiguration", v.PublicIPAddressConfiguration) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateIPConfigurationProperties. +func (v *VirtualMachineScaleSetUpdateIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGatewayBackendAddressPools": + err = unpopulate(val, "ApplicationGatewayBackendAddressPools", &v.ApplicationGatewayBackendAddressPools) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &v.ApplicationSecurityGroups) + delete(rawMsg, key) + case "loadBalancerBackendAddressPools": + err = unpopulate(val, "LoadBalancerBackendAddressPools", &v.LoadBalancerBackendAddressPools) + delete(rawMsg, key) + case "loadBalancerInboundNatPools": + err = unpopulate(val, "LoadBalancerInboundNatPools", &v.LoadBalancerInboundNatPools) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &v.PrivateIPAddressVersion) + delete(rawMsg, key) + case "publicIPAddressConfiguration": + err = unpopulate(val, "PublicIPAddressConfiguration", &v.PublicIPAddressConfiguration) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateNetworkConfiguration. +func (v VirtualMachineScaleSetUpdateNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateNetworkConfiguration. +func (v *VirtualMachineScaleSetUpdateNetworkConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateNetworkConfigurationProperties. +func (v VirtualMachineScaleSetUpdateNetworkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "disableTcpStateTracking", v.DisableTCPStateTracking) + populate(objectMap, "enableAcceleratedNetworking", v.EnableAcceleratedNetworking) + populate(objectMap, "enableFpga", v.EnableFpga) + populate(objectMap, "enableIPForwarding", v.EnableIPForwarding) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "networkSecurityGroup", v.NetworkSecurityGroup) + populate(objectMap, "primary", v.Primary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateNetworkConfigurationProperties. +func (v *VirtualMachineScaleSetUpdateNetworkConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "disableTcpStateTracking": + err = unpopulate(val, "DisableTCPStateTracking", &v.DisableTCPStateTracking) + delete(rawMsg, key) + case "enableAcceleratedNetworking": + err = unpopulate(val, "EnableAcceleratedNetworking", &v.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "enableFpga": + err = unpopulate(val, "EnableFpga", &v.EnableFpga) + delete(rawMsg, key) + case "enableIPForwarding": + err = unpopulate(val, "EnableIPForwarding", &v.EnableIPForwarding) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &v.NetworkSecurityGroup) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &v.Primary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateNetworkProfile. +func (v VirtualMachineScaleSetUpdateNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "healthProbe", v.HealthProbe) + populate(objectMap, "networkApiVersion", v.NetworkAPIVersion) + populate(objectMap, "networkInterfaceConfigurations", v.NetworkInterfaceConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateNetworkProfile. +func (v *VirtualMachineScaleSetUpdateNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "healthProbe": + err = unpopulate(val, "HealthProbe", &v.HealthProbe) + delete(rawMsg, key) + case "networkApiVersion": + err = unpopulate(val, "NetworkAPIVersion", &v.NetworkAPIVersion) + delete(rawMsg, key) + case "networkInterfaceConfigurations": + err = unpopulate(val, "NetworkInterfaceConfigurations", &v.NetworkInterfaceConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateOSDisk. +func (v VirtualMachineScaleSetUpdateOSDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "caching", v.Caching) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "diskSizeGB", v.DiskSizeGB) + populate(objectMap, "image", v.Image) + populate(objectMap, "managedDisk", v.ManagedDisk) + populate(objectMap, "vhdContainers", v.VhdContainers) + populate(objectMap, "writeAcceleratorEnabled", v.WriteAcceleratorEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateOSDisk. +func (v *VirtualMachineScaleSetUpdateOSDisk) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caching": + err = unpopulate(val, "Caching", &v.Caching) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "diskSizeGB": + err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &v.Image) + delete(rawMsg, key) + case "managedDisk": + err = unpopulate(val, "ManagedDisk", &v.ManagedDisk) + delete(rawMsg, key) + case "vhdContainers": + err = unpopulate(val, "VhdContainers", &v.VhdContainers) + delete(rawMsg, key) + case "writeAcceleratorEnabled": + err = unpopulate(val, "WriteAcceleratorEnabled", &v.WriteAcceleratorEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateOSProfile. +func (v VirtualMachineScaleSetUpdateOSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customData", v.CustomData) + populate(objectMap, "linuxConfiguration", v.LinuxConfiguration) + populate(objectMap, "secrets", v.Secrets) + populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateOSProfile. +func (v *VirtualMachineScaleSetUpdateOSProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customData": + err = unpopulate(val, "CustomData", &v.CustomData) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &v.LinuxConfiguration) + delete(rawMsg, key) + case "secrets": + err = unpopulate(val, "Secrets", &v.Secrets) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateProperties. +func (v VirtualMachineScaleSetUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "automaticRepairsPolicy", v.AutomaticRepairsPolicy) + populate(objectMap, "doNotRunExtensionsOnOverprovisionedVMs", v.DoNotRunExtensionsOnOverprovisionedVMs) + populate(objectMap, "overprovision", v.Overprovision) + populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) + populate(objectMap, "scaleInPolicy", v.ScaleInPolicy) + populate(objectMap, "singlePlacementGroup", v.SinglePlacementGroup) + populate(objectMap, "upgradePolicy", v.UpgradePolicy) + populate(objectMap, "virtualMachineProfile", v.VirtualMachineProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateProperties. +func (v *VirtualMachineScaleSetUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCapabilities": + err = unpopulate(val, "AdditionalCapabilities", &v.AdditionalCapabilities) + delete(rawMsg, key) + case "automaticRepairsPolicy": + err = unpopulate(val, "AutomaticRepairsPolicy", &v.AutomaticRepairsPolicy) + delete(rawMsg, key) + case "doNotRunExtensionsOnOverprovisionedVMs": + err = unpopulate(val, "DoNotRunExtensionsOnOverprovisionedVMs", &v.DoNotRunExtensionsOnOverprovisionedVMs) + delete(rawMsg, key) + case "overprovision": + err = unpopulate(val, "Overprovision", &v.Overprovision) + delete(rawMsg, key) + case "proximityPlacementGroup": + err = unpopulate(val, "ProximityPlacementGroup", &v.ProximityPlacementGroup) + delete(rawMsg, key) + case "scaleInPolicy": + err = unpopulate(val, "ScaleInPolicy", &v.ScaleInPolicy) + delete(rawMsg, key) + case "singlePlacementGroup": + err = unpopulate(val, "SinglePlacementGroup", &v.SinglePlacementGroup) + delete(rawMsg, key) + case "upgradePolicy": + err = unpopulate(val, "UpgradePolicy", &v.UpgradePolicy) + delete(rawMsg, key) + case "virtualMachineProfile": + err = unpopulate(val, "VirtualMachineProfile", &v.VirtualMachineProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration. +func (v VirtualMachineScaleSetUpdatePublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration. +func (v *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties. +func (v VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", v.DNSSettings) + populate(objectMap, "deleteOption", v.DeleteOption) + populate(objectMap, "idleTimeoutInMinutes", v.IdleTimeoutInMinutes) + populate(objectMap, "publicIPPrefix", v.PublicIPPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties. +func (v *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &v.DNSSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &v.DeleteOption) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &v.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &v.PublicIPPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateStorageProfile. +func (v VirtualMachineScaleSetUpdateStorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataDisks", v.DataDisks) + populate(objectMap, "diskControllerType", v.DiskControllerType) + populate(objectMap, "imageReference", v.ImageReference) + populate(objectMap, "osDisk", v.OSDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateStorageProfile. +func (v *VirtualMachineScaleSetUpdateStorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataDisks": + err = unpopulate(val, "DataDisks", &v.DataDisks) + delete(rawMsg, key) + case "diskControllerType": + err = unpopulate(val, "DiskControllerType", &v.DiskControllerType) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &v.ImageReference) + delete(rawMsg, key) + case "osDisk": + err = unpopulate(val, "OSDisk", &v.OSDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetUpdateVMProfile. +func (v VirtualMachineScaleSetUpdateVMProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingProfile", v.BillingProfile) + populate(objectMap, "diagnosticsProfile", v.DiagnosticsProfile) + populate(objectMap, "extensionProfile", v.ExtensionProfile) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "scheduledEventsProfile", v.ScheduledEventsProfile) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageProfile", v.StorageProfile) + populate(objectMap, "userData", v.UserData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetUpdateVMProfile. +func (v *VirtualMachineScaleSetUpdateVMProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingProfile": + err = unpopulate(val, "BillingProfile", &v.BillingProfile) + delete(rawMsg, key) + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &v.DiagnosticsProfile) + delete(rawMsg, key) + case "extensionProfile": + err = unpopulate(val, "ExtensionProfile", &v.ExtensionProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "scheduledEventsProfile": + err = unpopulate(val, "ScheduledEventsProfile", &v.ScheduledEventsProfile) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + case "userData": + err = unpopulate(val, "UserData", &v.UserData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVM. +func (v VirtualMachineScaleSetVM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "instanceId", v.InstanceID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "plan", v.Plan) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "resources", v.Resources) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + populate(objectMap, "zones", v.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVM. +func (v *VirtualMachineScaleSetVM) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "instanceId": + err = unpopulate(val, "InstanceID", &v.InstanceID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &v.Resources) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &v.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMExtension. +func (v VirtualMachineScaleSetVMExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMExtension. +func (v *VirtualMachineScaleSetVMExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMExtensionUpdate. +func (v VirtualMachineScaleSetVMExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMExtensionUpdate. +func (v *VirtualMachineScaleSetVMExtensionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMExtensionsListResult. +func (v VirtualMachineScaleSetVMExtensionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMExtensionsListResult. +func (v *VirtualMachineScaleSetVMExtensionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMExtensionsSummary. +func (v VirtualMachineScaleSetVMExtensionsSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "statusesSummary", v.StatusesSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMExtensionsSummary. +func (v *VirtualMachineScaleSetVMExtensionsSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "statusesSummary": + err = unpopulate(val, "StatusesSummary", &v.StatusesSummary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMInstanceIDs. +func (v VirtualMachineScaleSetVMInstanceIDs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceIds", v.InstanceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMInstanceIDs. +func (v *VirtualMachineScaleSetVMInstanceIDs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceIds": + err = unpopulate(val, "InstanceIDs", &v.InstanceIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMInstanceRequiredIDs. +func (v VirtualMachineScaleSetVMInstanceRequiredIDs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceIds", v.InstanceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMInstanceRequiredIDs. +func (v *VirtualMachineScaleSetVMInstanceRequiredIDs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceIds": + err = unpopulate(val, "InstanceIDs", &v.InstanceIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMInstanceView. +func (v VirtualMachineScaleSetVMInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignedHost", v.AssignedHost) + populate(objectMap, "bootDiagnostics", v.BootDiagnostics) + populate(objectMap, "disks", v.Disks) + populate(objectMap, "extensions", v.Extensions) + populate(objectMap, "maintenanceRedeployStatus", v.MaintenanceRedeployStatus) + populate(objectMap, "placementGroupId", v.PlacementGroupID) + populate(objectMap, "platformFaultDomain", v.PlatformFaultDomain) + populate(objectMap, "platformUpdateDomain", v.PlatformUpdateDomain) + populate(objectMap, "rdpThumbPrint", v.RdpThumbPrint) + populate(objectMap, "statuses", v.Statuses) + populate(objectMap, "vmAgent", v.VMAgent) + populate(objectMap, "vmHealth", v.VMHealth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMInstanceView. +func (v *VirtualMachineScaleSetVMInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedHost": + err = unpopulate(val, "AssignedHost", &v.AssignedHost) + delete(rawMsg, key) + case "bootDiagnostics": + err = unpopulate(val, "BootDiagnostics", &v.BootDiagnostics) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &v.Disks) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &v.Extensions) + delete(rawMsg, key) + case "maintenanceRedeployStatus": + err = unpopulate(val, "MaintenanceRedeployStatus", &v.MaintenanceRedeployStatus) + delete(rawMsg, key) + case "placementGroupId": + err = unpopulate(val, "PlacementGroupID", &v.PlacementGroupID) + delete(rawMsg, key) + case "platformFaultDomain": + err = unpopulate(val, "PlatformFaultDomain", &v.PlatformFaultDomain) + delete(rawMsg, key) + case "platformUpdateDomain": + err = unpopulate(val, "PlatformUpdateDomain", &v.PlatformUpdateDomain) + delete(rawMsg, key) + case "rdpThumbPrint": + err = unpopulate(val, "RdpThumbPrint", &v.RdpThumbPrint) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &v.Statuses) + delete(rawMsg, key) + case "vmAgent": + err = unpopulate(val, "VMAgent", &v.VMAgent) + delete(rawMsg, key) + case "vmHealth": + err = unpopulate(val, "VMHealth", &v.VMHealth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMListResult. +func (v VirtualMachineScaleSetVMListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMListResult. +func (v *VirtualMachineScaleSetVMListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMNetworkProfileConfiguration. +func (v VirtualMachineScaleSetVMNetworkProfileConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaceConfigurations", v.NetworkInterfaceConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMNetworkProfileConfiguration. +func (v *VirtualMachineScaleSetVMNetworkProfileConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterfaceConfigurations": + err = unpopulate(val, "NetworkInterfaceConfigurations", &v.NetworkInterfaceConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMProfile. +func (v VirtualMachineScaleSetVMProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationProfile", v.ApplicationProfile) + populate(objectMap, "billingProfile", v.BillingProfile) + populate(objectMap, "capacityReservation", v.CapacityReservation) + populate(objectMap, "diagnosticsProfile", v.DiagnosticsProfile) + populate(objectMap, "evictionPolicy", v.EvictionPolicy) + populate(objectMap, "extensionProfile", v.ExtensionProfile) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "priority", v.Priority) + populate(objectMap, "scheduledEventsProfile", v.ScheduledEventsProfile) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageProfile", v.StorageProfile) + populate(objectMap, "userData", v.UserData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMProfile. +func (v *VirtualMachineScaleSetVMProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationProfile": + err = unpopulate(val, "ApplicationProfile", &v.ApplicationProfile) + delete(rawMsg, key) + case "billingProfile": + err = unpopulate(val, "BillingProfile", &v.BillingProfile) + delete(rawMsg, key) + case "capacityReservation": + err = unpopulate(val, "CapacityReservation", &v.CapacityReservation) + delete(rawMsg, key) + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &v.DiagnosticsProfile) + delete(rawMsg, key) + case "evictionPolicy": + err = unpopulate(val, "EvictionPolicy", &v.EvictionPolicy) + delete(rawMsg, key) + case "extensionProfile": + err = unpopulate(val, "ExtensionProfile", &v.ExtensionProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &v.Priority) + delete(rawMsg, key) + case "scheduledEventsProfile": + err = unpopulate(val, "ScheduledEventsProfile", &v.ScheduledEventsProfile) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + case "userData": + err = unpopulate(val, "UserData", &v.UserData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMProperties. +func (v VirtualMachineScaleSetVMProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalCapabilities", v.AdditionalCapabilities) + populate(objectMap, "availabilitySet", v.AvailabilitySet) + populate(objectMap, "diagnosticsProfile", v.DiagnosticsProfile) + populate(objectMap, "hardwareProfile", v.HardwareProfile) + populate(objectMap, "instanceView", v.InstanceView) + populate(objectMap, "latestModelApplied", v.LatestModelApplied) + populate(objectMap, "licenseType", v.LicenseType) + populate(objectMap, "modelDefinitionApplied", v.ModelDefinitionApplied) + populate(objectMap, "networkProfile", v.NetworkProfile) + populate(objectMap, "networkProfileConfiguration", v.NetworkProfileConfiguration) + populate(objectMap, "osProfile", v.OSProfile) + populate(objectMap, "protectionPolicy", v.ProtectionPolicy) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "securityProfile", v.SecurityProfile) + populate(objectMap, "storageProfile", v.StorageProfile) + populate(objectMap, "userData", v.UserData) + populate(objectMap, "vmId", v.VMID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMProperties. +func (v *VirtualMachineScaleSetVMProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalCapabilities": + err = unpopulate(val, "AdditionalCapabilities", &v.AdditionalCapabilities) + delete(rawMsg, key) + case "availabilitySet": + err = unpopulate(val, "AvailabilitySet", &v.AvailabilitySet) + delete(rawMsg, key) + case "diagnosticsProfile": + err = unpopulate(val, "DiagnosticsProfile", &v.DiagnosticsProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &v.HardwareProfile) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &v.InstanceView) + delete(rawMsg, key) + case "latestModelApplied": + err = unpopulate(val, "LatestModelApplied", &v.LatestModelApplied) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &v.LicenseType) + delete(rawMsg, key) + case "modelDefinitionApplied": + err = unpopulate(val, "ModelDefinitionApplied", &v.ModelDefinitionApplied) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &v.NetworkProfile) + delete(rawMsg, key) + case "networkProfileConfiguration": + err = unpopulate(val, "NetworkProfileConfiguration", &v.NetworkProfileConfiguration) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &v.OSProfile) + delete(rawMsg, key) + case "protectionPolicy": + err = unpopulate(val, "ProtectionPolicy", &v.ProtectionPolicy) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &v.StorageProfile) + delete(rawMsg, key) + case "userData": + err = unpopulate(val, "UserData", &v.UserData) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &v.VMID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMProtectionPolicy. +func (v VirtualMachineScaleSetVMProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "protectFromScaleIn", v.ProtectFromScaleIn) + populate(objectMap, "protectFromScaleSetActions", v.ProtectFromScaleSetActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMProtectionPolicy. +func (v *VirtualMachineScaleSetVMProtectionPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "protectFromScaleIn": + err = unpopulate(val, "ProtectFromScaleIn", &v.ProtectFromScaleIn) + delete(rawMsg, key) + case "protectFromScaleSetActions": + err = unpopulate(val, "ProtectFromScaleSetActions", &v.ProtectFromScaleSetActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineScaleSetVMReimageParameters. +func (v VirtualMachineScaleSetVMReimageParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tempDisk", v.TempDisk) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineScaleSetVMReimageParameters. +func (v *VirtualMachineScaleSetVMReimageParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tempDisk": + err = unpopulate(val, "TempDisk", &v.TempDisk) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSize. +func (v VirtualMachineSize) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxDataDiskCount", v.MaxDataDiskCount) + populate(objectMap, "memoryInMB", v.MemoryInMB) + populate(objectMap, "name", v.Name) + populate(objectMap, "numberOfCores", v.NumberOfCores) + populate(objectMap, "osDiskSizeInMB", v.OSDiskSizeInMB) + populate(objectMap, "resourceDiskSizeInMB", v.ResourceDiskSizeInMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineSize. +func (v *VirtualMachineSize) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxDataDiskCount": + err = unpopulate(val, "MaxDataDiskCount", &v.MaxDataDiskCount) + delete(rawMsg, key) + case "memoryInMB": + err = unpopulate(val, "MemoryInMB", &v.MemoryInMB) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "numberOfCores": + err = unpopulate(val, "NumberOfCores", &v.NumberOfCores) + delete(rawMsg, key) + case "osDiskSizeInMB": + err = unpopulate(val, "OSDiskSizeInMB", &v.OSDiskSizeInMB) + delete(rawMsg, key) + case "resourceDiskSizeInMB": + err = unpopulate(val, "ResourceDiskSizeInMB", &v.ResourceDiskSizeInMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSizeListResult. +func (v VirtualMachineSizeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineSizeListResult. +func (v *VirtualMachineSizeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineSoftwarePatchProperties. +func (v VirtualMachineSoftwarePatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activityId", v.ActivityID) + populate(objectMap, "assessmentState", v.AssessmentState) + populate(objectMap, "classifications", v.Classifications) + populate(objectMap, "kbId", v.KbID) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", v.LastModifiedDateTime) + populate(objectMap, "name", v.Name) + populate(objectMap, "patchId", v.PatchID) + populateTimeRFC3339(objectMap, "publishedDate", v.PublishedDate) + populate(objectMap, "rebootBehavior", v.RebootBehavior) + populate(objectMap, "version", v.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineSoftwarePatchProperties. +func (v *VirtualMachineSoftwarePatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityId": + err = unpopulate(val, "ActivityID", &v.ActivityID) + delete(rawMsg, key) + case "assessmentState": + err = unpopulate(val, "AssessmentState", &v.AssessmentState) + delete(rawMsg, key) + case "classifications": + err = unpopulate(val, "Classifications", &v.Classifications) + delete(rawMsg, key) + case "kbId": + err = unpopulate(val, "KbID", &v.KbID) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &v.LastModifiedDateTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "patchId": + err = unpopulate(val, "PatchID", &v.PatchID) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, "PublishedDate", &v.PublishedDate) + delete(rawMsg, key) + case "rebootBehavior": + err = unpopulate(val, "RebootBehavior", &v.RebootBehavior) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &v.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineStatusCodeCount. +func (v VirtualMachineStatusCodeCount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", v.Code) + populate(objectMap, "count", v.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineStatusCodeCount. +func (v *VirtualMachineStatusCodeCount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &v.Code) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &v.Count) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineUpdate. +func (v VirtualMachineUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "plan", v.Plan) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "zones", v.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineUpdate. +func (v *VirtualMachineUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &v.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &v.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WinRMConfiguration. +func (w WinRMConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "listeners", w.Listeners) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WinRMConfiguration. +func (w *WinRMConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "listeners": + err = unpopulate(val, "Listeners", &w.Listeners) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WinRMListener. +func (w WinRMListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateUrl", w.CertificateURL) + populate(objectMap, "protocol", w.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WinRMListener. +func (w *WinRMListener) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateUrl": + err = unpopulate(val, "CertificateURL", &w.CertificateURL) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &w.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsConfiguration. +func (w WindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalUnattendContent", w.AdditionalUnattendContent) + populate(objectMap, "enableAutomaticUpdates", w.EnableAutomaticUpdates) + populate(objectMap, "enableVMAgentPlatformUpdates", w.EnableVMAgentPlatformUpdates) + populate(objectMap, "patchSettings", w.PatchSettings) + populate(objectMap, "provisionVMAgent", w.ProvisionVMAgent) + populate(objectMap, "timeZone", w.TimeZone) + populate(objectMap, "winRM", w.WinRM) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsConfiguration. +func (w *WindowsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalUnattendContent": + err = unpopulate(val, "AdditionalUnattendContent", &w.AdditionalUnattendContent) + delete(rawMsg, key) + case "enableAutomaticUpdates": + err = unpopulate(val, "EnableAutomaticUpdates", &w.EnableAutomaticUpdates) + delete(rawMsg, key) + case "enableVMAgentPlatformUpdates": + err = unpopulate(val, "EnableVMAgentPlatformUpdates", &w.EnableVMAgentPlatformUpdates) + delete(rawMsg, key) + case "patchSettings": + err = unpopulate(val, "PatchSettings", &w.PatchSettings) + delete(rawMsg, key) + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &w.ProvisionVMAgent) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &w.TimeZone) + delete(rawMsg, key) + case "winRM": + err = unpopulate(val, "WinRM", &w.WinRM) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsParameters. +func (w WindowsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) + populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) + populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) + populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) + populateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsParameters. +func (w *WindowsParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &w.ClassificationsToInclude) + delete(rawMsg, key) + case "excludeKbsRequiringReboot": + err = unpopulate(val, "ExcludeKbsRequiringReboot", &w.ExcludeKbsRequiringReboot) + delete(rawMsg, key) + case "kbNumbersToExclude": + err = unpopulate(val, "KbNumbersToExclude", &w.KbNumbersToExclude) + delete(rawMsg, key) + case "kbNumbersToInclude": + err = unpopulate(val, "KbNumbersToInclude", &w.KbNumbersToInclude) + delete(rawMsg, key) + case "maxPatchPublishDate": + err = unpopulateTimeRFC3339(val, "MaxPatchPublishDate", &w.MaxPatchPublishDate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsVMGuestPatchAutomaticByPlatformSettings. +func (w WindowsVMGuestPatchAutomaticByPlatformSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rebootSetting", w.RebootSetting) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsVMGuestPatchAutomaticByPlatformSettings. +func (w *WindowsVMGuestPatchAutomaticByPlatformSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &w.RebootSetting) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/operations_client.go new file mode 100644 index 000000000..1810c404d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/operations_client.go @@ -0,0 +1,98 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets a list of compute operations. +// Generated from API version 2022-08-01 +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Compute/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/proximityplacementgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/proximityplacementgroups_client.go new file mode 100644 index 000000000..40c0d2177 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/proximityplacementgroups_client.go @@ -0,0 +1,404 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProximityPlacementGroupsClient contains the methods for the ProximityPlacementGroups group. +// Don't use this type directly, use NewProximityPlacementGroupsClient() instead. +type ProximityPlacementGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProximityPlacementGroupsClient creates a new instance of ProximityPlacementGroupsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewProximityPlacementGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProximityPlacementGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProximityPlacementGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update a proximity placement group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// proximityPlacementGroupName - The name of the proximity placement group. +// parameters - Parameters supplied to the Create Proximity Placement Group operation. +// options - ProximityPlacementGroupsClientCreateOrUpdateOptions contains the optional parameters for the ProximityPlacementGroupsClient.CreateOrUpdate +// method. +func (client *ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsClientCreateOrUpdateOptions) (ProximityPlacementGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) + if err != nil { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if proximityPlacementGroupName == "" { + return nil, errors.New("parameter proximityPlacementGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{proximityPlacementGroupName}", url.PathEscape(proximityPlacementGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ProximityPlacementGroupsClientCreateOrUpdateResponse, error) { + result := ProximityPlacementGroupsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a proximity placement group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// proximityPlacementGroupName - The name of the proximity placement group. +// options - ProximityPlacementGroupsClientDeleteOptions contains the optional parameters for the ProximityPlacementGroupsClient.Delete +// method. +func (client *ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsClientDeleteOptions) (ProximityPlacementGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) + if err != nil { + return ProximityPlacementGroupsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ProximityPlacementGroupsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if proximityPlacementGroupName == "" { + return nil, errors.New("parameter proximityPlacementGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{proximityPlacementGroupName}", url.PathEscape(proximityPlacementGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about a proximity placement group . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// proximityPlacementGroupName - The name of the proximity placement group. +// options - ProximityPlacementGroupsClientGetOptions contains the optional parameters for the ProximityPlacementGroupsClient.Get +// method. +func (client *ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsClientGetOptions) (ProximityPlacementGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) + if err != nil { + return ProximityPlacementGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if proximityPlacementGroupName == "" { + return nil, errors.New("parameter proximityPlacementGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{proximityPlacementGroupName}", url.PathEscape(proximityPlacementGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.IncludeColocationStatus != nil { + reqQP.Set("includeColocationStatus", *options.IncludeColocationStatus) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Response) (ProximityPlacementGroupsClientGetResponse, error) { + result := ProximityPlacementGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all proximity placement groups in a resource group. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - ProximityPlacementGroupsClientListByResourceGroupOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListByResourceGroup +// method. +func (client *ProximityPlacementGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ProximityPlacementGroupsClientListByResourceGroupOptions) *runtime.Pager[ProximityPlacementGroupsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ProximityPlacementGroupsClientListByResourceGroupResponse]{ + More: func(page ProximityPlacementGroupsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProximityPlacementGroupsClientListByResourceGroupResponse) (ProximityPlacementGroupsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProximityPlacementGroupsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ProximityPlacementGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ProximityPlacementGroupsClientListByResourceGroupResponse, error) { + result := ProximityPlacementGroupsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { + return ProximityPlacementGroupsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all proximity placement groups in a subscription. +// Generated from API version 2022-08-01 +// options - ProximityPlacementGroupsClientListBySubscriptionOptions contains the optional parameters for the ProximityPlacementGroupsClient.ListBySubscription +// method. +func (client *ProximityPlacementGroupsClient) NewListBySubscriptionPager(options *ProximityPlacementGroupsClientListBySubscriptionOptions) *runtime.Pager[ProximityPlacementGroupsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ProximityPlacementGroupsClientListBySubscriptionResponse]{ + More: func(page ProximityPlacementGroupsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProximityPlacementGroupsClientListBySubscriptionResponse) (ProximityPlacementGroupsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProximityPlacementGroupsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProximityPlacementGroupsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProximityPlacementGroupsClientListBySubscriptionResponse, error) { + result := ProximityPlacementGroupsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { + return ProximityPlacementGroupsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a proximity placement group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// proximityPlacementGroupName - The name of the proximity placement group. +// parameters - Parameters supplied to the Update Proximity Placement Group operation. +// options - ProximityPlacementGroupsClientUpdateOptions contains the optional parameters for the ProximityPlacementGroupsClient.Update +// method. +func (client *ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsClientUpdateOptions) (ProximityPlacementGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) + if err != nil { + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if proximityPlacementGroupName == "" { + return nil, errors.New("parameter proximityPlacementGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{proximityPlacementGroupName}", url.PathEscape(proximityPlacementGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *ProximityPlacementGroupsClient) updateHandleResponse(resp *http.Response) (ProximityPlacementGroupsClientUpdateResponse, error) { + result := ProximityPlacementGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/resourceskus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/resourceskus_client.go new file mode 100644 index 000000000..cd2b9723f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/resourceskus_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceSKUsClient contains the methods for the ResourceSKUs group. +// Don't use this type directly, use NewResourceSKUsClient() instead. +type ResourceSKUsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewResourceSKUsClient creates a new instance of ResourceSKUsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceSKUsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ResourceSKUsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets the list of Microsoft.Compute SKUs available for your Subscription. +// Generated from API version 2021-07-01 +// options - ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.List method. +func (client *ResourceSKUsClient) NewListPager(options *ResourceSKUsClientListOptions) *runtime.Pager[ResourceSKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceSKUsClientListResponse]{ + More: func(page ResourceSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceSKUsClientListResponse) (ResourceSKUsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceSKUsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceSKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceSKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options *ResourceSKUsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.IncludeExtendedLocations != nil { + reqQP.Set("includeExtendedLocations", *options.IncludeExtendedLocations) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ResourceSKUsClient) listHandleResponse(resp *http.Response) (ResourceSKUsClientListResponse, error) { + result := ResourceSKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUsResult); err != nil { + return ResourceSKUsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/response_types.go new file mode 100644 index 000000000..5f2140268 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/response_types.go @@ -0,0 +1,1419 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import "io" + +// AvailabilitySetsClientCreateOrUpdateResponse contains the response from method AvailabilitySetsClient.CreateOrUpdate. +type AvailabilitySetsClientCreateOrUpdateResponse struct { + AvailabilitySet +} + +// AvailabilitySetsClientDeleteResponse contains the response from method AvailabilitySetsClient.Delete. +type AvailabilitySetsClientDeleteResponse struct { + // placeholder for future response values +} + +// AvailabilitySetsClientGetResponse contains the response from method AvailabilitySetsClient.Get. +type AvailabilitySetsClientGetResponse struct { + AvailabilitySet +} + +// AvailabilitySetsClientListAvailableSizesResponse contains the response from method AvailabilitySetsClient.ListAvailableSizes. +type AvailabilitySetsClientListAvailableSizesResponse struct { + VirtualMachineSizeListResult +} + +// AvailabilitySetsClientListBySubscriptionResponse contains the response from method AvailabilitySetsClient.ListBySubscription. +type AvailabilitySetsClientListBySubscriptionResponse struct { + AvailabilitySetListResult +} + +// AvailabilitySetsClientListResponse contains the response from method AvailabilitySetsClient.List. +type AvailabilitySetsClientListResponse struct { + AvailabilitySetListResult +} + +// AvailabilitySetsClientUpdateResponse contains the response from method AvailabilitySetsClient.Update. +type AvailabilitySetsClientUpdateResponse struct { + AvailabilitySet +} + +// CapacityReservationGroupsClientCreateOrUpdateResponse contains the response from method CapacityReservationGroupsClient.CreateOrUpdate. +type CapacityReservationGroupsClientCreateOrUpdateResponse struct { + CapacityReservationGroup +} + +// CapacityReservationGroupsClientDeleteResponse contains the response from method CapacityReservationGroupsClient.Delete. +type CapacityReservationGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// CapacityReservationGroupsClientGetResponse contains the response from method CapacityReservationGroupsClient.Get. +type CapacityReservationGroupsClientGetResponse struct { + CapacityReservationGroup +} + +// CapacityReservationGroupsClientListByResourceGroupResponse contains the response from method CapacityReservationGroupsClient.ListByResourceGroup. +type CapacityReservationGroupsClientListByResourceGroupResponse struct { + CapacityReservationGroupListResult +} + +// CapacityReservationGroupsClientListBySubscriptionResponse contains the response from method CapacityReservationGroupsClient.ListBySubscription. +type CapacityReservationGroupsClientListBySubscriptionResponse struct { + CapacityReservationGroupListResult +} + +// CapacityReservationGroupsClientUpdateResponse contains the response from method CapacityReservationGroupsClient.Update. +type CapacityReservationGroupsClientUpdateResponse struct { + CapacityReservationGroup +} + +// CapacityReservationsClientCreateOrUpdateResponse contains the response from method CapacityReservationsClient.CreateOrUpdate. +type CapacityReservationsClientCreateOrUpdateResponse struct { + CapacityReservation +} + +// CapacityReservationsClientDeleteResponse contains the response from method CapacityReservationsClient.Delete. +type CapacityReservationsClientDeleteResponse struct { + // placeholder for future response values +} + +// CapacityReservationsClientGetResponse contains the response from method CapacityReservationsClient.Get. +type CapacityReservationsClientGetResponse struct { + CapacityReservation +} + +// CapacityReservationsClientListByCapacityReservationGroupResponse contains the response from method CapacityReservationsClient.ListByCapacityReservationGroup. +type CapacityReservationsClientListByCapacityReservationGroupResponse struct { + CapacityReservationListResult +} + +// CapacityReservationsClientUpdateResponse contains the response from method CapacityReservationsClient.Update. +type CapacityReservationsClientUpdateResponse struct { + CapacityReservation +} + +// CloudServiceOperatingSystemsClientGetOSFamilyResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSFamily. +type CloudServiceOperatingSystemsClientGetOSFamilyResponse struct { + OSFamily +} + +// CloudServiceOperatingSystemsClientGetOSVersionResponse contains the response from method CloudServiceOperatingSystemsClient.GetOSVersion. +type CloudServiceOperatingSystemsClientGetOSVersionResponse struct { + OSVersion +} + +// CloudServiceOperatingSystemsClientListOSFamiliesResponse contains the response from method CloudServiceOperatingSystemsClient.ListOSFamilies. +type CloudServiceOperatingSystemsClientListOSFamiliesResponse struct { + OSFamilyListResult +} + +// CloudServiceOperatingSystemsClientListOSVersionsResponse contains the response from method CloudServiceOperatingSystemsClient.ListOSVersions. +type CloudServiceOperatingSystemsClientListOSVersionsResponse struct { + OSVersionListResult +} + +// CloudServiceRoleInstancesClientDeleteResponse contains the response from method CloudServiceRoleInstancesClient.Delete. +type CloudServiceRoleInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientGetInstanceViewResponse contains the response from method CloudServiceRoleInstancesClient.GetInstanceView. +type CloudServiceRoleInstancesClientGetInstanceViewResponse struct { + RoleInstanceView +} + +// CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse contains the response from method CloudServiceRoleInstancesClient.GetRemoteDesktopFile. +type CloudServiceRoleInstancesClientGetRemoteDesktopFileResponse struct { + // Body contains the streaming response. + Body io.ReadCloser +} + +// CloudServiceRoleInstancesClientGetResponse contains the response from method CloudServiceRoleInstancesClient.Get. +type CloudServiceRoleInstancesClientGetResponse struct { + RoleInstance +} + +// CloudServiceRoleInstancesClientListResponse contains the response from method CloudServiceRoleInstancesClient.List. +type CloudServiceRoleInstancesClientListResponse struct { + RoleInstanceListResult +} + +// CloudServiceRoleInstancesClientRebuildResponse contains the response from method CloudServiceRoleInstancesClient.Rebuild. +type CloudServiceRoleInstancesClientRebuildResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientReimageResponse contains the response from method CloudServiceRoleInstancesClient.Reimage. +type CloudServiceRoleInstancesClientReimageResponse struct { + // placeholder for future response values +} + +// CloudServiceRoleInstancesClientRestartResponse contains the response from method CloudServiceRoleInstancesClient.Restart. +type CloudServiceRoleInstancesClientRestartResponse struct { + // placeholder for future response values +} + +// CloudServiceRolesClientGetResponse contains the response from method CloudServiceRolesClient.Get. +type CloudServiceRolesClientGetResponse struct { + CloudServiceRole +} + +// CloudServiceRolesClientListResponse contains the response from method CloudServiceRolesClient.List. +type CloudServiceRolesClientListResponse struct { + CloudServiceRoleListResult +} + +// CloudServicesClientCreateOrUpdateResponse contains the response from method CloudServicesClient.CreateOrUpdate. +type CloudServicesClientCreateOrUpdateResponse struct { + CloudService +} + +// CloudServicesClientDeleteInstancesResponse contains the response from method CloudServicesClient.DeleteInstances. +type CloudServicesClientDeleteInstancesResponse struct { + // placeholder for future response values +} + +// CloudServicesClientDeleteResponse contains the response from method CloudServicesClient.Delete. +type CloudServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// CloudServicesClientGetInstanceViewResponse contains the response from method CloudServicesClient.GetInstanceView. +type CloudServicesClientGetInstanceViewResponse struct { + CloudServiceInstanceView +} + +// CloudServicesClientGetResponse contains the response from method CloudServicesClient.Get. +type CloudServicesClientGetResponse struct { + CloudService +} + +// CloudServicesClientListAllResponse contains the response from method CloudServicesClient.ListAll. +type CloudServicesClientListAllResponse struct { + CloudServiceListResult +} + +// CloudServicesClientListResponse contains the response from method CloudServicesClient.List. +type CloudServicesClientListResponse struct { + CloudServiceListResult +} + +// CloudServicesClientPowerOffResponse contains the response from method CloudServicesClient.PowerOff. +type CloudServicesClientPowerOffResponse struct { + // placeholder for future response values +} + +// CloudServicesClientRebuildResponse contains the response from method CloudServicesClient.Rebuild. +type CloudServicesClientRebuildResponse struct { + // placeholder for future response values +} + +// CloudServicesClientReimageResponse contains the response from method CloudServicesClient.Reimage. +type CloudServicesClientReimageResponse struct { + // placeholder for future response values +} + +// CloudServicesClientRestartResponse contains the response from method CloudServicesClient.Restart. +type CloudServicesClientRestartResponse struct { + // placeholder for future response values +} + +// CloudServicesClientStartResponse contains the response from method CloudServicesClient.Start. +type CloudServicesClientStartResponse struct { + // placeholder for future response values +} + +// CloudServicesClientUpdateResponse contains the response from method CloudServicesClient.Update. +type CloudServicesClientUpdateResponse struct { + CloudService +} + +// CloudServicesUpdateDomainClientGetUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.GetUpdateDomain. +type CloudServicesUpdateDomainClientGetUpdateDomainResponse struct { + UpdateDomain +} + +// CloudServicesUpdateDomainClientListUpdateDomainsResponse contains the response from method CloudServicesUpdateDomainClient.ListUpdateDomains. +type CloudServicesUpdateDomainClientListUpdateDomainsResponse struct { + UpdateDomainListResult +} + +// CloudServicesUpdateDomainClientWalkUpdateDomainResponse contains the response from method CloudServicesUpdateDomainClient.WalkUpdateDomain. +type CloudServicesUpdateDomainClientWalkUpdateDomainResponse struct { + // placeholder for future response values +} + +// CommunityGalleriesClientGetResponse contains the response from method CommunityGalleriesClient.Get. +type CommunityGalleriesClientGetResponse struct { + CommunityGallery +} + +// CommunityGalleryImageVersionsClientGetResponse contains the response from method CommunityGalleryImageVersionsClient.Get. +type CommunityGalleryImageVersionsClientGetResponse struct { + CommunityGalleryImageVersion +} + +// CommunityGalleryImageVersionsClientListResponse contains the response from method CommunityGalleryImageVersionsClient.List. +type CommunityGalleryImageVersionsClientListResponse struct { + CommunityGalleryImageVersionList +} + +// CommunityGalleryImagesClientGetResponse contains the response from method CommunityGalleryImagesClient.Get. +type CommunityGalleryImagesClientGetResponse struct { + CommunityGalleryImage +} + +// CommunityGalleryImagesClientListResponse contains the response from method CommunityGalleryImagesClient.List. +type CommunityGalleryImagesClientListResponse struct { + CommunityGalleryImageList +} + +// DedicatedHostGroupsClientCreateOrUpdateResponse contains the response from method DedicatedHostGroupsClient.CreateOrUpdate. +type DedicatedHostGroupsClientCreateOrUpdateResponse struct { + DedicatedHostGroup +} + +// DedicatedHostGroupsClientDeleteResponse contains the response from method DedicatedHostGroupsClient.Delete. +type DedicatedHostGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// DedicatedHostGroupsClientGetResponse contains the response from method DedicatedHostGroupsClient.Get. +type DedicatedHostGroupsClientGetResponse struct { + DedicatedHostGroup +} + +// DedicatedHostGroupsClientListByResourceGroupResponse contains the response from method DedicatedHostGroupsClient.ListByResourceGroup. +type DedicatedHostGroupsClientListByResourceGroupResponse struct { + DedicatedHostGroupListResult +} + +// DedicatedHostGroupsClientListBySubscriptionResponse contains the response from method DedicatedHostGroupsClient.ListBySubscription. +type DedicatedHostGroupsClientListBySubscriptionResponse struct { + DedicatedHostGroupListResult +} + +// DedicatedHostGroupsClientUpdateResponse contains the response from method DedicatedHostGroupsClient.Update. +type DedicatedHostGroupsClientUpdateResponse struct { + DedicatedHostGroup +} + +// DedicatedHostsClientCreateOrUpdateResponse contains the response from method DedicatedHostsClient.CreateOrUpdate. +type DedicatedHostsClientCreateOrUpdateResponse struct { + DedicatedHost +} + +// DedicatedHostsClientDeleteResponse contains the response from method DedicatedHostsClient.Delete. +type DedicatedHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// DedicatedHostsClientGetResponse contains the response from method DedicatedHostsClient.Get. +type DedicatedHostsClientGetResponse struct { + DedicatedHost +} + +// DedicatedHostsClientListByHostGroupResponse contains the response from method DedicatedHostsClient.ListByHostGroup. +type DedicatedHostsClientListByHostGroupResponse struct { + DedicatedHostListResult +} + +// DedicatedHostsClientRestartResponse contains the response from method DedicatedHostsClient.Restart. +type DedicatedHostsClientRestartResponse struct { + // placeholder for future response values +} + +// DedicatedHostsClientUpdateResponse contains the response from method DedicatedHostsClient.Update. +type DedicatedHostsClientUpdateResponse struct { + DedicatedHost +} + +// DiskAccessesClientCreateOrUpdateResponse contains the response from method DiskAccessesClient.CreateOrUpdate. +type DiskAccessesClientCreateOrUpdateResponse struct { + DiskAccess +} + +// DiskAccessesClientDeleteAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.DeleteAPrivateEndpointConnection. +type DiskAccessesClientDeleteAPrivateEndpointConnectionResponse struct { + // placeholder for future response values +} + +// DiskAccessesClientDeleteResponse contains the response from method DiskAccessesClient.Delete. +type DiskAccessesClientDeleteResponse struct { + // placeholder for future response values +} + +// DiskAccessesClientGetAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.GetAPrivateEndpointConnection. +type DiskAccessesClientGetAPrivateEndpointConnectionResponse struct { + PrivateEndpointConnection +} + +// DiskAccessesClientGetPrivateLinkResourcesResponse contains the response from method DiskAccessesClient.GetPrivateLinkResources. +type DiskAccessesClientGetPrivateLinkResourcesResponse struct { + PrivateLinkResourceListResult +} + +// DiskAccessesClientGetResponse contains the response from method DiskAccessesClient.Get. +type DiskAccessesClientGetResponse struct { + DiskAccess +} + +// DiskAccessesClientListByResourceGroupResponse contains the response from method DiskAccessesClient.ListByResourceGroup. +type DiskAccessesClientListByResourceGroupResponse struct { + DiskAccessList +} + +// DiskAccessesClientListPrivateEndpointConnectionsResponse contains the response from method DiskAccessesClient.ListPrivateEndpointConnections. +type DiskAccessesClientListPrivateEndpointConnectionsResponse struct { + PrivateEndpointConnectionListResult +} + +// DiskAccessesClientListResponse contains the response from method DiskAccessesClient.List. +type DiskAccessesClientListResponse struct { + DiskAccessList +} + +// DiskAccessesClientUpdateAPrivateEndpointConnectionResponse contains the response from method DiskAccessesClient.UpdateAPrivateEndpointConnection. +type DiskAccessesClientUpdateAPrivateEndpointConnectionResponse struct { + PrivateEndpointConnection +} + +// DiskAccessesClientUpdateResponse contains the response from method DiskAccessesClient.Update. +type DiskAccessesClientUpdateResponse struct { + DiskAccess +} + +// DiskEncryptionSetsClientCreateOrUpdateResponse contains the response from method DiskEncryptionSetsClient.CreateOrUpdate. +type DiskEncryptionSetsClientCreateOrUpdateResponse struct { + DiskEncryptionSet +} + +// DiskEncryptionSetsClientDeleteResponse contains the response from method DiskEncryptionSetsClient.Delete. +type DiskEncryptionSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// DiskEncryptionSetsClientGetResponse contains the response from method DiskEncryptionSetsClient.Get. +type DiskEncryptionSetsClientGetResponse struct { + DiskEncryptionSet +} + +// DiskEncryptionSetsClientListAssociatedResourcesResponse contains the response from method DiskEncryptionSetsClient.ListAssociatedResources. +type DiskEncryptionSetsClientListAssociatedResourcesResponse struct { + ResourceURIList +} + +// DiskEncryptionSetsClientListByResourceGroupResponse contains the response from method DiskEncryptionSetsClient.ListByResourceGroup. +type DiskEncryptionSetsClientListByResourceGroupResponse struct { + DiskEncryptionSetList +} + +// DiskEncryptionSetsClientListResponse contains the response from method DiskEncryptionSetsClient.List. +type DiskEncryptionSetsClientListResponse struct { + DiskEncryptionSetList +} + +// DiskEncryptionSetsClientUpdateResponse contains the response from method DiskEncryptionSetsClient.Update. +type DiskEncryptionSetsClientUpdateResponse struct { + DiskEncryptionSet +} + +// DiskRestorePointClientGetResponse contains the response from method DiskRestorePointClient.Get. +type DiskRestorePointClientGetResponse struct { + DiskRestorePoint +} + +// DiskRestorePointClientGrantAccessResponse contains the response from method DiskRestorePointClient.GrantAccess. +type DiskRestorePointClientGrantAccessResponse struct { + AccessURI +} + +// DiskRestorePointClientListByRestorePointResponse contains the response from method DiskRestorePointClient.ListByRestorePoint. +type DiskRestorePointClientListByRestorePointResponse struct { + DiskRestorePointList +} + +// DiskRestorePointClientRevokeAccessResponse contains the response from method DiskRestorePointClient.RevokeAccess. +type DiskRestorePointClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// DisksClientCreateOrUpdateResponse contains the response from method DisksClient.CreateOrUpdate. +type DisksClientCreateOrUpdateResponse struct { + Disk +} + +// DisksClientDeleteResponse contains the response from method DisksClient.Delete. +type DisksClientDeleteResponse struct { + // placeholder for future response values +} + +// DisksClientGetResponse contains the response from method DisksClient.Get. +type DisksClientGetResponse struct { + Disk +} + +// DisksClientGrantAccessResponse contains the response from method DisksClient.GrantAccess. +type DisksClientGrantAccessResponse struct { + AccessURI +} + +// DisksClientListByResourceGroupResponse contains the response from method DisksClient.ListByResourceGroup. +type DisksClientListByResourceGroupResponse struct { + DiskList +} + +// DisksClientListResponse contains the response from method DisksClient.List. +type DisksClientListResponse struct { + DiskList +} + +// DisksClientRevokeAccessResponse contains the response from method DisksClient.RevokeAccess. +type DisksClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// DisksClientUpdateResponse contains the response from method DisksClient.Update. +type DisksClientUpdateResponse struct { + Disk +} + +// GalleriesClientCreateOrUpdateResponse contains the response from method GalleriesClient.CreateOrUpdate. +type GalleriesClientCreateOrUpdateResponse struct { + Gallery +} + +// GalleriesClientDeleteResponse contains the response from method GalleriesClient.Delete. +type GalleriesClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleriesClientGetResponse contains the response from method GalleriesClient.Get. +type GalleriesClientGetResponse struct { + Gallery +} + +// GalleriesClientListByResourceGroupResponse contains the response from method GalleriesClient.ListByResourceGroup. +type GalleriesClientListByResourceGroupResponse struct { + GalleryList +} + +// GalleriesClientListResponse contains the response from method GalleriesClient.List. +type GalleriesClientListResponse struct { + GalleryList +} + +// GalleriesClientUpdateResponse contains the response from method GalleriesClient.Update. +type GalleriesClientUpdateResponse struct { + Gallery +} + +// GalleryApplicationVersionsClientCreateOrUpdateResponse contains the response from method GalleryApplicationVersionsClient.CreateOrUpdate. +type GalleryApplicationVersionsClientCreateOrUpdateResponse struct { + GalleryApplicationVersion +} + +// GalleryApplicationVersionsClientDeleteResponse contains the response from method GalleryApplicationVersionsClient.Delete. +type GalleryApplicationVersionsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryApplicationVersionsClientGetResponse contains the response from method GalleryApplicationVersionsClient.Get. +type GalleryApplicationVersionsClientGetResponse struct { + GalleryApplicationVersion +} + +// GalleryApplicationVersionsClientListByGalleryApplicationResponse contains the response from method GalleryApplicationVersionsClient.ListByGalleryApplication. +type GalleryApplicationVersionsClientListByGalleryApplicationResponse struct { + GalleryApplicationVersionList +} + +// GalleryApplicationVersionsClientUpdateResponse contains the response from method GalleryApplicationVersionsClient.Update. +type GalleryApplicationVersionsClientUpdateResponse struct { + GalleryApplicationVersion +} + +// GalleryApplicationsClientCreateOrUpdateResponse contains the response from method GalleryApplicationsClient.CreateOrUpdate. +type GalleryApplicationsClientCreateOrUpdateResponse struct { + GalleryApplication +} + +// GalleryApplicationsClientDeleteResponse contains the response from method GalleryApplicationsClient.Delete. +type GalleryApplicationsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryApplicationsClientGetResponse contains the response from method GalleryApplicationsClient.Get. +type GalleryApplicationsClientGetResponse struct { + GalleryApplication +} + +// GalleryApplicationsClientListByGalleryResponse contains the response from method GalleryApplicationsClient.ListByGallery. +type GalleryApplicationsClientListByGalleryResponse struct { + GalleryApplicationList +} + +// GalleryApplicationsClientUpdateResponse contains the response from method GalleryApplicationsClient.Update. +type GalleryApplicationsClientUpdateResponse struct { + GalleryApplication +} + +// GalleryImageVersionsClientCreateOrUpdateResponse contains the response from method GalleryImageVersionsClient.CreateOrUpdate. +type GalleryImageVersionsClientCreateOrUpdateResponse struct { + GalleryImageVersion +} + +// GalleryImageVersionsClientDeleteResponse contains the response from method GalleryImageVersionsClient.Delete. +type GalleryImageVersionsClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryImageVersionsClientGetResponse contains the response from method GalleryImageVersionsClient.Get. +type GalleryImageVersionsClientGetResponse struct { + GalleryImageVersion +} + +// GalleryImageVersionsClientListByGalleryImageResponse contains the response from method GalleryImageVersionsClient.ListByGalleryImage. +type GalleryImageVersionsClientListByGalleryImageResponse struct { + GalleryImageVersionList +} + +// GalleryImageVersionsClientUpdateResponse contains the response from method GalleryImageVersionsClient.Update. +type GalleryImageVersionsClientUpdateResponse struct { + GalleryImageVersion +} + +// GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.CreateOrUpdate. +type GalleryImagesClientCreateOrUpdateResponse struct { + GalleryImage +} + +// GalleryImagesClientDeleteResponse contains the response from method GalleryImagesClient.Delete. +type GalleryImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// GalleryImagesClientGetResponse contains the response from method GalleryImagesClient.Get. +type GalleryImagesClientGetResponse struct { + GalleryImage +} + +// GalleryImagesClientListByGalleryResponse contains the response from method GalleryImagesClient.ListByGallery. +type GalleryImagesClientListByGalleryResponse struct { + GalleryImageList +} + +// GalleryImagesClientUpdateResponse contains the response from method GalleryImagesClient.Update. +type GalleryImagesClientUpdateResponse struct { + GalleryImage +} + +// GallerySharingProfileClientUpdateResponse contains the response from method GallerySharingProfileClient.Update. +type GallerySharingProfileClientUpdateResponse struct { + SharingUpdate +} + +// ImagesClientCreateOrUpdateResponse contains the response from method ImagesClient.CreateOrUpdate. +type ImagesClientCreateOrUpdateResponse struct { + Image +} + +// ImagesClientDeleteResponse contains the response from method ImagesClient.Delete. +type ImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// ImagesClientGetResponse contains the response from method ImagesClient.Get. +type ImagesClientGetResponse struct { + Image +} + +// ImagesClientListByResourceGroupResponse contains the response from method ImagesClient.ListByResourceGroup. +type ImagesClientListByResourceGroupResponse struct { + ImageListResult +} + +// ImagesClientListResponse contains the response from method ImagesClient.List. +type ImagesClientListResponse struct { + ImageListResult +} + +// ImagesClientUpdateResponse contains the response from method ImagesClient.Update. +type ImagesClientUpdateResponse struct { + Image +} + +// LogAnalyticsClientExportRequestRateByIntervalResponse contains the response from method LogAnalyticsClient.ExportRequestRateByInterval. +type LogAnalyticsClientExportRequestRateByIntervalResponse struct { + LogAnalyticsOperationResult +} + +// LogAnalyticsClientExportThrottledRequestsResponse contains the response from method LogAnalyticsClient.ExportThrottledRequests. +type LogAnalyticsClientExportThrottledRequestsResponse struct { + LogAnalyticsOperationResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} + +// ProximityPlacementGroupsClientCreateOrUpdateResponse contains the response from method ProximityPlacementGroupsClient.CreateOrUpdate. +type ProximityPlacementGroupsClientCreateOrUpdateResponse struct { + ProximityPlacementGroup +} + +// ProximityPlacementGroupsClientDeleteResponse contains the response from method ProximityPlacementGroupsClient.Delete. +type ProximityPlacementGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ProximityPlacementGroupsClientGetResponse contains the response from method ProximityPlacementGroupsClient.Get. +type ProximityPlacementGroupsClientGetResponse struct { + ProximityPlacementGroup +} + +// ProximityPlacementGroupsClientListByResourceGroupResponse contains the response from method ProximityPlacementGroupsClient.ListByResourceGroup. +type ProximityPlacementGroupsClientListByResourceGroupResponse struct { + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsClientListBySubscriptionResponse contains the response from method ProximityPlacementGroupsClient.ListBySubscription. +type ProximityPlacementGroupsClientListBySubscriptionResponse struct { + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsClientUpdateResponse contains the response from method ProximityPlacementGroupsClient.Update. +type ProximityPlacementGroupsClientUpdateResponse struct { + ProximityPlacementGroup +} + +// ResourceSKUsClientListResponse contains the response from method ResourceSKUsClient.List. +type ResourceSKUsClientListResponse struct { + ResourceSKUsResult +} + +// RestorePointCollectionsClientCreateOrUpdateResponse contains the response from method RestorePointCollectionsClient.CreateOrUpdate. +type RestorePointCollectionsClientCreateOrUpdateResponse struct { + RestorePointCollection +} + +// RestorePointCollectionsClientDeleteResponse contains the response from method RestorePointCollectionsClient.Delete. +type RestorePointCollectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// RestorePointCollectionsClientGetResponse contains the response from method RestorePointCollectionsClient.Get. +type RestorePointCollectionsClientGetResponse struct { + RestorePointCollection +} + +// RestorePointCollectionsClientListAllResponse contains the response from method RestorePointCollectionsClient.ListAll. +type RestorePointCollectionsClientListAllResponse struct { + RestorePointCollectionListResult +} + +// RestorePointCollectionsClientListResponse contains the response from method RestorePointCollectionsClient.List. +type RestorePointCollectionsClientListResponse struct { + RestorePointCollectionListResult +} + +// RestorePointCollectionsClientUpdateResponse contains the response from method RestorePointCollectionsClient.Update. +type RestorePointCollectionsClientUpdateResponse struct { + RestorePointCollection +} + +// RestorePointsClientCreateResponse contains the response from method RestorePointsClient.Create. +type RestorePointsClientCreateResponse struct { + RestorePoint +} + +// RestorePointsClientDeleteResponse contains the response from method RestorePointsClient.Delete. +type RestorePointsClientDeleteResponse struct { + // placeholder for future response values +} + +// RestorePointsClientGetResponse contains the response from method RestorePointsClient.Get. +type RestorePointsClientGetResponse struct { + RestorePoint +} + +// SSHPublicKeysClientCreateResponse contains the response from method SSHPublicKeysClient.Create. +type SSHPublicKeysClientCreateResponse struct { + SSHPublicKeyResource +} + +// SSHPublicKeysClientDeleteResponse contains the response from method SSHPublicKeysClient.Delete. +type SSHPublicKeysClientDeleteResponse struct { + // placeholder for future response values +} + +// SSHPublicKeysClientGenerateKeyPairResponse contains the response from method SSHPublicKeysClient.GenerateKeyPair. +type SSHPublicKeysClientGenerateKeyPairResponse struct { + SSHPublicKeyGenerateKeyPairResult +} + +// SSHPublicKeysClientGetResponse contains the response from method SSHPublicKeysClient.Get. +type SSHPublicKeysClientGetResponse struct { + SSHPublicKeyResource +} + +// SSHPublicKeysClientListByResourceGroupResponse contains the response from method SSHPublicKeysClient.ListByResourceGroup. +type SSHPublicKeysClientListByResourceGroupResponse struct { + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysClientListBySubscriptionResponse contains the response from method SSHPublicKeysClient.ListBySubscription. +type SSHPublicKeysClientListBySubscriptionResponse struct { + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysClientUpdateResponse contains the response from method SSHPublicKeysClient.Update. +type SSHPublicKeysClientUpdateResponse struct { + SSHPublicKeyResource +} + +// SharedGalleriesClientGetResponse contains the response from method SharedGalleriesClient.Get. +type SharedGalleriesClientGetResponse struct { + SharedGallery +} + +// SharedGalleriesClientListResponse contains the response from method SharedGalleriesClient.List. +type SharedGalleriesClientListResponse struct { + SharedGalleryList +} + +// SharedGalleryImageVersionsClientGetResponse contains the response from method SharedGalleryImageVersionsClient.Get. +type SharedGalleryImageVersionsClientGetResponse struct { + SharedGalleryImageVersion +} + +// SharedGalleryImageVersionsClientListResponse contains the response from method SharedGalleryImageVersionsClient.List. +type SharedGalleryImageVersionsClientListResponse struct { + SharedGalleryImageVersionList +} + +// SharedGalleryImagesClientGetResponse contains the response from method SharedGalleryImagesClient.Get. +type SharedGalleryImagesClientGetResponse struct { + SharedGalleryImage +} + +// SharedGalleryImagesClientListResponse contains the response from method SharedGalleryImagesClient.List. +type SharedGalleryImagesClientListResponse struct { + SharedGalleryImageList +} + +// SnapshotsClientCreateOrUpdateResponse contains the response from method SnapshotsClient.CreateOrUpdate. +type SnapshotsClientCreateOrUpdateResponse struct { + Snapshot +} + +// SnapshotsClientDeleteResponse contains the response from method SnapshotsClient.Delete. +type SnapshotsClientDeleteResponse struct { + // placeholder for future response values +} + +// SnapshotsClientGetResponse contains the response from method SnapshotsClient.Get. +type SnapshotsClientGetResponse struct { + Snapshot +} + +// SnapshotsClientGrantAccessResponse contains the response from method SnapshotsClient.GrantAccess. +type SnapshotsClientGrantAccessResponse struct { + AccessURI +} + +// SnapshotsClientListByResourceGroupResponse contains the response from method SnapshotsClient.ListByResourceGroup. +type SnapshotsClientListByResourceGroupResponse struct { + SnapshotList +} + +// SnapshotsClientListResponse contains the response from method SnapshotsClient.List. +type SnapshotsClientListResponse struct { + SnapshotList +} + +// SnapshotsClientRevokeAccessResponse contains the response from method SnapshotsClient.RevokeAccess. +type SnapshotsClientRevokeAccessResponse struct { + // placeholder for future response values +} + +// SnapshotsClientUpdateResponse contains the response from method SnapshotsClient.Update. +type SnapshotsClientUpdateResponse struct { + Snapshot +} + +// UsageClientListResponse contains the response from method UsageClient.List. +type UsageClientListResponse struct { + ListUsagesResult +} + +// VirtualMachineExtensionImagesClientGetResponse contains the response from method VirtualMachineExtensionImagesClient.Get. +type VirtualMachineExtensionImagesClientGetResponse struct { + VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesClientListTypesResponse contains the response from method VirtualMachineExtensionImagesClient.ListTypes. +type VirtualMachineExtensionImagesClientListTypesResponse struct { + // Array of VirtualMachineExtensionImage + VirtualMachineExtensionImageArray []*VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesClientListVersionsResponse contains the response from method VirtualMachineExtensionImagesClient.ListVersions. +type VirtualMachineExtensionImagesClientListVersionsResponse struct { + // Array of VirtualMachineExtensionImage + VirtualMachineExtensionImageArray []*VirtualMachineExtensionImage +} + +// VirtualMachineExtensionsClientCreateOrUpdateResponse contains the response from method VirtualMachineExtensionsClient.CreateOrUpdate. +type VirtualMachineExtensionsClientCreateOrUpdateResponse struct { + VirtualMachineExtension +} + +// VirtualMachineExtensionsClientDeleteResponse contains the response from method VirtualMachineExtensionsClient.Delete. +type VirtualMachineExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineExtensionsClientGetResponse contains the response from method VirtualMachineExtensionsClient.Get. +type VirtualMachineExtensionsClientGetResponse struct { + VirtualMachineExtension +} + +// VirtualMachineExtensionsClientListResponse contains the response from method VirtualMachineExtensionsClient.List. +type VirtualMachineExtensionsClientListResponse struct { + VirtualMachineExtensionsListResult +} + +// VirtualMachineExtensionsClientUpdateResponse contains the response from method VirtualMachineExtensionsClient.Update. +type VirtualMachineExtensionsClientUpdateResponse struct { + VirtualMachineExtension +} + +// VirtualMachineImagesClientGetResponse contains the response from method VirtualMachineImagesClient.Get. +type VirtualMachineImagesClientGetResponse struct { + VirtualMachineImage +} + +// VirtualMachineImagesClientListByEdgeZoneResponse contains the response from method VirtualMachineImagesClient.ListByEdgeZone. +type VirtualMachineImagesClientListByEdgeZoneResponse struct { + VMImagesInEdgeZoneListResult +} + +// VirtualMachineImagesClientListOffersResponse contains the response from method VirtualMachineImagesClient.ListOffers. +type VirtualMachineImagesClientListOffersResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesClientListPublishersResponse contains the response from method VirtualMachineImagesClient.ListPublishers. +type VirtualMachineImagesClientListPublishersResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesClientListResponse contains the response from method VirtualMachineImagesClient.List. +type VirtualMachineImagesClientListResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesClientListSKUsResponse contains the response from method VirtualMachineImagesClient.ListSKUs. +type VirtualMachineImagesClientListSKUsResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneClientGetResponse contains the response from method VirtualMachineImagesEdgeZoneClient.Get. +type VirtualMachineImagesEdgeZoneClientGetResponse struct { + VirtualMachineImage +} + +// VirtualMachineImagesEdgeZoneClientListOffersResponse contains the response from method VirtualMachineImagesEdgeZoneClient.ListOffers. +type VirtualMachineImagesEdgeZoneClientListOffersResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneClientListPublishersResponse contains the response from method VirtualMachineImagesEdgeZoneClient.ListPublishers. +type VirtualMachineImagesEdgeZoneClientListPublishersResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneClientListResponse contains the response from method VirtualMachineImagesEdgeZoneClient.List. +type VirtualMachineImagesEdgeZoneClientListResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneClientListSKUsResponse contains the response from method VirtualMachineImagesEdgeZoneClient.ListSKUs. +type VirtualMachineImagesEdgeZoneClientListSKUsResponse struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineRunCommandsClientCreateOrUpdateResponse contains the response from method VirtualMachineRunCommandsClient.CreateOrUpdate. +type VirtualMachineRunCommandsClientCreateOrUpdateResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsClientDeleteResponse contains the response from method VirtualMachineRunCommandsClient.Delete. +type VirtualMachineRunCommandsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineRunCommandsClientGetByVirtualMachineResponse contains the response from method VirtualMachineRunCommandsClient.GetByVirtualMachine. +type VirtualMachineRunCommandsClientGetByVirtualMachineResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsClientGetResponse contains the response from method VirtualMachineRunCommandsClient.Get. +type VirtualMachineRunCommandsClientGetResponse struct { + RunCommandDocument +} + +// VirtualMachineRunCommandsClientListByVirtualMachineResponse contains the response from method VirtualMachineRunCommandsClient.ListByVirtualMachine. +type VirtualMachineRunCommandsClientListByVirtualMachineResponse struct { + VirtualMachineRunCommandsListResult +} + +// VirtualMachineRunCommandsClientListResponse contains the response from method VirtualMachineRunCommandsClient.List. +type VirtualMachineRunCommandsClientListResponse struct { + RunCommandListResult +} + +// VirtualMachineRunCommandsClientUpdateResponse contains the response from method VirtualMachineRunCommandsClient.Update. +type VirtualMachineRunCommandsClientUpdateResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetExtensionsClient.CreateOrUpdate. +type VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsClientDeleteResponse contains the response from method VirtualMachineScaleSetExtensionsClient.Delete. +type VirtualMachineScaleSetExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetExtensionsClientGetResponse contains the response from method VirtualMachineScaleSetExtensionsClient.Get. +type VirtualMachineScaleSetExtensionsClientGetResponse struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsClientListResponse contains the response from method VirtualMachineScaleSetExtensionsClient.List. +type VirtualMachineScaleSetExtensionsClientListResponse struct { + VirtualMachineScaleSetExtensionListResult +} + +// VirtualMachineScaleSetExtensionsClientUpdateResponse contains the response from method VirtualMachineScaleSetExtensionsClient.Update. +type VirtualMachineScaleSetExtensionsClientUpdateResponse struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetRollingUpgradesClientCancelResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.Cancel. +type VirtualMachineScaleSetRollingUpgradesClientCancelResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.GetLatest. +type VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse struct { + RollingUpgradeStatusInfo +} + +// VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade. +type VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade. +type VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate. +type VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.Delete. +type VirtualMachineScaleSetVMExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMExtensionsClientGetResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.Get. +type VirtualMachineScaleSetVMExtensionsClientGetResponse struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsClientListResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.List. +type VirtualMachineScaleSetVMExtensionsClientListResponse struct { + VirtualMachineScaleSetVMExtensionsListResult +} + +// VirtualMachineScaleSetVMExtensionsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensionsClient.Update. +type VirtualMachineScaleSetVMExtensionsClientUpdateResponse struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate. +type VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.Delete. +type VirtualMachineScaleSetVMRunCommandsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMRunCommandsClientGetResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.Get. +type VirtualMachineScaleSetVMRunCommandsClientGetResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsClientListResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.List. +type VirtualMachineScaleSetVMRunCommandsClientListResponse struct { + VirtualMachineRunCommandsListResult +} + +// VirtualMachineScaleSetVMRunCommandsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommandsClient.Update. +type VirtualMachineScaleSetVMRunCommandsClientUpdateResponse struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMsClientDeallocateResponse contains the response from method VirtualMachineScaleSetVMsClient.Deallocate. +type VirtualMachineScaleSetVMsClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientDeleteResponse contains the response from method VirtualMachineScaleSetVMsClient.Delete. +type VirtualMachineScaleSetVMsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientGetInstanceViewResponse contains the response from method VirtualMachineScaleSetVMsClient.GetInstanceView. +type VirtualMachineScaleSetVMsClientGetInstanceViewResponse struct { + VirtualMachineScaleSetVMInstanceView +} + +// VirtualMachineScaleSetVMsClientGetResponse contains the response from method VirtualMachineScaleSetVMsClient.Get. +type VirtualMachineScaleSetVMsClientGetResponse struct { + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetVMsClientListResponse contains the response from method VirtualMachineScaleSetVMsClient.List. +type VirtualMachineScaleSetVMsClientListResponse struct { + VirtualMachineScaleSetVMListResult +} + +// VirtualMachineScaleSetVMsClientPerformMaintenanceResponse contains the response from method VirtualMachineScaleSetVMsClient.PerformMaintenance. +type VirtualMachineScaleSetVMsClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientPowerOffResponse contains the response from method VirtualMachineScaleSetVMsClient.PowerOff. +type VirtualMachineScaleSetVMsClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRedeployResponse contains the response from method VirtualMachineScaleSetVMsClient.Redeploy. +type VirtualMachineScaleSetVMsClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientReimageAllResponse contains the response from method VirtualMachineScaleSetVMsClient.ReimageAll. +type VirtualMachineScaleSetVMsClientReimageAllResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientReimageResponse contains the response from method VirtualMachineScaleSetVMsClient.Reimage. +type VirtualMachineScaleSetVMsClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRestartResponse contains the response from method VirtualMachineScaleSetVMsClient.Restart. +type VirtualMachineScaleSetVMsClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData. +type VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse struct { + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachineScaleSetVMsClientRunCommandResponse contains the response from method VirtualMachineScaleSetVMsClient.RunCommand. +type VirtualMachineScaleSetVMsClientRunCommandResponse struct { + RunCommandResult +} + +// VirtualMachineScaleSetVMsClientSimulateEvictionResponse contains the response from method VirtualMachineScaleSetVMsClient.SimulateEviction. +type VirtualMachineScaleSetVMsClientSimulateEvictionResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientStartResponse contains the response from method VirtualMachineScaleSetVMsClient.Start. +type VirtualMachineScaleSetVMsClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetVMsClientUpdateResponse contains the response from method VirtualMachineScaleSetVMsClient.Update. +type VirtualMachineScaleSetVMsClientUpdateResponse struct { + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse contains the response from method VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup. +type VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetsClient.CreateOrUpdate. +type VirtualMachineScaleSetsClientCreateOrUpdateResponse struct { + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsClientDeallocateResponse contains the response from method VirtualMachineScaleSetsClient.Deallocate. +type VirtualMachineScaleSetsClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientDeleteInstancesResponse contains the response from method VirtualMachineScaleSetsClient.DeleteInstances. +type VirtualMachineScaleSetsClientDeleteInstancesResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientDeleteResponse contains the response from method VirtualMachineScaleSetsClient.Delete. +type VirtualMachineScaleSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse contains the response from method +// VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk. +type VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse struct { + RecoveryWalkResponse +} + +// VirtualMachineScaleSetsClientGetInstanceViewResponse contains the response from method VirtualMachineScaleSetsClient.GetInstanceView. +type VirtualMachineScaleSetsClientGetInstanceViewResponse struct { + VirtualMachineScaleSetInstanceView +} + +// VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse contains the response from method VirtualMachineScaleSetsClient.GetOSUpgradeHistory. +type VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse struct { + VirtualMachineScaleSetListOSUpgradeHistory +} + +// VirtualMachineScaleSetsClientGetResponse contains the response from method VirtualMachineScaleSetsClient.Get. +type VirtualMachineScaleSetsClientGetResponse struct { + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsClientListAllResponse contains the response from method VirtualMachineScaleSetsClient.ListAll. +type VirtualMachineScaleSetsClientListAllResponse struct { + VirtualMachineScaleSetListWithLinkResult +} + +// VirtualMachineScaleSetsClientListByLocationResponse contains the response from method VirtualMachineScaleSetsClient.ListByLocation. +type VirtualMachineScaleSetsClientListByLocationResponse struct { + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsClientListResponse contains the response from method VirtualMachineScaleSetsClient.List. +type VirtualMachineScaleSetsClientListResponse struct { + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsClientListSKUsResponse contains the response from method VirtualMachineScaleSetsClient.ListSKUs. +type VirtualMachineScaleSetsClientListSKUsResponse struct { + VirtualMachineScaleSetListSKUsResult +} + +// VirtualMachineScaleSetsClientPerformMaintenanceResponse contains the response from method VirtualMachineScaleSetsClient.PerformMaintenance. +type VirtualMachineScaleSetsClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientPowerOffResponse contains the response from method VirtualMachineScaleSetsClient.PowerOff. +type VirtualMachineScaleSetsClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientRedeployResponse contains the response from method VirtualMachineScaleSetsClient.Redeploy. +type VirtualMachineScaleSetsClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientReimageAllResponse contains the response from method VirtualMachineScaleSetsClient.ReimageAll. +type VirtualMachineScaleSetsClientReimageAllResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientReimageResponse contains the response from method VirtualMachineScaleSetsClient.Reimage. +type VirtualMachineScaleSetsClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientRestartResponse contains the response from method VirtualMachineScaleSetsClient.Restart. +type VirtualMachineScaleSetsClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse contains the response from method VirtualMachineScaleSetsClient.SetOrchestrationServiceState. +type VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientStartResponse contains the response from method VirtualMachineScaleSetsClient.Start. +type VirtualMachineScaleSetsClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientUpdateInstancesResponse contains the response from method VirtualMachineScaleSetsClient.UpdateInstances. +type VirtualMachineScaleSetsClientUpdateInstancesResponse struct { + // placeholder for future response values +} + +// VirtualMachineScaleSetsClientUpdateResponse contains the response from method VirtualMachineScaleSetsClient.Update. +type VirtualMachineScaleSetsClientUpdateResponse struct { + VirtualMachineScaleSet +} + +// VirtualMachineSizesClientListResponse contains the response from method VirtualMachineSizesClient.List. +type VirtualMachineSizesClientListResponse struct { + VirtualMachineSizeListResult +} + +// VirtualMachinesClientAssessPatchesResponse contains the response from method VirtualMachinesClient.AssessPatches. +type VirtualMachinesClientAssessPatchesResponse struct { + VirtualMachineAssessPatchesResult +} + +// VirtualMachinesClientCaptureResponse contains the response from method VirtualMachinesClient.Capture. +type VirtualMachinesClientCaptureResponse struct { + VirtualMachineCaptureResult +} + +// VirtualMachinesClientConvertToManagedDisksResponse contains the response from method VirtualMachinesClient.ConvertToManagedDisks. +type VirtualMachinesClientConvertToManagedDisksResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientCreateOrUpdateResponse contains the response from method VirtualMachinesClient.CreateOrUpdate. +type VirtualMachinesClientCreateOrUpdateResponse struct { + VirtualMachine +} + +// VirtualMachinesClientDeallocateResponse contains the response from method VirtualMachinesClient.Deallocate. +type VirtualMachinesClientDeallocateResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientDeleteResponse contains the response from method VirtualMachinesClient.Delete. +type VirtualMachinesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientGeneralizeResponse contains the response from method VirtualMachinesClient.Generalize. +type VirtualMachinesClientGeneralizeResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientGetResponse contains the response from method VirtualMachinesClient.Get. +type VirtualMachinesClientGetResponse struct { + VirtualMachine +} + +// VirtualMachinesClientInstallPatchesResponse contains the response from method VirtualMachinesClient.InstallPatches. +type VirtualMachinesClientInstallPatchesResponse struct { + VirtualMachineInstallPatchesResult +} + +// VirtualMachinesClientInstanceViewResponse contains the response from method VirtualMachinesClient.InstanceView. +type VirtualMachinesClientInstanceViewResponse struct { + VirtualMachineInstanceView +} + +// VirtualMachinesClientListAllResponse contains the response from method VirtualMachinesClient.ListAll. +type VirtualMachinesClientListAllResponse struct { + VirtualMachineListResult +} + +// VirtualMachinesClientListAvailableSizesResponse contains the response from method VirtualMachinesClient.ListAvailableSizes. +type VirtualMachinesClientListAvailableSizesResponse struct { + VirtualMachineSizeListResult +} + +// VirtualMachinesClientListByLocationResponse contains the response from method VirtualMachinesClient.ListByLocation. +type VirtualMachinesClientListByLocationResponse struct { + VirtualMachineListResult +} + +// VirtualMachinesClientListResponse contains the response from method VirtualMachinesClient.List. +type VirtualMachinesClientListResponse struct { + VirtualMachineListResult +} + +// VirtualMachinesClientPerformMaintenanceResponse contains the response from method VirtualMachinesClient.PerformMaintenance. +type VirtualMachinesClientPerformMaintenanceResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientPowerOffResponse contains the response from method VirtualMachinesClient.PowerOff. +type VirtualMachinesClientPowerOffResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientReapplyResponse contains the response from method VirtualMachinesClient.Reapply. +type VirtualMachinesClientReapplyResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRedeployResponse contains the response from method VirtualMachinesClient.Redeploy. +type VirtualMachinesClientRedeployResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientReimageResponse contains the response from method VirtualMachinesClient.Reimage. +type VirtualMachinesClientReimageResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRestartResponse contains the response from method VirtualMachinesClient.Restart. +type VirtualMachinesClientRestartResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachinesClient.RetrieveBootDiagnosticsData. +type VirtualMachinesClientRetrieveBootDiagnosticsDataResponse struct { + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachinesClientRunCommandResponse contains the response from method VirtualMachinesClient.RunCommand. +type VirtualMachinesClientRunCommandResponse struct { + RunCommandResult +} + +// VirtualMachinesClientSimulateEvictionResponse contains the response from method VirtualMachinesClient.SimulateEviction. +type VirtualMachinesClientSimulateEvictionResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientStartResponse contains the response from method VirtualMachinesClient.Start. +type VirtualMachinesClientStartResponse struct { + // placeholder for future response values +} + +// VirtualMachinesClientUpdateResponse contains the response from method VirtualMachinesClient.Update. +type VirtualMachinesClientUpdateResponse struct { + VirtualMachine +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepointcollections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepointcollections_client.go new file mode 100644 index 000000000..d26ba8b6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepointcollections_client.go @@ -0,0 +1,424 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RestorePointCollectionsClient contains the methods for the RestorePointCollections group. +// Don't use this type directly, use NewRestorePointCollectionsClient() instead. +type RestorePointCollectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRestorePointCollectionsClient creates a new instance of RestorePointCollectionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRestorePointCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RestorePointCollectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RestorePointCollectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints +// for more details. When updating a restore point collection, only tags may be modified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection. +// parameters - Parameters supplied to the Create or Update restore point collection operation. +// options - RestorePointCollectionsClientCreateOrUpdateOptions contains the optional parameters for the RestorePointCollectionsClient.CreateOrUpdate +// method. +func (client *RestorePointCollectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsClientCreateOrUpdateOptions) (RestorePointCollectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) + if err != nil { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp *http.Response) (RestorePointCollectionsClientCreateOrUpdateResponse, error) { + result := RestorePointCollectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - The operation to delete the restore point collection. This operation will also delete all the contained restore +// points. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the Restore Point Collection. +// options - RestorePointCollectionsClientBeginDeleteOptions contains the optional parameters for the RestorePointCollectionsClient.BeginDelete +// method. +func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*runtime.Poller[RestorePointCollectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, restorePointCollectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[RestorePointCollectionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[RestorePointCollectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the restore point collection. This operation will also delete all the contained restore +// points. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get the restore point collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection. +// options - RestorePointCollectionsClientGetOptions contains the optional parameters for the RestorePointCollectionsClient.Get +// method. +func (client *RestorePointCollectionsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientGetOptions) (RestorePointCollectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) + if err != nil { + return RestorePointCollectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointCollectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Response) (RestorePointCollectionsClientGetResponse, error) { + result := RestorePointCollectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the list of restore point collections in a resource group. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - RestorePointCollectionsClientListOptions contains the optional parameters for the RestorePointCollectionsClient.List +// method. +func (client *RestorePointCollectionsClient) NewListPager(resourceGroupName string, options *RestorePointCollectionsClientListOptions) *runtime.Pager[RestorePointCollectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RestorePointCollectionsClientListResponse]{ + More: func(page RestorePointCollectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RestorePointCollectionsClientListResponse) (RestorePointCollectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RestorePointCollectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointCollectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *RestorePointCollectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RestorePointCollectionsClient) listHandleResponse(resp *http.Response) (RestorePointCollectionsClientListResponse, error) { + result := RestorePointCollectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { + return RestorePointCollectionsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets the list of restore point collections in the subscription. Use nextLink property in the response +// to get the next page of restore point collections. Do this till nextLink is not null to fetch all +// the restore point collections. +// Generated from API version 2022-08-01 +// options - RestorePointCollectionsClientListAllOptions contains the optional parameters for the RestorePointCollectionsClient.ListAll +// method. +func (client *RestorePointCollectionsClient) NewListAllPager(options *RestorePointCollectionsClientListAllOptions) *runtime.Pager[RestorePointCollectionsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[RestorePointCollectionsClientListAllResponse]{ + More: func(page RestorePointCollectionsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RestorePointCollectionsClientListAllResponse) (RestorePointCollectionsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RestorePointCollectionsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointCollectionsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Context, options *RestorePointCollectionsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *http.Response) (RestorePointCollectionsClientListAllResponse, error) { + result := RestorePointCollectionsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { + return RestorePointCollectionsClientListAllResponse{}, err + } + return result, nil +} + +// Update - The operation to update the restore point collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection. +// parameters - Parameters supplied to the Update restore point collection operation. +// options - RestorePointCollectionsClientUpdateOptions contains the optional parameters for the RestorePointCollectionsClient.Update +// method. +func (client *RestorePointCollectionsClient) Update(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsClientUpdateOptions) (RestorePointCollectionsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) + if err != nil { + return RestorePointCollectionsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointCollectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *RestorePointCollectionsClient) updateHandleResponse(resp *http.Response) (RestorePointCollectionsClientUpdateResponse, error) { + result := RestorePointCollectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepoints_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepoints_client.go new file mode 100644 index 000000000..31b57ce60 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/restorepoints_client.go @@ -0,0 +1,258 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RestorePointsClient contains the methods for the RestorePoints group. +// Don't use this type directly, use NewRestorePointsClient() instead. +type RestorePointsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRestorePointsClient creates a new instance of RestorePointsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RestorePointsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RestorePointsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - The operation to create the restore point. Updating properties of an existing restore point is not allowed +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection. +// restorePointName - The name of the restore point. +// parameters - Parameters supplied to the Create restore point operation. +// options - RestorePointsClientBeginCreateOptions contains the optional parameters for the RestorePointsClient.BeginCreate +// method. +func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*runtime.Poller[RestorePointsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[RestorePointsClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[RestorePointsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - The operation to create the restore point. Updating properties of an existing restore point is not allowed +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *RestorePointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if restorePointName == "" { + return nil, errors.New("parameter restorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - The operation to delete the restore point. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the Restore Point Collection. +// restorePointName - The name of the restore point. +// options - RestorePointsClientBeginDeleteOptions contains the optional parameters for the RestorePointsClient.BeginDelete +// method. +func (client *RestorePointsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*runtime.Poller[RestorePointsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[RestorePointsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[RestorePointsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the restore point. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if restorePointName == "" { + return nil, errors.New("parameter restorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get the restore point. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// restorePointCollectionName - The name of the restore point collection. +// restorePointName - The name of the restore point. +// options - RestorePointsClientGetOptions contains the optional parameters for the RestorePointsClient.Get method. +func (client *RestorePointsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientGetOptions) (RestorePointsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) + if err != nil { + return RestorePointsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RestorePointsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if restorePointName == "" { + return nil, errors.New("parameter restorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RestorePointsClient) getHandleResponse(resp *http.Response) (RestorePointsClientGetResponse, error) { + result := RestorePointsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePoint); err != nil { + return RestorePointsClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleries_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleries_client.go new file mode 100644 index 000000000..69c2582f9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleries_client.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SharedGalleriesClient contains the methods for the SharedGalleries group. +// Don't use this type directly, use NewSharedGalleriesClient() instead. +type SharedGalleriesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSharedGalleriesClient creates a new instance of SharedGalleriesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSharedGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedGalleriesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SharedGalleriesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a shared gallery by subscription id or tenant id. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// galleryUniqueName - The unique name of the Shared Gallery. +// options - SharedGalleriesClientGetOptions contains the optional parameters for the SharedGalleriesClient.Get method. +func (client *SharedGalleriesClient) Get(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesClientGetOptions) (SharedGalleriesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, options) + if err != nil { + return SharedGalleriesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleriesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if galleryUniqueName == "" { + return nil, errors.New("parameter galleryUniqueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SharedGalleriesClient) getHandleResponse(resp *http.Response) (SharedGalleriesClientGetResponse, error) { + result := SharedGalleriesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGallery); err != nil { + return SharedGalleriesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List shared galleries by subscription id or tenant id. +// Generated from API version 2022-03-03 +// location - Resource location. +// options - SharedGalleriesClientListOptions contains the optional parameters for the SharedGalleriesClient.List method. +func (client *SharedGalleriesClient) NewListPager(location string, options *SharedGalleriesClientListOptions) *runtime.Pager[SharedGalleriesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SharedGalleriesClientListResponse]{ + More: func(page SharedGalleriesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SharedGalleriesClientListResponse) (SharedGalleriesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SharedGalleriesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleriesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleriesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, location string, options *SharedGalleriesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + if options != nil && options.SharedTo != nil { + reqQP.Set("sharedTo", string(*options.SharedTo)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SharedGalleriesClient) listHandleResponse(resp *http.Response) (SharedGalleriesClientListResponse, error) { + result := SharedGalleriesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryList); err != nil { + return SharedGalleriesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimages_client.go new file mode 100644 index 000000000..14997eba4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimages_client.go @@ -0,0 +1,190 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SharedGalleryImagesClient contains the methods for the SharedGalleryImages group. +// Don't use this type directly, use NewSharedGalleryImagesClient() instead. +type SharedGalleryImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSharedGalleryImagesClient creates a new instance of SharedGalleryImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSharedGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedGalleryImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SharedGalleryImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a shared gallery image by subscription id or tenant id. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// galleryUniqueName - The unique name of the Shared Gallery. +// galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. +// options - SharedGalleryImagesClientGetOptions contains the optional parameters for the SharedGalleryImagesClient.Get method. +func (client *SharedGalleryImagesClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesClientGetOptions) (SharedGalleryImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) + if err != nil { + return SharedGalleryImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleryImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if galleryUniqueName == "" { + return nil, errors.New("parameter galleryUniqueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SharedGalleryImagesClient) getHandleResponse(resp *http.Response) (SharedGalleryImagesClientGetResponse, error) { + result := SharedGalleryImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImage); err != nil { + return SharedGalleryImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List shared gallery images by subscription id or tenant id. +// Generated from API version 2022-03-03 +// location - Resource location. +// galleryUniqueName - The unique name of the Shared Gallery. +// options - SharedGalleryImagesClientListOptions contains the optional parameters for the SharedGalleryImagesClient.List +// method. +func (client *SharedGalleryImagesClient) NewListPager(location string, galleryUniqueName string, options *SharedGalleryImagesClientListOptions) *runtime.Pager[SharedGalleryImagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SharedGalleryImagesClientListResponse]{ + More: func(page SharedGalleryImagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SharedGalleryImagesClientListResponse) (SharedGalleryImagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, galleryUniqueName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SharedGalleryImagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleryImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleryImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if galleryUniqueName == "" { + return nil, errors.New("parameter galleryUniqueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + if options != nil && options.SharedTo != nil { + reqQP.Set("sharedTo", string(*options.SharedTo)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SharedGalleryImagesClient) listHandleResponse(resp *http.Response) (SharedGalleryImagesClientListResponse, error) { + result := SharedGalleryImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageList); err != nil { + return SharedGalleryImagesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimageversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimageversions_client.go new file mode 100644 index 000000000..37a360eb5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sharedgalleryimageversions_client.go @@ -0,0 +1,203 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SharedGalleryImageVersionsClient contains the methods for the SharedGalleryImageVersions group. +// Don't use this type directly, use NewSharedGalleryImageVersionsClient() instead. +type SharedGalleryImageVersionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSharedGalleryImageVersionsClient creates a new instance of SharedGalleryImageVersionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSharedGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedGalleryImageVersionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SharedGalleryImageVersionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get a shared gallery image version by subscription id or tenant id. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-03 +// location - Resource location. +// galleryUniqueName - The unique name of the Shared Gallery. +// galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. +// galleryImageVersionName - The name of the gallery image version to be created. Needs to follow semantic version name pattern: +// The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. +// Format: .. +// options - SharedGalleryImageVersionsClientGetOptions contains the optional parameters for the SharedGalleryImageVersionsClient.Get +// method. +func (client *SharedGalleryImageVersionsClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsClientGetOptions) (SharedGalleryImageVersionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return SharedGalleryImageVersionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleryImageVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImageVersionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if galleryUniqueName == "" { + return nil, errors.New("parameter galleryUniqueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *http.Response) (SharedGalleryImageVersionsClientGetResponse, error) { + result := SharedGalleryImageVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersion); err != nil { + return SharedGalleryImageVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List shared gallery image versions by subscription id or tenant id. +// Generated from API version 2022-03-03 +// location - Resource location. +// galleryUniqueName - The unique name of the Shared Gallery. +// galleryImageName - The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. +// options - SharedGalleryImageVersionsClientListOptions contains the optional parameters for the SharedGalleryImageVersionsClient.List +// method. +func (client *SharedGalleryImageVersionsClient) NewListPager(location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsClientListOptions) *runtime.Pager[SharedGalleryImageVersionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SharedGalleryImageVersionsClientListResponse]{ + More: func(page SharedGalleryImageVersionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SharedGalleryImageVersionsClientListResponse) (SharedGalleryImageVersionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SharedGalleryImageVersionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SharedGalleryImageVersionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImageVersionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if galleryUniqueName == "" { + return nil, errors.New("parameter galleryUniqueName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-03") + if options != nil && options.SharedTo != nil { + reqQP.Set("sharedTo", string(*options.SharedTo)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SharedGalleryImageVersionsClient) listHandleResponse(resp *http.Response) (SharedGalleryImageVersionsClientListResponse, error) { + result := SharedGalleryImageVersionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersionList); err != nil { + return SharedGalleryImageVersionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/snapshots_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/snapshots_client.go new file mode 100644 index 000000000..3ea75503c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/snapshots_client.go @@ -0,0 +1,565 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SnapshotsClient contains the methods for the Snapshots group. +// Don't use this type directly, use NewSnapshotsClient() instead. +type SnapshotsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SnapshotsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SnapshotsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// snapshot - Snapshot object supplied in the body of the Put disk operation. +// options - SnapshotsClientBeginCreateOrUpdateOptions contains the optional parameters for the SnapshotsClient.BeginCreateOrUpdate +// method. +func (client *SnapshotsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SnapshotsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SnapshotsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[SnapshotsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *SnapshotsClient) createOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, snapshot) +} + +// BeginDelete - Deletes a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// options - SnapshotsClientBeginDeleteOptions contains the optional parameters for the SnapshotsClient.BeginDelete method. +func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*runtime.Poller[SnapshotsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SnapshotsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[SnapshotsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets information about a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsClientGetResponse, error) { + result := SnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsClientGetResponse{}, err + } + return result, nil +} + +// BeginGrantAccess - Grants access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// grantAccessData - Access data object supplied in the body of the get snapshot access operation. +// options - SnapshotsClientBeginGrantAccessOptions contains the optional parameters for the SnapshotsClient.BeginGrantAccess +// method. +func (client *SnapshotsClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsClientBeginGrantAccessOptions) (*runtime.Poller[SnapshotsClientGrantAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.grantAccess(ctx, resourceGroupName, snapshotName, grantAccessData, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SnapshotsClientGrantAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SnapshotsClientGrantAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// GrantAccess - Grants access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *SnapshotsClient) grantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsClientBeginGrantAccessOptions) (*http.Response, error) { + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, snapshotName, grantAccessData, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// grantAccessCreateRequest creates the GrantAccess request. +func (client *SnapshotsClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsClientBeginGrantAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, grantAccessData) +} + +// NewListPager - Lists snapshots under a subscription. +// Generated from API version 2022-07-02 +// options - SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.List method. +func (client *SnapshotsClient) NewListPager(options *SnapshotsClientListOptions) *runtime.Pager[SnapshotsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SnapshotsClientListResponse]{ + More: func(page SnapshotsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SnapshotsClientListResponse) (SnapshotsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SnapshotsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *SnapshotsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (SnapshotsClientListResponse, error) { + result := SnapshotsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { + return SnapshotsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists snapshots under a resource group. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// options - SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.ListByResourceGroup +// method. +func (client *SnapshotsClient) NewListByResourceGroupPager(resourceGroupName string, options *SnapshotsClientListByResourceGroupOptions) *runtime.Pager[SnapshotsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SnapshotsClientListByResourceGroupResponse]{ + More: func(page SnapshotsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SnapshotsClientListByResourceGroupResponse) (SnapshotsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SnapshotsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (SnapshotsClientListByResourceGroupResponse, error) { + result := SnapshotsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { + return SnapshotsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginRevokeAccess - Revokes access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// options - SnapshotsClientBeginRevokeAccessOptions contains the optional parameters for the SnapshotsClient.BeginRevokeAccess +// method. +func (client *SnapshotsClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginRevokeAccessOptions) (*runtime.Poller[SnapshotsClientRevokeAccessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revokeAccess(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SnapshotsClientRevokeAccessResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SnapshotsClientRevokeAccessResponse](options.ResumeToken, client.pl, nil) + } +} + +// RevokeAccess - Revokes access to a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *SnapshotsClient) revokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginRevokeAccessOptions) (*http.Response, error) { + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, snapshotName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// revokeAccessCreateRequest creates the RevokeAccess request. +func (client *SnapshotsClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsClientBeginRevokeAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginUpdate - Updates (patches) a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +// resourceGroupName - The name of the resource group. +// snapshotName - The name of the snapshot that is being created. The name can't be changed after the snapshot is created. +// Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 +// characters. +// snapshot - Snapshot object supplied in the body of the Patch snapshot operation. +// options - SnapshotsClientBeginUpdateOptions contains the optional parameters for the SnapshotsClient.BeginUpdate method. +func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsClientBeginUpdateOptions) (*runtime.Poller[SnapshotsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SnapshotsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[SnapshotsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates (patches) a snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02 +func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if snapshotName == "" { + return nil, errors.New("parameter snapshotName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, snapshot) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sshpublickeys_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sshpublickeys_client.go new file mode 100644 index 000000000..ab1e510f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/sshpublickeys_client.go @@ -0,0 +1,458 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SSHPublicKeysClient contains the methods for the SSHPublicKeys group. +// Don't use this type directly, use NewSSHPublicKeysClient() instead. +type SSHPublicKeysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSSHPublicKeysClient creates a new instance of SSHPublicKeysClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSSHPublicKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SSHPublicKeysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SSHPublicKeysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Creates a new SSH public key resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// sshPublicKeyName - The name of the SSH public key. +// parameters - Parameters supplied to create the SSH public key. +// options - SSHPublicKeysClientCreateOptions contains the optional parameters for the SSHPublicKeysClient.Create method. +func (client *SSHPublicKeysClient) Create(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysClientCreateOptions) (SSHPublicKeysClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) + if err != nil { + return SSHPublicKeysClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SSHPublicKeysClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sshPublicKeyName == "" { + return nil, errors.New("parameter sshPublicKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sshPublicKeyName}", url.PathEscape(sshPublicKeyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleResponse handles the Create response. +func (client *SSHPublicKeysClient) createHandleResponse(resp *http.Response) (SSHPublicKeysClientCreateResponse, error) { + result := SSHPublicKeysClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete an SSH public key. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// sshPublicKeyName - The name of the SSH public key. +// options - SSHPublicKeysClientDeleteOptions contains the optional parameters for the SSHPublicKeysClient.Delete method. +func (client *SSHPublicKeysClient) Delete(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientDeleteOptions) (SSHPublicKeysClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SSHPublicKeysClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SSHPublicKeysClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sshPublicKeyName == "" { + return nil, errors.New("parameter sshPublicKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sshPublicKeyName}", url.PathEscape(sshPublicKeyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GenerateKeyPair - Generates and returns a public/private key pair and populates the SSH public key resource with the public +// key. The length of the key will be 3072 bits. This operation can only be performed once per +// SSH public key resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// sshPublicKeyName - The name of the SSH public key. +// options - SSHPublicKeysClientGenerateKeyPairOptions contains the optional parameters for the SSHPublicKeysClient.GenerateKeyPair +// method. +func (client *SSHPublicKeysClient) GenerateKeyPair(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientGenerateKeyPairOptions) (SSHPublicKeysClientGenerateKeyPairResponse, error) { + req, err := client.generateKeyPairCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysClientGenerateKeyPairResponse{}, runtime.NewResponseError(resp) + } + return client.generateKeyPairHandleResponse(resp) +} + +// generateKeyPairCreateRequest creates the GenerateKeyPair request. +func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientGenerateKeyPairOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sshPublicKeyName == "" { + return nil, errors.New("parameter sshPublicKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sshPublicKeyName}", url.PathEscape(sshPublicKeyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateKeyPairHandleResponse handles the GenerateKeyPair response. +func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *http.Response) (SSHPublicKeysClientGenerateKeyPairResponse, error) { + result := SSHPublicKeysClientGenerateKeyPairResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyGenerateKeyPairResult); err != nil { + return SSHPublicKeysClientGenerateKeyPairResponse{}, err + } + return result, nil +} + +// Get - Retrieves information about an SSH public key. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// sshPublicKeyName - The name of the SSH public key. +// options - SSHPublicKeysClientGetOptions contains the optional parameters for the SSHPublicKeysClient.Get method. +func (client *SSHPublicKeysClient) Get(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientGetOptions) (SSHPublicKeysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) + if err != nil { + return SSHPublicKeysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sshPublicKeyName == "" { + return nil, errors.New("parameter sshPublicKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sshPublicKeyName}", url.PathEscape(sshPublicKeyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SSHPublicKeysClient) getHandleResponse(resp *http.Response) (SSHPublicKeysClientGetResponse, error) { + result := SSHPublicKeysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all of the SSH public keys in the specified resource group. Use the nextLink property +// in the response to get the next page of SSH public keys. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - SSHPublicKeysClientListByResourceGroupOptions contains the optional parameters for the SSHPublicKeysClient.ListByResourceGroup +// method. +func (client *SSHPublicKeysClient) NewListByResourceGroupPager(resourceGroupName string, options *SSHPublicKeysClientListByResourceGroupOptions) *runtime.Pager[SSHPublicKeysClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SSHPublicKeysClientListByResourceGroupResponse]{ + More: func(page SSHPublicKeysClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SSHPublicKeysClientListByResourceGroupResponse) (SSHPublicKeysClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SSHPublicKeysClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SSHPublicKeysClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *http.Response) (SSHPublicKeysClientListByResourceGroupResponse, error) { + result := SSHPublicKeysClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { + return SSHPublicKeysClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all of the SSH public keys in the subscription. Use the nextLink property in the response +// to get the next page of SSH public keys. +// Generated from API version 2022-08-01 +// options - SSHPublicKeysClientListBySubscriptionOptions contains the optional parameters for the SSHPublicKeysClient.ListBySubscription +// method. +func (client *SSHPublicKeysClient) NewListBySubscriptionPager(options *SSHPublicKeysClientListBySubscriptionOptions) *runtime.Pager[SSHPublicKeysClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SSHPublicKeysClientListBySubscriptionResponse]{ + More: func(page SSHPublicKeysClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SSHPublicKeysClientListBySubscriptionResponse) (SSHPublicKeysClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SSHPublicKeysClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.Context, options *SSHPublicKeysClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *http.Response) (SSHPublicKeysClientListBySubscriptionResponse, error) { + result := SSHPublicKeysClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { + return SSHPublicKeysClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Updates a new SSH public key resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// sshPublicKeyName - The name of the SSH public key. +// parameters - Parameters supplied to update the SSH public key. +// options - SSHPublicKeysClientUpdateOptions contains the optional parameters for the SSHPublicKeysClient.Update method. +func (client *SSHPublicKeysClient) Update(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysClientUpdateOptions) (SSHPublicKeysClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) + if err != nil { + return SSHPublicKeysClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SSHPublicKeysClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sshPublicKeyName == "" { + return nil, errors.New("parameter sshPublicKeyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sshPublicKeyName}", url.PathEscape(sshPublicKeyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *SSHPublicKeysClient) updateHandleResponse(resp *http.Response) (SSHPublicKeysClientUpdateResponse, error) { + result := SSHPublicKeysClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/time_rfc3339.go new file mode 100644 index 000000000..fa0297eb9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/time_rfc3339.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/usage_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/usage_client.go new file mode 100644 index 000000000..eabf3ca50 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/usage_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsageClient contains the methods for the Usage group. +// Don't use this type directly, use NewUsageClient() instead. +type UsageClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUsageClient creates a new instance of UsageClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsageClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UsageClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets, for the specified location, the current compute resource usage information as well as the limits for +// compute resources under the subscription. +// Generated from API version 2022-08-01 +// location - The location for which resource usage is queried. +// options - UsageClientListOptions contains the optional parameters for the UsageClient.List method. +func (client *UsageClient) NewListPager(location string, options *UsageClientListOptions) *runtime.Pager[UsageClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UsageClientListResponse]{ + More: func(page UsageClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UsageClientListResponse) (UsageClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsageClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsageClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsageClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UsageClient) listCreateRequest(ctx context.Context, location string, options *UsageClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UsageClient) listHandleResponse(resp *http.Response) (UsageClientListResponse, error) { + result := UsageClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListUsagesResult); err != nil { + return UsageClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensionimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensionimages_client.go new file mode 100644 index 000000000..14094cd76 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensionimages_client.go @@ -0,0 +1,247 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachineExtensionImagesClient contains the methods for the VirtualMachineExtensionImages group. +// Don't use this type directly, use NewVirtualMachineExtensionImagesClient() instead. +type VirtualMachineExtensionImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineExtensionImagesClient creates a new instance of VirtualMachineExtensionImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineExtensionImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineExtensionImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineExtensionImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a virtual machine extension image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// options - VirtualMachineExtensionImagesClientGetOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.Get +// method. +func (client *VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesClientGetOptions) (VirtualMachineExtensionImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publisherName, typeParam, version, options) + if err != nil { + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if typeParam == "" { + return nil, errors.New("parameter typeParam cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{type}", url.PathEscape(typeParam)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesClientGetResponse, error) { + result := VirtualMachineExtensionImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImage); err != nil { + return VirtualMachineExtensionImagesClientGetResponse{}, err + } + return result, nil +} + +// ListTypes - Gets a list of virtual machine extension image types. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// options - VirtualMachineExtensionImagesClientListTypesOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListTypes +// method. +func (client *VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesClientListTypesOptions) (VirtualMachineExtensionImagesClientListTypesResponse, error) { + req, err := client.listTypesCreateRequest(ctx, location, publisherName, options) + if err != nil { + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesClientListTypesResponse{}, runtime.NewResponseError(resp) + } + return client.listTypesHandleResponse(resp) +} + +// listTypesCreateRequest creates the ListTypes request. +func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesClientListTypesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listTypesHandleResponse handles the ListTypes response. +func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesClientListTypesResponse, error) { + result := VirtualMachineExtensionImagesClientListTypesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { + return VirtualMachineExtensionImagesClientListTypesResponse{}, err + } + return result, nil +} + +// ListVersions - Gets a list of virtual machine extension image versions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// options - VirtualMachineExtensionImagesClientListVersionsOptions contains the optional parameters for the VirtualMachineExtensionImagesClient.ListVersions +// method. +func (client *VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesClientListVersionsOptions) (VirtualMachineExtensionImagesClientListVersionsResponse, error) { + req, err := client.listVersionsCreateRequest(ctx, location, publisherName, typeParam, options) + if err != nil { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, runtime.NewResponseError(resp) + } + return client.listVersionsHandleResponse(resp) +} + +// listVersionsCreateRequest creates the ListVersions request. +func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesClientListVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if typeParam == "" { + return nil, errors.New("parameter typeParam cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{type}", url.PathEscape(typeParam)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVersionsHandleResponse handles the ListVersions response. +func (client *VirtualMachineExtensionImagesClient) listVersionsHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesClientListVersionsResponse, error) { + result := VirtualMachineExtensionImagesClientListVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { + return VirtualMachineExtensionImagesClientListVersionsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensions_client.go new file mode 100644 index 000000000..3cc2726fc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineextensions_client.go @@ -0,0 +1,388 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineExtensionsClient contains the methods for the VirtualMachineExtensions group. +// Don't use this type directly, use NewVirtualMachineExtensionsClient() instead. +type VirtualMachineExtensionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineExtensionsClient creates a new instance of VirtualMachineExtensionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineExtensionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineExtensionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the extension should be created or updated. +// vmExtensionName - The name of the virtual machine extension. +// extensionParameters - Parameters supplied to the Create Virtual Machine Extension operation. +// options - VirtualMachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineExtensionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineExtensionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} + +// BeginDelete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the extension should be deleted. +// vmExtensionName - The name of the virtual machine extension. +// options - VirtualMachineExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginDelete +// method. +func (client *VirtualMachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineExtensionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, vmExtensionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineExtensionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineExtensionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine containing the extension. +// vmExtensionName - The name of the virtual machine extension. +// options - VirtualMachineExtensionsClientGetOptions contains the optional parameters for the VirtualMachineExtensionsClient.Get +// method. +func (client *VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientGetOptions) (VirtualMachineExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) + if err != nil { + return VirtualMachineExtensionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionsClientGetResponse, error) { + result := VirtualMachineExtensionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtension); err != nil { + return VirtualMachineExtensionsClientGetResponse{}, err + } + return result, nil +} + +// List - The operation to get all extensions of a Virtual Machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine containing the extension. +// options - VirtualMachineExtensionsClientListOptions contains the optional parameters for the VirtualMachineExtensionsClient.List +// method. +func (client *VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsClientListOptions) (VirtualMachineExtensionsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachineExtensionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineExtensionsClientListResponse, error) { + result := VirtualMachineExtensionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionsListResult); err != nil { + return VirtualMachineExtensionsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the extension should be updated. +// vmExtensionName - The name of the virtual machine extension. +// extensionParameters - Parameters supplied to the Update Virtual Machine Extension operation. +// options - VirtualMachineExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineExtensionsClient.BeginUpdate +// method. +func (client *VirtualMachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineExtensionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineExtensionsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineExtensionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimages_client.go new file mode 100644 index 000000000..8e8eefd53 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimages_client.go @@ -0,0 +1,434 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachineImagesClient contains the methods for the VirtualMachineImages group. +// Don't use this type directly, use NewVirtualMachineImagesClient() instead. +type VirtualMachineImagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineImagesClient creates a new instance of VirtualMachineImagesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineImagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineImagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a virtual machine image. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// skus - A valid image SKU. +// version - A valid image SKU version. +// options - VirtualMachineImagesClientGetOptions contains the optional parameters for the VirtualMachineImagesClient.Get +// method. +func (client *VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesClientGetOptions) (VirtualMachineImagesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publisherName, offer, skus, version, options) + if err != nil { + return VirtualMachineImagesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if skus == "" { + return nil, errors.New("parameter skus cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skus}", url.PathEscape(skus)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesClientGetResponse, error) { + result := VirtualMachineImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { + return VirtualMachineImagesClientGetResponse{}, err + } + return result, nil +} + +// List - Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// skus - A valid image SKU. +// options - VirtualMachineImagesClientListOptions contains the optional parameters for the VirtualMachineImagesClient.List +// method. +func (client *VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesClientListOptions) (VirtualMachineImagesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, location, publisherName, offer, skus, options) + if err != nil { + return VirtualMachineImagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if skus == "" { + return nil, errors.New("parameter skus cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skus}", url.PathEscape(skus)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineImagesClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesClientListResponse, error) { + result := VirtualMachineImagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesClientListResponse{}, err + } + return result, nil +} + +// ListByEdgeZone - Gets a list of all virtual machine image versions for the specified edge zone +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// options - VirtualMachineImagesClientListByEdgeZoneOptions contains the optional parameters for the VirtualMachineImagesClient.ListByEdgeZone +// method. +func (client *VirtualMachineImagesClient) ListByEdgeZone(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesClientListByEdgeZoneOptions) (VirtualMachineImagesClientListByEdgeZoneResponse, error) { + req, err := client.listByEdgeZoneCreateRequest(ctx, location, edgeZone, options) + if err != nil { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, runtime.NewResponseError(resp) + } + return client.listByEdgeZoneHandleResponse(resp) +} + +// listByEdgeZoneCreateRequest creates the ListByEdgeZone request. +func (client *VirtualMachineImagesClient) listByEdgeZoneCreateRequest(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesClientListByEdgeZoneOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByEdgeZoneHandleResponse handles the ListByEdgeZone response. +func (client *VirtualMachineImagesClient) listByEdgeZoneHandleResponse(resp *http.Response) (VirtualMachineImagesClientListByEdgeZoneResponse, error) { + result := VirtualMachineImagesClientListByEdgeZoneResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMImagesInEdgeZoneListResult); err != nil { + return VirtualMachineImagesClientListByEdgeZoneResponse{}, err + } + return result, nil +} + +// ListOffers - Gets a list of virtual machine image offers for the specified location and publisher. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// publisherName - A valid image publisher. +// options - VirtualMachineImagesClientListOffersOptions contains the optional parameters for the VirtualMachineImagesClient.ListOffers +// method. +func (client *VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesClientListOffersOptions) (VirtualMachineImagesClientListOffersResponse, error) { + req, err := client.listOffersCreateRequest(ctx, location, publisherName, options) + if err != nil { + return VirtualMachineImagesClientListOffersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientListOffersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientListOffersResponse{}, runtime.NewResponseError(resp) + } + return client.listOffersHandleResponse(resp) +} + +// listOffersCreateRequest creates the ListOffers request. +func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesClientListOffersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOffersHandleResponse handles the ListOffers response. +func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesClientListOffersResponse, error) { + result := VirtualMachineImagesClientListOffersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesClientListOffersResponse{}, err + } + return result, nil +} + +// ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// options - VirtualMachineImagesClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesClient.ListPublishers +// method. +func (client *VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string, options *VirtualMachineImagesClientListPublishersOptions) (VirtualMachineImagesClientListPublishersResponse, error) { + req, err := client.listPublishersCreateRequest(ctx, location, options) + if err != nil { + return VirtualMachineImagesClientListPublishersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientListPublishersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientListPublishersResponse{}, runtime.NewResponseError(resp) + } + return client.listPublishersHandleResponse(resp) +} + +// listPublishersCreateRequest creates the ListPublishers request. +func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx context.Context, location string, options *VirtualMachineImagesClientListPublishersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPublishersHandleResponse handles the ListPublishers response. +func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesClientListPublishersResponse, error) { + result := VirtualMachineImagesClientListPublishersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesClientListPublishersResponse{}, err + } + return result, nil +} + +// ListSKUs - Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// options - VirtualMachineImagesClientListSKUsOptions contains the optional parameters for the VirtualMachineImagesClient.ListSKUs +// method. +func (client *VirtualMachineImagesClient) ListSKUs(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesClientListSKUsOptions) (VirtualMachineImagesClientListSKUsResponse, error) { + req, err := client.listSKUsCreateRequest(ctx, location, publisherName, offer, options) + if err != nil { + return VirtualMachineImagesClientListSKUsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesClientListSKUsResponse{}, runtime.NewResponseError(resp) + } + return client.listSKUsHandleResponse(resp) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesClientListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *VirtualMachineImagesClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesClientListSKUsResponse, error) { + result := VirtualMachineImagesClientListSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesClientListSKUsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimagesedgezone_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimagesedgezone_client.go new file mode 100644 index 000000000..fb020857a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineimagesedgezone_client.go @@ -0,0 +1,402 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachineImagesEdgeZoneClient contains the methods for the VirtualMachineImagesEdgeZone group. +// Don't use this type directly, use NewVirtualMachineImagesEdgeZoneClient() instead. +type VirtualMachineImagesEdgeZoneClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineImagesEdgeZoneClient creates a new instance of VirtualMachineImagesEdgeZoneClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineImagesEdgeZoneClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineImagesEdgeZoneClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineImagesEdgeZoneClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a virtual machine image in an edge zone. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// skus - A valid image SKU. +// version - A valid image SKU version. +// options - VirtualMachineImagesEdgeZoneClientGetOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.Get +// method. +func (client *VirtualMachineImagesEdgeZoneClient) Get(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneClientGetOptions) (VirtualMachineImagesEdgeZoneClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, version, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if skus == "" { + return nil, errors.New("parameter skus cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skus}", url.PathEscape(skus)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneClientGetResponse, error) { + result := VirtualMachineImagesEdgeZoneClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { + return VirtualMachineImagesEdgeZoneClientGetResponse{}, err + } + return result, nil +} + +// List - Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// skus - A valid image SKU. +// options - VirtualMachineImagesEdgeZoneClientListOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.List +// method. +func (client *VirtualMachineImagesEdgeZoneClient) List(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneClientListOptions) (VirtualMachineImagesEdgeZoneClientListResponse, error) { + req, err := client.listCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if skus == "" { + return nil, errors.New("parameter skus cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skus}", url.PathEscape(skus)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneClientListResponse, error) { + result := VirtualMachineImagesEdgeZoneClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneClientListResponse{}, err + } + return result, nil +} + +// ListOffers - Gets a list of virtual machine image offers for the specified location, edge zone and publisher. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// publisherName - A valid image publisher. +// options - VirtualMachineImagesEdgeZoneClientListOffersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListOffers +// method. +func (client *VirtualMachineImagesEdgeZoneClient) ListOffers(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneClientListOffersOptions) (VirtualMachineImagesEdgeZoneClientListOffersResponse, error) { + req, err := client.listOffersCreateRequest(ctx, location, edgeZone, publisherName, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, runtime.NewResponseError(resp) + } + return client.listOffersHandleResponse(resp) +} + +// listOffersCreateRequest creates the ListOffers request. +func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneClientListOffersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOffersHandleResponse handles the ListOffers response. +func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneClientListOffersResponse, error) { + result := VirtualMachineImagesEdgeZoneClientListOffersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneClientListOffersResponse{}, err + } + return result, nil +} + +// ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location and edge zone. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// options - VirtualMachineImagesEdgeZoneClientListPublishersOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListPublishers +// method. +func (client *VirtualMachineImagesEdgeZoneClient) ListPublishers(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneClientListPublishersOptions) (VirtualMachineImagesEdgeZoneClientListPublishersResponse, error) { + req, err := client.listPublishersCreateRequest(ctx, location, edgeZone, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, runtime.NewResponseError(resp) + } + return client.listPublishersHandleResponse(resp) +} + +// listPublishersCreateRequest creates the ListPublishers request. +func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneClientListPublishersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPublishersHandleResponse handles the ListPublishers response. +func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneClientListPublishersResponse, error) { + result := VirtualMachineImagesEdgeZoneClientListPublishersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneClientListPublishersResponse{}, err + } + return result, nil +} + +// ListSKUs - Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The name of a supported Azure region. +// edgeZone - The name of the edge zone. +// publisherName - A valid image publisher. +// offer - A valid image publisher offer. +// options - VirtualMachineImagesEdgeZoneClientListSKUsOptions contains the optional parameters for the VirtualMachineImagesEdgeZoneClient.ListSKUs +// method. +func (client *VirtualMachineImagesEdgeZoneClient) ListSKUs(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneClientListSKUsOptions) (VirtualMachineImagesEdgeZoneClientListSKUsResponse, error) { + req, err := client.listSKUsCreateRequest(ctx, location, edgeZone, publisherName, offer, options) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, runtime.NewResponseError(resp) + } + return client.listSKUsHandleResponse(resp) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneClientListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if edgeZone == "" { + return nil, errors.New("parameter edgeZone cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeZone}", url.PathEscape(edgeZone)) + if publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offer == "" { + return nil, errors.New("parameter offer cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offer}", url.PathEscape(offer)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneClientListSKUsResponse, error) { + result := VirtualMachineImagesEdgeZoneClientListSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneClientListSKUsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineruncommands_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineruncommands_client.go new file mode 100644 index 000000000..2fd8d43e8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachineruncommands_client.go @@ -0,0 +1,521 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineRunCommandsClient contains the methods for the VirtualMachineRunCommands group. +// Don't use this type directly, use NewVirtualMachineRunCommandsClient() instead. +type VirtualMachineRunCommandsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineRunCommandsClient creates a new instance of VirtualMachineRunCommandsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineRunCommandsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineRunCommandsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineRunCommandsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the run command should be created or updated. +// runCommandName - The name of the virtual machine run command. +// runCommand - Parameters supplied to the Create Virtual Machine RunCommand operation. +// options - VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineRunCommandsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineRunCommandsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineRunCommandsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, runCommand) +} + +// BeginDelete - The operation to delete the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the run command should be deleted. +// runCommandName - The name of the virtual machine run command. +// options - VirtualMachineRunCommandsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginDelete +// method. +func (client *VirtualMachineRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineRunCommandsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, runCommandName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineRunCommandsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineRunCommandsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// Get - Gets specific run command for a subscription in a location. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// location - The location upon which run commands is queried. +// commandID - The command id. +// options - VirtualMachineRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineRunCommandsClient.Get +// method. +func (client *VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsClientGetOptions) (VirtualMachineRunCommandsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, commandID, options) + if err != nil { + return VirtualMachineRunCommandsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineRunCommandsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if commandID == "" { + return nil, errors.New("parameter commandID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{commandId}", url.PathEscape(commandID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineRunCommandsClientGetResponse, error) { + result := VirtualMachineRunCommandsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandDocument); err != nil { + return VirtualMachineRunCommandsClientGetResponse{}, err + } + return result, nil +} + +// GetByVirtualMachine - The operation to get the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine containing the run command. +// runCommandName - The name of the virtual machine run command. +// options - VirtualMachineRunCommandsClientGetByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.GetByVirtualMachine +// method. +func (client *VirtualMachineRunCommandsClient) GetByVirtualMachine(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientGetByVirtualMachineOptions) (VirtualMachineRunCommandsClientGetByVirtualMachineResponse, error) { + req, err := client.getByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) + if err != nil { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, runtime.NewResponseError(resp) + } + return client.getByVirtualMachineHandleResponse(resp) +} + +// getByVirtualMachineCreateRequest creates the GetByVirtualMachine request. +func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsClientGetByVirtualMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// getByVirtualMachineHandleResponse handles the GetByVirtualMachine response. +func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsClientGetByVirtualMachineResponse, error) { + result := VirtualMachineRunCommandsClientGetByVirtualMachineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { + return VirtualMachineRunCommandsClientGetByVirtualMachineResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all available run commands for a subscription in a location. +// Generated from API version 2022-08-01 +// location - The location upon which run commands is queried. +// options - VirtualMachineRunCommandsClientListOptions contains the optional parameters for the VirtualMachineRunCommandsClient.List +// method. +func (client *VirtualMachineRunCommandsClient) NewListPager(location string, options *VirtualMachineRunCommandsClientListOptions) *runtime.Pager[VirtualMachineRunCommandsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineRunCommandsClientListResponse]{ + More: func(page VirtualMachineRunCommandsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineRunCommandsClientListResponse) (VirtualMachineRunCommandsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineRunCommandsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineRunCommandsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineRunCommandsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineRunCommandsClientListResponse, error) { + result := VirtualMachineRunCommandsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandListResult); err != nil { + return VirtualMachineRunCommandsClientListResponse{}, err + } + return result, nil +} + +// NewListByVirtualMachinePager - The operation to get all run commands of a Virtual Machine. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine containing the run command. +// options - VirtualMachineRunCommandsClientListByVirtualMachineOptions contains the optional parameters for the VirtualMachineRunCommandsClient.ListByVirtualMachine +// method. +func (client *VirtualMachineRunCommandsClient) NewListByVirtualMachinePager(resourceGroupName string, vmName string, options *VirtualMachineRunCommandsClientListByVirtualMachineOptions) *runtime.Pager[VirtualMachineRunCommandsClientListByVirtualMachineResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineRunCommandsClientListByVirtualMachineResponse]{ + More: func(page VirtualMachineRunCommandsClientListByVirtualMachineResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineRunCommandsClientListByVirtualMachineResponse) (VirtualMachineRunCommandsClientListByVirtualMachineResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineRunCommandsClientListByVirtualMachineResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineRunCommandsClientListByVirtualMachineResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsClientListByVirtualMachineResponse{}, runtime.NewResponseError(resp) + } + return client.listByVirtualMachineHandleResponse(resp) + }, + }) +} + +// listByVirtualMachineCreateRequest creates the ListByVirtualMachine request. +func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineRunCommandsClientListByVirtualMachineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// listByVirtualMachineHandleResponse handles the ListByVirtualMachine response. +func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsClientListByVirtualMachineResponse, error) { + result := VirtualMachineRunCommandsClientListByVirtualMachineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { + return VirtualMachineRunCommandsClientListByVirtualMachineResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine where the run command should be updated. +// runCommandName - The name of the virtual machine run command. +// runCommand - Parameters supplied to the Update Virtual Machine RunCommand operation. +// options - VirtualMachineRunCommandsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineRunCommandsClient.BeginUpdate +// method. +func (client *VirtualMachineRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineRunCommandsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineRunCommandsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineRunCommandsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update the run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, runCommand) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachines_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachines_client.go new file mode 100644 index 000000000..1b297b7ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachines_client.go @@ -0,0 +1,1636 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachinesClient contains the methods for the VirtualMachines group. +// Don't use this type directly, use NewVirtualMachinesClient() instead. +type VirtualMachinesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachinesClient creates a new instance of VirtualMachinesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachinesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachinesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginAssessPatches - Assess patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginAssessPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginAssessPatches +// method. +func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*runtime.Poller[VirtualMachinesClientAssessPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.assessPatches(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientAssessPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientAssessPatchesResponse](options.ResumeToken, client.pl, nil) + } +} + +// AssessPatches - Assess patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// assessPatchesCreateRequest creates the AssessPatches request. +func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginAssessPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCapture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create +// similar VMs. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// parameters - Parameters supplied to the Capture Virtual Machine operation. +// options - VirtualMachinesClientBeginCaptureOptions contains the optional parameters for the VirtualMachinesClient.BeginCapture +// method. +func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*runtime.Poller[VirtualMachinesClientCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.capture(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// Capture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar +// VMs. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*http.Response, error) { + req, err := client.captureCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// captureCreateRequest creates the Capture request. +func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesClientBeginCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated +// before invoking this operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginConvertToManagedDisksOptions contains the optional parameters for the VirtualMachinesClient.BeginConvertToManagedDisks +// method. +func (client *VirtualMachinesClient) BeginConvertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*runtime.Poller[VirtualMachinesClientConvertToManagedDisksResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.convertToManagedDisks(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientConvertToManagedDisksResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientConvertToManagedDisksResponse](options.ResumeToken, client.pl, nil) + } +} + +// ConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated +// before invoking this operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*http.Response, error) { + req, err := client.convertToManagedDisksCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// convertToManagedDisksCreateRequest creates the ConvertToManagedDisks request. +func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginConvertToManagedDisksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only +// during virtual machine creation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// parameters - Parameters supplied to the Create Virtual Machine operation. +// options - VirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachinesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only during +// virtual machine creation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDeallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute +// resources that this virtual machine uses. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginDeallocateOptions contains the optional parameters for the VirtualMachinesClient.BeginDeallocate +// method. +func (client *VirtualMachinesClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*runtime.Poller[VirtualMachinesClientDeallocateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deallocate(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientDeallocateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientDeallocateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Deallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources +// that this virtual machine uses. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*http.Response, error) { + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deallocateCreateRequest creates the Deallocate request. +func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeallocateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Hibernate != nil { + reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - The operation to delete a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginDeleteOptions contains the optional parameters for the VirtualMachinesClient.BeginDelete +// method. +func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachinesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForceDeletion != nil { + reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Generalize - Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine +// before performing this operation. For Windows, please refer to Create a managed image of a +// generalized VM in Azure [https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource]. For Linux, +// please refer to How to create an image of a virtual machine or VHD +// [https://docs.microsoft.com/azure/virtual-machines/linux/capture-image]. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientGeneralizeOptions contains the optional parameters for the VirtualMachinesClient.Generalize +// method. +func (client *VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientGeneralizeOptions) (VirtualMachinesClientGeneralizeResponse, error) { + req, err := client.generalizeCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientGeneralizeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientGeneralizeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientGeneralizeResponse{}, runtime.NewResponseError(resp) + } + return VirtualMachinesClientGeneralizeResponse{}, nil +} + +// generalizeCreateRequest creates the Generalize request. +func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientGeneralizeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about the model view or the instance view of a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. +func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientGetOptions) (VirtualMachinesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (VirtualMachinesClientGetResponse, error) { + result := VirtualMachinesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachine); err != nil { + return VirtualMachinesClientGetResponse{}, err + } + return result, nil +} + +// BeginInstallPatches - Installs patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// installPatchesInput - Input for InstallPatches as directly received by the API +// options - VirtualMachinesClientBeginInstallPatchesOptions contains the optional parameters for the VirtualMachinesClient.BeginInstallPatches +// method. +func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*runtime.Poller[VirtualMachinesClientInstallPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.installPatches(ctx, resourceGroupName, vmName, installPatchesInput, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientInstallPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientInstallPatchesResponse](options.ResumeToken, client.pl, nil) + } +} + +// InstallPatches - Installs patches on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, vmName, installPatchesInput, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// installPatchesCreateRequest creates the InstallPatches request. +func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesClientBeginInstallPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, installPatchesInput) +} + +// InstanceView - Retrieves information about the run-time state of a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientInstanceViewOptions contains the optional parameters for the VirtualMachinesClient.InstanceView +// method. +func (client *VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientInstanceViewOptions) (VirtualMachinesClientInstanceViewResponse, error) { + req, err := client.instanceViewCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientInstanceViewResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientInstanceViewResponse{}, runtime.NewResponseError(resp) + } + return client.instanceViewHandleResponse(resp) +} + +// instanceViewCreateRequest creates the InstanceView request. +func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// instanceViewHandleResponse handles the InstanceView response. +func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *http.Response) (VirtualMachinesClientInstanceViewResponse, error) { + result := VirtualMachinesClientInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineInstanceView); err != nil { + return VirtualMachinesClientInstanceViewResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response +// to get the next page of virtual machines. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - VirtualMachinesClientListOptions contains the optional parameters for the VirtualMachinesClient.List method. +func (client *VirtualMachinesClient) NewListPager(resourceGroupName string, options *VirtualMachinesClientListOptions) *runtime.Pager[VirtualMachinesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListResponse]{ + More: func(page VirtualMachinesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListResponse) (VirtualMachinesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachinesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (VirtualMachinesClientListResponse, error) { + result := VirtualMachinesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response +// to get the next page of virtual machines. +// Generated from API version 2022-08-01 +// options - VirtualMachinesClientListAllOptions contains the optional parameters for the VirtualMachinesClient.ListAll method. +func (client *VirtualMachinesClient) NewListAllPager(options *VirtualMachinesClientListAllOptions) *runtime.Pager[VirtualMachinesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListAllResponse]{ + More: func(page VirtualMachinesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListAllResponse) (VirtualMachinesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachinesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, options *VirtualMachinesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + if options != nil && options.StatusOnly != nil { + reqQP.Set("statusOnly", *options.StatusOnly) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) (VirtualMachinesClientListAllResponse, error) { + result := VirtualMachinesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesClientListAllResponse{}, err + } + return result, nil +} + +// NewListAvailableSizesPager - Lists all available virtual machine sizes to which the specified virtual machine can be resized. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientListAvailableSizesOptions contains the optional parameters for the VirtualMachinesClient.ListAvailableSizes +// method. +func (client *VirtualMachinesClient) NewListAvailableSizesPager(resourceGroupName string, vmName string, options *VirtualMachinesClientListAvailableSizesOptions) *runtime.Pager[VirtualMachinesClientListAvailableSizesResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListAvailableSizesResponse]{ + More: func(page VirtualMachinesClientListAvailableSizesResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListAvailableSizesResponse) (VirtualMachinesClientListAvailableSizesResponse, error) { + req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientListAvailableSizesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListAvailableSizesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListAvailableSizesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSizesHandleResponse(resp) + }, + }) +} + +// listAvailableSizesCreateRequest creates the ListAvailableSizes request. +func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientListAvailableSizesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSizesHandleResponse handles the ListAvailableSizes response. +func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *http.Response) (VirtualMachinesClientListAvailableSizesResponse, error) { + result := VirtualMachinesClientListAvailableSizesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return VirtualMachinesClientListAvailableSizesResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - Gets all the virtual machines under the specified subscription for the specified location. +// Generated from API version 2022-08-01 +// location - The location for which virtual machines under the subscription are queried. +// options - VirtualMachinesClientListByLocationOptions contains the optional parameters for the VirtualMachinesClient.ListByLocation +// method. +func (client *VirtualMachinesClient) NewListByLocationPager(location string, options *VirtualMachinesClientListByLocationOptions) *runtime.Pager[VirtualMachinesClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListByLocationResponse]{ + More: func(page VirtualMachinesClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachinesClientListByLocationResponse) (VirtualMachinesClientListByLocationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocationCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachinesClientListByLocationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachinesClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachinesClientListByLocationResponse, error) { + result := VirtualMachinesClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesClientListByLocationResponse{}, err + } + return result, nil +} + +// BeginPerformMaintenance - The operation to perform maintenance on a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachinesClient.BeginPerformMaintenance +// method. +func (client *VirtualMachinesClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*runtime.Poller[VirtualMachinesClientPerformMaintenanceResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.performMaintenance(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientPerformMaintenanceResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientPerformMaintenanceResponse](options.ResumeToken, client.pl, nil) + } +} + +// PerformMaintenance - The operation to perform maintenance on a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*http.Response, error) { + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// performMaintenanceCreateRequest creates the PerformMaintenance request. +func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPerformMaintenanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginPowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same +// provisioned resources. You are still charged for this virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginPowerOffOptions contains the optional parameters for the VirtualMachinesClient.BeginPowerOff +// method. +func (client *VirtualMachinesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*runtime.Poller[VirtualMachinesClientPowerOffResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.powerOff(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientPowerOffResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientPowerOffResponse](options.ResumeToken, client.pl, nil) + } +} + +// PowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned +// resources. You are still charged for this virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*http.Response, error) { + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// powerOffCreateRequest creates the PowerOff request. +func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginPowerOffOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipShutdown != nil { + reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginReapply - The operation to reapply a virtual machine's state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginReapplyOptions contains the optional parameters for the VirtualMachinesClient.BeginReapply +// method. +func (client *VirtualMachinesClient) BeginReapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*runtime.Poller[VirtualMachinesClientReapplyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reapply(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientReapplyResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientReapplyResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reapply - The operation to reapply a virtual machine's state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*http.Response, error) { + req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reapplyCreateRequest creates the Reapply request. +func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReapplyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRedeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy +// method. +func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*runtime.Poller[VirtualMachinesClientRedeployResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.redeploy(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientRedeployResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientRedeployResponse](options.ResumeToken, client.pl, nil) + } +} + +// Redeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// redeployCreateRequest creates the Redeploy request. +func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRedeployOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginReimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage +// method. +func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*runtime.Poller[VirtualMachinesClientReimageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimage(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientReimageResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientReimageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageCreateRequest creates the Reimage request. +func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginReimageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginRestart - The operation to restart a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginRestartOptions contains the optional parameters for the VirtualMachinesClient.BeginRestart +// method. +func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*runtime.Poller[VirtualMachinesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - The operation to restart a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachinesClient.RetrieveBootDiagnosticsData +// method. +func (client *VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientRetrieveBootDiagnosticsDataOptions) (VirtualMachinesClientRetrieveBootDiagnosticsDataResponse, error) { + req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, runtime.NewResponseError(resp) + } + return client.retrieveBootDiagnosticsDataHandleResponse(resp) +} + +// retrieveBootDiagnosticsDataCreateRequest creates the RetrieveBootDiagnosticsData request. +func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientRetrieveBootDiagnosticsDataOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SasURIExpirationTimeInMinutes != nil { + reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// retrieveBootDiagnosticsDataHandleResponse handles the RetrieveBootDiagnosticsData response. +func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachinesClientRetrieveBootDiagnosticsDataResponse, error) { + result := VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { + return VirtualMachinesClientRetrieveBootDiagnosticsDataResponse{}, err + } + return result, nil +} + +// BeginRunCommand - Run command on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// parameters - Parameters supplied to the Run command operation. +// options - VirtualMachinesClientBeginRunCommandOptions contains the optional parameters for the VirtualMachinesClient.BeginRunCommand +// method. +func (client *VirtualMachinesClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*runtime.Poller[VirtualMachinesClientRunCommandResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.runCommand(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientRunCommandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientRunCommandResponse](options.ResumeToken, client.pl, nil) + } +} + +// RunCommand - Run command on the VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*http.Response, error) { + req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// runCommandCreateRequest creates the RunCommand request. +func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesClientBeginRunCommandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// SimulateEviction - The operation to simulate the eviction of spot virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientSimulateEvictionOptions contains the optional parameters for the VirtualMachinesClient.SimulateEviction +// method. +func (client *VirtualMachinesClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientSimulateEvictionOptions) (VirtualMachinesClientSimulateEvictionResponse, error) { + req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return VirtualMachinesClientSimulateEvictionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachinesClientSimulateEvictionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return VirtualMachinesClientSimulateEvictionResponse{}, runtime.NewResponseError(resp) + } + return VirtualMachinesClientSimulateEvictionResponse{}, nil +} + +// simulateEvictionCreateRequest creates the SimulateEviction request. +func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientSimulateEvictionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - The operation to start a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart +// method. +func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*runtime.Poller[VirtualMachinesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientStartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - The operation to start a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, vmName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - The operation to update a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmName - The name of the virtual machine. +// parameters - Parameters supplied to the Update Virtual Machine operation. +// options - VirtualMachinesClientBeginUpdateOptions contains the optional parameters for the VirtualMachinesClient.BeginUpdate +// method. +func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachinesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachinesClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachinesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update a virtual machine. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmName == "" { + return nil, errors.New("parameter vmName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmName}", url.PathEscape(vmName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetextensions_client.go new file mode 100644 index 000000000..407faf489 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetextensions_client.go @@ -0,0 +1,397 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineScaleSetExtensionsClient contains the methods for the VirtualMachineScaleSetExtensions group. +// Don't use this type directly, use NewVirtualMachineScaleSetExtensionsClient() instead. +type VirtualMachineScaleSetExtensionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetExtensionsClient creates a new instance of VirtualMachineScaleSetExtensionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetExtensionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetExtensionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set where the extension should be create or updated. +// vmssExtensionName - The name of the VM scale set extension. +// extensionParameters - Parameters supplied to the Create VM scale set Extension operation. +// options - VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineScaleSetExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if vmssExtensionName == "" { + return nil, errors.New("parameter vmssExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmssExtensionName}", url.PathEscape(vmssExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} + +// BeginDelete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set where the extension should be deleted. +// vmssExtensionName - The name of the VM scale set extension. +// options - VirtualMachineScaleSetExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginDelete +// method. +func (client *VirtualMachineScaleSetExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineScaleSetExtensionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetExtensionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetExtensionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if vmssExtensionName == "" { + return nil, errors.New("parameter vmssExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmssExtensionName}", url.PathEscape(vmssExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get the extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set containing the extension. +// vmssExtensionName - The name of the VM scale set extension. +// options - VirtualMachineScaleSetExtensionsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.Get +// method. +func (client *VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientGetOptions) (VirtualMachineScaleSetExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) + if err != nil { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if vmssExtensionName == "" { + return nil, errors.New("parameter vmssExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmssExtensionName}", url.PathEscape(vmssExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsClientGetResponse, error) { + result := VirtualMachineScaleSetExtensionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtension); err != nil { + return VirtualMachineScaleSetExtensionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all extensions in a VM scale set. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set containing the extension. +// options - VirtualMachineScaleSetExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.List +// method. +func (client *VirtualMachineScaleSetExtensionsClient) NewListPager(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsClientListOptions) *runtime.Pager[VirtualMachineScaleSetExtensionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetExtensionsClientListResponse]{ + More: func(page VirtualMachineScaleSetExtensionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetExtensionsClientListResponse) (VirtualMachineScaleSetExtensionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetExtensionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetExtensionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsClientListResponse, error) { + result := VirtualMachineScaleSetExtensionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtensionListResult); err != nil { + return VirtualMachineScaleSetExtensionsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set where the extension should be updated. +// vmssExtensionName - The name of the VM scale set extension. +// extensionParameters - Parameters supplied to the Update VM scale set Extension operation. +// options - VirtualMachineScaleSetExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetExtensionsClient.BeginUpdate +// method. +func (client *VirtualMachineScaleSetExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetExtensionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetExtensionsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetExtensionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update an extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if vmssExtensionName == "" { + return nil, errors.New("parameter vmssExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmssExtensionName}", url.PathEscape(vmssExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetrollingupgrades_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetrollingupgrades_client.go new file mode 100644 index 000000000..b8a62aae2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetrollingupgrades_client.go @@ -0,0 +1,311 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineScaleSetRollingUpgradesClient contains the methods for the VirtualMachineScaleSetRollingUpgrades group. +// Don't use this type directly, use NewVirtualMachineScaleSetRollingUpgradesClient() instead. +type VirtualMachineScaleSetRollingUpgradesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetRollingUpgradesClient creates a new instance of VirtualMachineScaleSetRollingUpgradesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetRollingUpgradesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetRollingUpgradesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCancel - Cancels the current virtual machine scale set rolling upgrade. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.BeginCancel +// method. +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginCancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*runtime.Poller[VirtualMachineScaleSetRollingUpgradesClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetRollingUpgradesClientCancelResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetRollingUpgradesClientCancelResponse](options.ResumeToken, client.pl, nil) + } +} + +// Cancel - Cancels the current virtual machine scale set rolling upgrade. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*http.Response, error) { + req, err := client.cancelCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetLatest - Gets the status of the latest virtual machine scale set rolling upgrade. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions contains the optional parameters for the VirtualMachineScaleSetRollingUpgradesClient.GetLatest +// method. +func (client *VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions) (VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse, error) { + req, err := client.getLatestCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, runtime.NewResponseError(resp) + } + return client.getLatestHandleResponse(resp) +} + +// getLatestCreateRequest creates the GetLatest request. +func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientGetLatestOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getLatestHandleResponse handles the GetLatest response. +func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleResponse(resp *http.Response) (VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse, error) { + result := VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RollingUpgradeStatusInfo); err != nil { + return VirtualMachineScaleSetRollingUpgradesClientGetLatestResponse{}, err + } + return result, nil +} + +// BeginStartExtensionUpgrade - Starts a rolling upgrade to move all extensions for all virtual machine scale set instances +// to the latest available extension version. Instances which are already running the latest extension versions +// are not affected. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions contains the optional parameters +// for the VirtualMachineScaleSetRollingUpgradesClient.BeginStartExtensionUpgrade method. +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startExtensionUpgrade(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetRollingUpgradesClientStartExtensionUpgradeResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartExtensionUpgrade - Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to +// the latest available extension version. Instances which are already running the latest extension versions +// are not affected. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*http.Response, error) { + req, err := client.startExtensionUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startExtensionUpgradeCreateRequest creates the StartExtensionUpgrade request. +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartExtensionUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStartOSUpgrade - Starts a rolling upgrade to move all virtual machine scale set instances to the latest available +// Platform Image OS version. Instances which are already running the latest available OS version are not +// affected. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions contains the optional parameters for the +// VirtualMachineScaleSetRollingUpgradesClient.BeginStartOSUpgrade method. +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*runtime.Poller[VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startOSUpgrade(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetRollingUpgradesClientStartOSUpgradeResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartOSUpgrade - Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform +// Image OS version. Instances which are already running the latest available OS version are not +// affected. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*http.Response, error) { + req, err := client.startOSUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startOSUpgradeCreateRequest creates the StartOSUpgrade request. +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesClientBeginStartOSUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesets_client.go new file mode 100644 index 000000000..253594e02 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesets_client.go @@ -0,0 +1,1558 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachineScaleSetsClient contains the methods for the VirtualMachineScaleSets group. +// Don't use this type directly, use NewVirtualMachineScaleSetsClient() instead. +type VirtualMachineScaleSetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// ConvertToSinglePlacementGroup - Converts SinglePlacementGroup property to false for a existing virtual machine scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the virtual machine scale set to create or update. +// parameters - The input object for ConvertToSinglePlacementGroup API. +// options - VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup +// method. +func (client *VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions) (VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse, error) { + req, err := client.convertToSinglePlacementGroupCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, runtime.NewResponseError(resp) + } + return VirtualMachineScaleSetsClientConvertToSinglePlacementGroupResponse{}, nil +} + +// convertToSinglePlacementGroupCreateRequest creates the ConvertToSinglePlacementGroup request. +func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsClientConvertToSinglePlacementGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdate - Create or update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set to create or update. +// parameters - The scale set object. +// options - VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineScaleSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDeallocate - Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases +// the compute resources. You are not billed for the compute resources that this virtual machine +// scale set deallocates. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeallocate +// method. +func (client *VirtualMachineScaleSetsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*runtime.Poller[VirtualMachineScaleSetsClientDeallocateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deallocate(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientDeallocateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientDeallocateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Deallocate - Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the +// compute resources. You are not billed for the compute resources that this virtual machine +// scale set deallocates. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*http.Response, error) { + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deallocateCreateRequest creates the Deallocate request. +func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeallocateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginDelete - Deletes a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDelete +// method. +func (client *VirtualMachineScaleSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineScaleSetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForceDeletion != nil { + reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteInstances - Deletes virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. +// options - VirtualMachineScaleSetsClientBeginDeleteInstancesOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginDeleteInstances +// method. +func (client *VirtualMachineScaleSetsClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*runtime.Poller[VirtualMachineScaleSetsClientDeleteInstancesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteInstances(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientDeleteInstancesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientDeleteInstancesResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteInstances - Deletes virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*http.Response, error) { + req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteInstancesCreateRequest creates the DeleteInstances request. +func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginDeleteInstancesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForceDeletion != nil { + reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vmInstanceIDs) +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalk - Manual platform update domain walk to update virtual machines in a +// service fabric virtual machine scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// platformUpdateDomain - The platform update domain for which a manual recovery walk is requested +// options - VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions contains the optional +// parameters for the VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk method. +func (client *VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) { + req, err := client.forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx, resourceGroupName, vmScaleSetName, platformUpdateDomain, options) + if err != nil { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, runtime.NewResponseError(resp) + } + return client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp) +} + +// forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest creates the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. +func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + reqQP.Set("platformUpdateDomain", strconv.FormatInt(int64(platformUpdateDomain), 10)) + if options != nil && options.Zone != nil { + reqQP.Set("zone", *options.Zone) + } + if options != nil && options.PlacementGroupID != nil { + reqQP.Set("placementGroupId", *options.PlacementGroupID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse handles the ForceRecoveryServiceFabricPlatformUpdateDomainWalk response. +func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) { + result := VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryWalkResponse); err != nil { + return VirtualMachineScaleSetsClientForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + } + return result, nil +} + +// Get - Display information about a virtual machine scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetsClient.Get +// method. +func (client *VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetOptions) (VirtualMachineScaleSetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientGetResponse, error) { + result := VirtualMachineScaleSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSet); err != nil { + return VirtualMachineScaleSetsClientGetResponse{}, err + } + return result, nil +} + +// GetInstanceView - Gets the status of a VM scale set instance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetInstanceView +// method. +func (client *VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetInstanceViewOptions) (VirtualMachineScaleSetsClientGetInstanceViewResponse, error) { + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, runtime.NewResponseError(resp) + } + return client.getInstanceViewHandleResponse(resp) +} + +// getInstanceViewCreateRequest creates the GetInstanceView request. +func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInstanceViewHandleResponse handles the GetInstanceView response. +func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientGetInstanceViewResponse, error) { + result := VirtualMachineScaleSetsClientGetInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetInstanceView); err != nil { + return VirtualMachineScaleSetsClientGetInstanceViewResponse{}, err + } + return result, nil +} + +// NewGetOSUpgradeHistoryPager - Gets list of OS upgrades on a VM scale set instance. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions contains the optional parameters for the VirtualMachineScaleSetsClient.GetOSUpgradeHistory +// method. +func (client *VirtualMachineScaleSetsClient) NewGetOSUpgradeHistoryPager(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions) *runtime.Pager[VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse]{ + More: func(page VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse) (VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getOSUpgradeHistoryCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{}, runtime.NewResponseError(resp) + } + return client.getOSUpgradeHistoryHandleResponse(resp) + }, + }) +} + +// getOSUpgradeHistoryCreateRequest creates the GetOSUpgradeHistory request. +func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientGetOSUpgradeHistoryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getOSUpgradeHistoryHandleResponse handles the GetOSUpgradeHistory response. +func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse, error) { + result := VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListOSUpgradeHistory); err != nil { + return VirtualMachineScaleSetsClientGetOSUpgradeHistoryResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all VM scale sets under a resource group. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// options - VirtualMachineScaleSetsClientListOptions contains the optional parameters for the VirtualMachineScaleSetsClient.List +// method. +func (client *VirtualMachineScaleSetsClient) NewListPager(resourceGroupName string, options *VirtualMachineScaleSetsClientListOptions) *runtime.Pager[VirtualMachineScaleSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientListResponse]{ + More: func(page VirtualMachineScaleSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientListResponse) (VirtualMachineScaleSetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachineScaleSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientListResponse, error) { + result := VirtualMachineScaleSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { + return VirtualMachineScaleSetsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use +// nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is +// null to fetch all the VM Scale Sets. +// Generated from API version 2022-08-01 +// options - VirtualMachineScaleSetsClientListAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListAll +// method. +func (client *VirtualMachineScaleSetsClient) NewListAllPager(options *VirtualMachineScaleSetsClientListAllOptions) *runtime.Pager[VirtualMachineScaleSetsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientListAllResponse]{ + More: func(page VirtualMachineScaleSetsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientListAllResponse) (VirtualMachineScaleSetsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Context, options *VirtualMachineScaleSetsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientListAllResponse, error) { + result := VirtualMachineScaleSetsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListWithLinkResult); err != nil { + return VirtualMachineScaleSetsClientListAllResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - Gets all the VM scale sets under the specified subscription for the specified location. +// Generated from API version 2022-08-01 +// location - The location for which VM scale sets under the subscription are queried. +// options - VirtualMachineScaleSetsClientListByLocationOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListByLocation +// method. +func (client *VirtualMachineScaleSetsClient) NewListByLocationPager(location string, options *VirtualMachineScaleSetsClientListByLocationOptions) *runtime.Pager[VirtualMachineScaleSetsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientListByLocationResponse]{ + More: func(page VirtualMachineScaleSetsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientListByLocationResponse) (VirtualMachineScaleSetsClientListByLocationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocationCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetsClientListByLocationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachineScaleSetsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientListByLocationResponse, error) { + result := VirtualMachineScaleSetsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { + return VirtualMachineScaleSetsClientListByLocationResponse{}, err + } + return result, nil +} + +// NewListSKUsPager - Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances +// allowed for each SKU. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientListSKUsOptions contains the optional parameters for the VirtualMachineScaleSetsClient.ListSKUs +// method. +func (client *VirtualMachineScaleSetsClient) NewListSKUsPager(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientListSKUsOptions) *runtime.Pager[VirtualMachineScaleSetsClientListSKUsResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetsClientListSKUsResponse]{ + More: func(page VirtualMachineScaleSetsClientListSKUsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetsClientListSKUsResponse) (VirtualMachineScaleSetsClientListSKUsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listSKUsCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetsClientListSKUsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetsClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsClientListSKUsResponse{}, runtime.NewResponseError(resp) + } + return client.listSKUsHandleResponse(resp) + }, + }) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineScaleSetsClientListSKUsResponse, error) { + result := VirtualMachineScaleSetsClientListSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListSKUsResult); err != nil { + return VirtualMachineScaleSetsClientListSKUsResponse{}, err + } + return result, nil +} + +// BeginPerformMaintenance - Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances +// which are not eligible for perform maintenance will be failed. Please refer to best practices for more +// details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPerformMaintenance +// method. +func (client *VirtualMachineScaleSetsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*runtime.Poller[VirtualMachineScaleSetsClientPerformMaintenanceResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.performMaintenance(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientPerformMaintenanceResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientPerformMaintenanceResponse](options.ResumeToken, client.pl, nil) + } +} + +// PerformMaintenance - Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which +// are not eligible for perform maintenance will be failed. Please refer to best practices for more +// details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*http.Response, error) { + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// performMaintenanceCreateRequest creates the PerformMaintenance request. +func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPerformMaintenanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginPowerOff - Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached +// and you are getting charged for the resources. Instead, use deallocate to release resources and +// avoid charges. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginPowerOff +// method. +func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*runtime.Poller[VirtualMachineScaleSetsClientPowerOffResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.powerOff(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientPowerOffResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientPowerOffResponse](options.ResumeToken, client.pl, nil) + } +} + +// PowerOff - Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and +// you are getting charged for the resources. Instead, use deallocate to release resources and +// avoid charges. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*http.Response, error) { + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// powerOffCreateRequest creates the PowerOff request. +func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginPowerOffOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipShutdown != nil { + reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginRedeploy - Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers +// them back on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRedeploy +// method. +func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*runtime.Poller[VirtualMachineScaleSetsClientRedeployResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.redeploy(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientRedeployResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientRedeployResponse](options.ResumeToken, client.pl, nil) + } +} + +// Redeploy - Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them +// back on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*http.Response, error) { + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// redeployCreateRequest creates the Redeploy request. +func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRedeployOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginReimage - Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have +// a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is +// reset to initial state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimage +// method. +func (client *VirtualMachineScaleSetsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReimageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimage(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientReimageResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientReimageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reimage - Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a ephemeral +// OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is +// reset to initial state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*http.Response, error) { + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageCreateRequest creates the Reimage request. +func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMScaleSetReimageInput != nil { + return req, runtime.MarshalAsJSON(req, *options.VMScaleSetReimageInput) + } + return req, nil +} + +// BeginReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation +// is only supported for managed disks. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginReimageAll +// method. +func (client *VirtualMachineScaleSetsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*runtime.Poller[VirtualMachineScaleSetsClientReimageAllResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimageAll(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientReimageAllResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientReimageAllResponse](options.ResumeToken, client.pl, nil) + } +} + +// ReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation +// is only supported for managed disks. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*http.Response, error) { + req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageAllCreateRequest creates the ReimageAll request. +func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginReimageAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginRestart - Restarts one or more virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginRestart +// method. +func (client *VirtualMachineScaleSetsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*runtime.Poller[VirtualMachineScaleSetsClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Restarts one or more virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginSetOrchestrationServiceState - Changes ServiceState property for a given service +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the virtual machine scale set to create or update. +// parameters - The input object for SetOrchestrationServiceState API. +// options - VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions contains the optional parameters for the +// VirtualMachineScaleSetsClient.BeginSetOrchestrationServiceState method. +func (client *VirtualMachineScaleSetsClient) BeginSetOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*runtime.Poller[VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.setOrchestrationServiceState(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientSetOrchestrationServiceStateResponse](options.ResumeToken, client.pl, nil) + } +} + +// SetOrchestrationServiceState - Changes ServiceState property for a given service +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { + req, err := client.setOrchestrationServiceStateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// setOrchestrationServiceStateCreateRequest creates the SetOrchestrationServiceState request. +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsClientBeginSetOrchestrationServiceStateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginStart - Starts one or more virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginStart +// method. +func (client *VirtualMachineScaleSetsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*runtime.Poller[VirtualMachineScaleSetsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientStartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts one or more virtual machines in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMInstanceIDs != nil { + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) + } + return req, nil +} + +// BeginUpdate - Update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set to create or update. +// parameters - The scale set object. +// options - VirtualMachineScaleSetsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginUpdate +// method. +func (client *VirtualMachineScaleSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// vmInstanceIDs - A list of virtual machine instance IDs from the VM scale set. +// options - VirtualMachineScaleSetsClientBeginUpdateInstancesOptions contains the optional parameters for the VirtualMachineScaleSetsClient.BeginUpdateInstances +// method. +func (client *VirtualMachineScaleSetsClient) BeginUpdateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*runtime.Poller[VirtualMachineScaleSetsClientUpdateInstancesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateInstances(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetsClientUpdateInstancesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetsClientUpdateInstancesResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*http.Response, error) { + req, err := client.updateInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateInstancesCreateRequest creates the UpdateInstances request. +func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsClientBeginUpdateInstancesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vmInstanceIDs) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmextensions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmextensions_client.go new file mode 100644 index 000000000..b73ce99f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmextensions_client.go @@ -0,0 +1,413 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineScaleSetVMExtensionsClient contains the methods for the VirtualMachineScaleSetVMExtensions group. +// Don't use this type directly, use NewVirtualMachineScaleSetVMExtensionsClient() instead. +type VirtualMachineScaleSetVMExtensionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetVMExtensionsClient creates a new instance of VirtualMachineScaleSetVMExtensionsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetVMExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetVMExtensionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMExtensionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// vmExtensionName - The name of the virtual machine extension. +// extensionParameters - Parameters supplied to the Create Virtual Machine Extension operation. +// options - VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginCreateOrUpdate +// method. +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} + +// BeginDelete - The operation to delete the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// vmExtensionName - The name of the virtual machine extension. +// options - VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginDelete +// method. +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineScaleSetVMExtensionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMExtensionsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMExtensionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// vmExtensionName - The name of the virtual machine extension. +// options - VirtualMachineScaleSetVMExtensionsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.Get +// method. +func (client *VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientGetOptions) (VirtualMachineScaleSetVMExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsClientGetResponse, error) { + result := VirtualMachineScaleSetVMExtensionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtension); err != nil { + return VirtualMachineScaleSetVMExtensionsClientGetResponse{}, err + } + return result, nil +} + +// List - The operation to get all extensions of an instance in Virtual Machine Scaleset. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMExtensionsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.List +// method. +func (client *VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsClientListOptions) (VirtualMachineScaleSetVMExtensionsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsClientListResponse, error) { + result := VirtualMachineScaleSetVMExtensionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtensionsListResult); err != nil { + return VirtualMachineScaleSetVMExtensionsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// vmExtensionName - The name of the virtual machine extension. +// extensionParameters - Parameters supplied to the Update Virtual Machine Extension operation. +// options - VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMExtensionsClient.BeginUpdate +// method. +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetVMExtensionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMExtensionsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMExtensionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update the VMSS VM extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if vmExtensionName == "" { + return nil, errors.New("parameter vmExtensionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmExtensionName}", url.PathEscape(vmExtensionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, extensionParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmruncommands_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmruncommands_client.go new file mode 100644 index 000000000..dd2fe1978 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvmruncommands_client.go @@ -0,0 +1,425 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineScaleSetVMRunCommandsClient contains the methods for the VirtualMachineScaleSetVMRunCommands group. +// Don't use this type directly, use NewVirtualMachineScaleSetVMRunCommandsClient() instead. +type VirtualMachineScaleSetVMRunCommandsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetVMRunCommandsClient creates a new instance of VirtualMachineScaleSetVMRunCommandsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetVMRunCommandsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetVMRunCommandsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMRunCommandsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// runCommandName - The name of the virtual machine run command. +// runCommand - Parameters supplied to the Create Virtual Machine RunCommand operation. +// options - VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the +// VirtualMachineScaleSetVMRunCommandsClient.BeginCreateOrUpdate method. +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMRunCommandsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - The operation to create or update the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, runCommand) +} + +// BeginDelete - The operation to delete the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// runCommandName - The name of the virtual machine run command. +// options - VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.BeginDelete +// method. +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineScaleSetVMRunCommandsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMRunCommandsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMRunCommandsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - The operation to delete the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// Get - The operation to get the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// runCommandName - The name of the virtual machine run command. +// options - VirtualMachineScaleSetVMRunCommandsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.Get +// method. +func (client *VirtualMachineScaleSetVMRunCommandsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientGetOptions) (VirtualMachineScaleSetVMRunCommandsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsClientGetResponse, error) { + result := VirtualMachineScaleSetVMRunCommandsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { + return VirtualMachineScaleSetVMRunCommandsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - The operation to get all run commands of an instance in Virtual Machine Scaleset. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMRunCommandsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.List +// method. +func (client *VirtualMachineScaleSetVMRunCommandsClient) NewListPager(resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsClientListOptions) *runtime.Pager[VirtualMachineScaleSetVMRunCommandsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetVMRunCommandsClientListResponse]{ + More: func(page VirtualMachineScaleSetVMRunCommandsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetVMRunCommandsClientListResponse) (VirtualMachineScaleSetVMRunCommandsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMRunCommandsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsClientListResponse, error) { + result := VirtualMachineScaleSetVMRunCommandsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { + return VirtualMachineScaleSetVMRunCommandsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// runCommandName - The name of the virtual machine run command. +// runCommand - Parameters supplied to the Update Virtual Machine RunCommand operation. +// options - VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMRunCommandsClient.BeginUpdate +// method. +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetVMRunCommandsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMRunCommandsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMRunCommandsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - The operation to update the VMSS VM run command. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, runCommand) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvms_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvms_client.go new file mode 100644 index 000000000..bd9330c95 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinescalesetvms_client.go @@ -0,0 +1,1155 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualMachineScaleSetVMsClient contains the methods for the VirtualMachineScaleSetVMs group. +// Don't use this type directly, use NewVirtualMachineScaleSetVMsClient() instead. +type VirtualMachineScaleSetVMsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineScaleSetVMsClient creates a new instance of VirtualMachineScaleSetVMsClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineScaleSetVMsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineScaleSetVMsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineScaleSetVMsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginDeallocate - Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases +// the compute resources it uses. You are not billed for the compute resources of this virtual +// machine once it is deallocated. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginDeallocateOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginDeallocate +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientDeallocateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deallocate(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientDeallocateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientDeallocateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Deallocate - Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the +// compute resources it uses. You are not billed for the compute resources of this virtual +// machine once it is deallocated. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*http.Response, error) { + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deallocateCreateRequest creates the Deallocate request. +func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeallocateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Deletes a virtual machine from a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginDeleteOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginDelete +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a virtual machine from a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForceDeletion != nil { + reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a virtual machine from a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientGetOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.Get +// method. +func (client *VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientGetOptions) (VirtualMachineScaleSetVMsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsClientGetResponse, error) { + result := VirtualMachineScaleSetVMsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVM); err != nil { + return VirtualMachineScaleSetVMsClientGetResponse{}, err + } + return result, nil +} + +// GetInstanceView - Gets the status of a virtual machine from a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientGetInstanceViewOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.GetInstanceView +// method. +func (client *VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientGetInstanceViewOptions) (VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) { + req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, runtime.NewResponseError(resp) + } + return client.getInstanceViewHandleResponse(resp) +} + +// getInstanceViewCreateRequest creates the GetInstanceView request. +func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientGetInstanceViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInstanceViewHandleResponse handles the GetInstanceView response. +func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) { + result := VirtualMachineScaleSetVMsClientGetInstanceViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMInstanceView); err != nil { + return VirtualMachineScaleSetVMsClientGetInstanceViewResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of all virtual machines in a VM scale sets. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the VM scale set. +// options - VirtualMachineScaleSetVMsClientListOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.List +// method. +func (client *VirtualMachineScaleSetVMsClient) NewListPager(resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsClientListOptions) *runtime.Pager[VirtualMachineScaleSetVMsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineScaleSetVMsClientListResponse]{ + More: func(page VirtualMachineScaleSetVMsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualMachineScaleSetVMsClientListResponse) (VirtualMachineScaleSetVMsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualMachineScaleSetVMsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Select != nil { + reqQP.Set("$select", *options.Select) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsClientListResponse, error) { + result := VirtualMachineScaleSetVMsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMListResult); err != nil { + return VirtualMachineScaleSetVMsClientListResponse{}, err + } + return result, nil +} + +// BeginPerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginPerformMaintenance +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientPerformMaintenanceResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.performMaintenance(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientPerformMaintenanceResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientPerformMaintenanceResponse](options.ResumeToken, client.pl, nil) + } +} + +// PerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*http.Response, error) { + req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// performMaintenanceCreateRequest creates the PerformMaintenance request. +func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPerformMaintenanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginPowerOff - Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are +// getting charged for the resources. Instead, use deallocate to release resources and avoid +// charges. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginPowerOffOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginPowerOff +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientPowerOffResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.powerOff(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientPowerOffResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientPowerOffResponse](options.ResumeToken, client.pl, nil) + } +} + +// PowerOff - Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting +// charged for the resources. Instead, use deallocate to release resources and avoid +// charges. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*http.Response, error) { + req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// powerOffCreateRequest creates the PowerOff request. +func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginPowerOffOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SkipShutdown != nil { + reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRedeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it +// back on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginRedeployOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRedeploy +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientRedeployResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.redeploy(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientRedeployResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientRedeployResponse](options.ResumeToken, client.pl, nil) + } +} + +// Redeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back +// on. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*http.Response, error) { + req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// redeployCreateRequest creates the Redeploy request. +func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRedeployOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginReimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginReimageOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginReimage +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientReimageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimage(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientReimageResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientReimageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*http.Response, error) { + req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageCreateRequest creates the Reimage request. +func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.VMScaleSetVMReimageInput != nil { + return req, runtime.MarshalAsJSON(req, *options.VMScaleSetVMReimageInput) + } + return req, nil +} + +// BeginReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation +// is only supported for managed disks. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginReimageAllOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginReimageAll +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientReimageAllResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reimageAll(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientReimageAllResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientReimageAllResponse](options.ResumeToken, client.pl, nil) + } +} + +// ReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation +// is only supported for managed disks. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*http.Response, error) { + req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// reimageAllCreateRequest creates the ReimageAll request. +func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginReimageAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRestart - Restarts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginRestartOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRestart +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientRestartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Restarts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM +// scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData +// method. +func (client *VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions) (VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse, error) { + req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, runtime.NewResponseError(resp) + } + return client.retrieveBootDiagnosticsDataHandleResponse(resp) +} + +// retrieveBootDiagnosticsDataCreateRequest creates the RetrieveBootDiagnosticsData request. +func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SasURIExpirationTimeInMinutes != nil { + reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) + } + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// retrieveBootDiagnosticsDataHandleResponse handles the RetrieveBootDiagnosticsData response. +func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse, error) { + result := VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { + return VirtualMachineScaleSetVMsClientRetrieveBootDiagnosticsDataResponse{}, err + } + return result, nil +} + +// BeginRunCommand - Run command on a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// parameters - Parameters supplied to the Run command operation. +// options - VirtualMachineScaleSetVMsClientBeginRunCommandOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginRunCommand +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientRunCommandResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.runCommand(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachineScaleSetVMsClientRunCommandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientRunCommandResponse](options.ResumeToken, client.pl, nil) + } +} + +// RunCommand - Run command on a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*http.Response, error) { + req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// runCommandCreateRequest creates the RunCommand request. +func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsClientBeginRunCommandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json, text/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// SimulateEviction - The operation to simulate the eviction of spot virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientSimulateEvictionOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.SimulateEviction +// method. +func (client *VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientSimulateEvictionOptions) (VirtualMachineScaleSetVMsClientSimulateEvictionResponse, error) { + req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, runtime.NewResponseError(resp) + } + return VirtualMachineScaleSetVMsClientSimulateEvictionResponse{}, nil +} + +// simulateEvictionCreateRequest creates the SimulateEviction request. +func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientSimulateEvictionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - Starts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set. +// instanceID - The instance ID of the virtual machine. +// options - VirtualMachineScaleSetVMsClientBeginStartOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginStart +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientStartResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts a virtual machine in a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Updates a virtual machine of a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +// resourceGroupName - The name of the resource group. +// vmScaleSetName - The name of the VM scale set where the extension should be create or updated. +// instanceID - The instance ID of the virtual machine. +// parameters - Parameters supplied to the Update Virtual Machine Scale Sets VM operation. +// options - VirtualMachineScaleSetVMsClientBeginUpdateOptions contains the optional parameters for the VirtualMachineScaleSetVMsClient.BeginUpdate +// method. +func (client *VirtualMachineScaleSetVMsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineScaleSetVMsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VirtualMachineScaleSetVMsClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VirtualMachineScaleSetVMsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates a virtual machine of a VM scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01 +func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vmScaleSetName == "" { + return nil, errors.New("parameter vmScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmScaleSetName}", url.PathEscape(vmScaleSetName)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinesizes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinesizes_client.go new file mode 100644 index 000000000..2a2e21db6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4/virtualmachinesizes_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualMachineSizesClient contains the methods for the VirtualMachineSizes group. +// Don't use this type directly, use NewVirtualMachineSizesClient() instead. +type VirtualMachineSizesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualMachineSizesClient creates a new instance of VirtualMachineSizesClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualMachineSizesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualMachineSizesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] +// Generated from API version 2022-08-01 +// location - The location upon which virtual-machine-sizes is queried. +// options - VirtualMachineSizesClientListOptions contains the optional parameters for the VirtualMachineSizesClient.List +// method. +func (client *VirtualMachineSizesClient) NewListPager(location string, options *VirtualMachineSizesClientListOptions) *runtime.Pager[VirtualMachineSizesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualMachineSizesClientListResponse]{ + More: func(page VirtualMachineSizesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *VirtualMachineSizesClientListResponse) (VirtualMachineSizesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return VirtualMachineSizesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualMachineSizesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineSizesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineSizesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualMachineSizesClient) listHandleResponse(resp *http.Response) (VirtualMachineSizesClientListResponse, error) { + result := VirtualMachineSizesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return VirtualMachineSizesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/CHANGELOG.md new file mode 100644 index 000000000..7bc9c4503 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/CHANGELOG.md @@ -0,0 +1,583 @@ +# Release History + +## 2.0.1 (2022-10-14) +### Others Changes +- Update live test dependencies + +## 2.0.0 (2022-09-29) +### Breaking Changes + +- Const `DdosCustomPolicyProtocolSyn` has been removed +- Const `DdosCustomPolicyTriggerSensitivityOverrideHigh` has been removed +- Const `DdosSettingsProtectionCoverageBasic` has been removed +- Const `DdosCustomPolicyProtocolUDP` has been removed +- Const `DdosCustomPolicyProtocolTCP` has been removed +- Const `DdosCustomPolicyTriggerSensitivityOverrideLow` has been removed +- Const `DdosCustomPolicyTriggerSensitivityOverrideDefault` has been removed +- Const `DdosSettingsProtectionCoverageStandard` has been removed +- Const `DdosCustomPolicyTriggerSensitivityOverrideRelaxed` has been removed +- Type alias `DdosSettingsProtectionCoverage` has been removed +- Type alias `DdosCustomPolicyTriggerSensitivityOverride` has been removed +- Type alias `DdosCustomPolicyProtocol` has been removed +- Function `PossibleDdosCustomPolicyProtocolValues` has been removed +- Function `PossibleDdosSettingsProtectionCoverageValues` has been removed +- Function `PossibleDdosCustomPolicyTriggerSensitivityOverrideValues` has been removed +- Struct `ProtocolCustomSettingsFormat` has been removed +- Field `PublicIPAddresses` of struct `DdosCustomPolicyPropertiesFormat` has been removed +- Field `ProtocolCustomSettings` of struct `DdosCustomPolicyPropertiesFormat` has been removed +- Field `DdosCustomPolicy` of struct `DdosSettings` has been removed +- Field `ProtectedIP` of struct `DdosSettings` has been removed +- Field `ProtectionCoverage` of struct `DdosSettings` has been removed + +### Features Added + +- New const `ApplicationGatewayWafRuleStateTypesEnabled` +- New const `RouteMapMatchConditionNotEquals` +- New const `ActionTypeBlock` +- New const `RouteMapActionTypeUnknown` +- New const `GeoAFRI` +- New const `IsWorkloadProtectedFalse` +- New const `ApplicationGatewayRuleSetStatusOptionsDeprecated` +- New const `ApplicationGatewayWafRuleActionTypesAllow` +- New const `RouteMapActionTypeRemove` +- New const `ApplicationGatewayClientRevocationOptionsNone` +- New const `NextStepContinue` +- New const `SlotTypeProduction` +- New const `NetworkIntentPolicyBasedServiceAllowRulesOnly` +- New const `ApplicationGatewayTierTypesWAFV2` +- New const `ActionTypeLog` +- New const `CommissionedStateDeprovisioned` +- New const `RouteMapMatchConditionEquals` +- New const `GeoOCEANIA` +- New const `GeoGLOBAL` +- New const `WebApplicationFirewallTransformUppercase` +- New const `NextStepUnknown` +- New const `ApplicationGatewayTierTypesWAF` +- New const `ApplicationGatewayWafRuleActionTypesNone` +- New const `CustomIPPrefixTypeSingular` +- New const `GeoME` +- New const `GeoLATAM` +- New const `ApplicationGatewayWafRuleActionTypesBlock` +- New const `ApplicationGatewayRuleSetStatusOptionsGA` +- New const `RouteMapMatchConditionUnknown` +- New const `ApplicationGatewayWafRuleStateTypesDisabled` +- New const `ApplicationGatewayTierTypesStandardV2` +- New const `VnetLocalRouteOverrideCriteriaEqual` +- New const `ManagedRuleEnabledStateEnabled` +- New const `RouteMapMatchConditionContains` +- New const `DdosSettingsProtectionModeDisabled` +- New const `ActionTypeAnomalyScoring` +- New const `ActionTypeAllow` +- New const `SlotTypeStaging` +- New const `GeoAQ` +- New const `RouteMapMatchConditionNotContains` +- New const `ApplicationGatewayClientRevocationOptionsOCSP` +- New const `RouteMapActionTypeReplace` +- New const `GeoNAM` +- New const `CustomIPPrefixTypeChild` +- New const `GeoEURO` +- New const `ExpressRoutePortsBillingTypeMeteredData` +- New const `GeoAPAC` +- New const `CustomIPPrefixTypeParent` +- New const `VnetLocalRouteOverrideCriteriaContains` +- New const `DdosSettingsProtectionModeVirtualNetworkInherited` +- New const `ApplicationGatewayWafRuleActionTypesLog` +- New const `ApplicationGatewayWafRuleActionTypesAnomalyScoring` +- New const `ApplicationGatewayRuleSetStatusOptionsSupported` +- New const `ExpressRoutePortsBillingTypeUnlimitedData` +- New const `DdosSettingsProtectionModeEnabled` +- New const `IsWorkloadProtectedTrue` +- New const `ApplicationGatewayRuleSetStatusOptionsPreview` +- New const `RouteMapActionTypeDrop` +- New const `ApplicationGatewayTierTypesStandard` +- New const `NextStepTerminate` +- New const `RouteMapActionTypeAdd` +- New type alias `DdosSettingsProtectionMode` +- New type alias `ApplicationGatewayWafRuleActionTypes` +- New type alias `ApplicationGatewayClientRevocationOptions` +- New type alias `NextStep` +- New type alias `ActionType` +- New type alias `SlotType` +- New type alias `IsWorkloadProtected` +- New type alias `RouteMapMatchCondition` +- New type alias `ApplicationGatewayWafRuleStateTypes` +- New type alias `ApplicationGatewayTierTypes` +- New type alias `CustomIPPrefixType` +- New type alias `RouteMapActionType` +- New type alias `ExpressRoutePortsBillingType` +- New type alias `ApplicationGatewayRuleSetStatusOptions` +- New type alias `Geo` +- New type alias `VnetLocalRouteOverrideCriteria` +- New function `PossibleSlotTypeValues() []SlotType` +- New function `NewVipSwapClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VipSwapClient, error)` +- New function `PossibleNextStepValues() []NextStep` +- New function `*RouteMapsClient.BeginDelete(context.Context, string, string, string, *RouteMapsClientBeginDeleteOptions) (*runtime.Poller[RouteMapsClientDeleteResponse], error)` +- New function `PossibleRouteMapActionTypeValues() []RouteMapActionType` +- New function `*RouteMapsClient.Get(context.Context, string, string, string, *RouteMapsClientGetOptions) (RouteMapsClientGetResponse, error)` +- New function `*VirtualHubsClient.BeginGetOutboundRoutes(context.Context, string, string, GetOutboundRoutesParameters, *VirtualHubsClientBeginGetOutboundRoutesOptions) (*runtime.Poller[VirtualHubsClientGetOutboundRoutesResponse], error)` +- New function `PossibleGeoValues() []Geo` +- New function `PossibleApplicationGatewayClientRevocationOptionsValues() []ApplicationGatewayClientRevocationOptions` +- New function `*ApplicationGatewayWafDynamicManifestsClient.NewGetPager(string, *ApplicationGatewayWafDynamicManifestsClientGetOptions) *runtime.Pager[ApplicationGatewayWafDynamicManifestsClientGetResponse]` +- New function `*ApplicationGatewayWafDynamicManifestsDefaultClient.Get(context.Context, string, *ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions) (ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse, error)` +- New function `PossibleActionTypeValues() []ActionType` +- New function `*RouteMapsClient.NewListPager(string, string, *RouteMapsClientListOptions) *runtime.Pager[RouteMapsClientListResponse]` +- New function `PossibleApplicationGatewayTierTypesValues() []ApplicationGatewayTierTypes` +- New function `NewApplicationGatewayWafDynamicManifestsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ApplicationGatewayWafDynamicManifestsClient, error)` +- New function `PossibleApplicationGatewayRuleSetStatusOptionsValues() []ApplicationGatewayRuleSetStatusOptions` +- New function `PossibleCustomIPPrefixTypeValues() []CustomIPPrefixType` +- New function `NewApplicationGatewayWafDynamicManifestsDefaultClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ApplicationGatewayWafDynamicManifestsDefaultClient, error)` +- New function `PossibleVnetLocalRouteOverrideCriteriaValues() []VnetLocalRouteOverrideCriteria` +- New function `*VirtualHubsClient.BeginGetInboundRoutes(context.Context, string, string, GetInboundRoutesParameters, *VirtualHubsClientBeginGetInboundRoutesOptions) (*runtime.Poller[VirtualHubsClientGetInboundRoutesResponse], error)` +- New function `*VipSwapClient.Get(context.Context, string, string, *VipSwapClientGetOptions) (VipSwapClientGetResponse, error)` +- New function `*PublicIPAddressesClient.BeginDdosProtectionStatus(context.Context, string, string, *PublicIPAddressesClientBeginDdosProtectionStatusOptions) (*runtime.Poller[PublicIPAddressesClientDdosProtectionStatusResponse], error)` +- New function `PossibleExpressRoutePortsBillingTypeValues() []ExpressRoutePortsBillingType` +- New function `*VipSwapClient.List(context.Context, string, string, *VipSwapClientListOptions) (VipSwapClientListResponse, error)` +- New function `*VirtualNetworksClient.BeginListDdosProtectionStatus(context.Context, string, string, *VirtualNetworksClientBeginListDdosProtectionStatusOptions) (*runtime.Poller[*runtime.Pager[VirtualNetworksClientListDdosProtectionStatusResponse]], error)` +- New function `PossibleIsWorkloadProtectedValues() []IsWorkloadProtected` +- New function `PossibleDdosSettingsProtectionModeValues() []DdosSettingsProtectionMode` +- New function `PossibleApplicationGatewayWafRuleStateTypesValues() []ApplicationGatewayWafRuleStateTypes` +- New function `NewRouteMapsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RouteMapsClient, error)` +- New function `PossibleRouteMapMatchConditionValues() []RouteMapMatchCondition` +- New function `*VipSwapClient.BeginCreate(context.Context, string, string, SwapResource, *VipSwapClientBeginCreateOptions) (*runtime.Poller[VipSwapClientCreateResponse], error)` +- New function `PossibleApplicationGatewayWafRuleActionTypesValues() []ApplicationGatewayWafRuleActionTypes` +- New function `*RouteMapsClient.BeginCreateOrUpdate(context.Context, string, string, string, RouteMap, *RouteMapsClientBeginCreateOrUpdateOptions) (*runtime.Poller[RouteMapsClientCreateOrUpdateResponse], error)` +- New struct `Action` +- New struct `ApplicationGatewayFirewallManifestRuleSet` +- New struct `ApplicationGatewayWafDynamicManifestPropertiesResult` +- New struct `ApplicationGatewayWafDynamicManifestResult` +- New struct `ApplicationGatewayWafDynamicManifestResultList` +- New struct `ApplicationGatewayWafDynamicManifestsClient` +- New struct `ApplicationGatewayWafDynamicManifestsClientGetOptions` +- New struct `ApplicationGatewayWafDynamicManifestsClientGetResponse` +- New struct `ApplicationGatewayWafDynamicManifestsDefaultClient` +- New struct `ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions` +- New struct `ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse` +- New struct `Criterion` +- New struct `DefaultRuleSetPropertyFormat` +- New struct `EffectiveRouteMapRoute` +- New struct `GetInboundRoutesParameters` +- New struct `GetOutboundRoutesParameters` +- New struct `ListRouteMapsResult` +- New struct `Parameter` +- New struct `PublicIPAddressesClientBeginDdosProtectionStatusOptions` +- New struct `PublicIPAddressesClientDdosProtectionStatusResponse` +- New struct `PublicIPDdosProtectionStatusResult` +- New struct `RouteMap` +- New struct `RouteMapProperties` +- New struct `RouteMapRule` +- New struct `RouteMapsClient` +- New struct `RouteMapsClientBeginCreateOrUpdateOptions` +- New struct `RouteMapsClientBeginDeleteOptions` +- New struct `RouteMapsClientCreateOrUpdateResponse` +- New struct `RouteMapsClientDeleteResponse` +- New struct `RouteMapsClientGetOptions` +- New struct `RouteMapsClientGetResponse` +- New struct `RouteMapsClientListOptions` +- New struct `RouteMapsClientListResponse` +- New struct `StaticRoutesConfig` +- New struct `SwapResource` +- New struct `SwapResourceListResult` +- New struct `SwapResourceProperties` +- New struct `VipSwapClient` +- New struct `VipSwapClientBeginCreateOptions` +- New struct `VipSwapClientCreateResponse` +- New struct `VipSwapClientGetOptions` +- New struct `VipSwapClientGetResponse` +- New struct `VipSwapClientListOptions` +- New struct `VipSwapClientListResponse` +- New struct `VirtualHubsClientBeginGetInboundRoutesOptions` +- New struct `VirtualHubsClientBeginGetOutboundRoutesOptions` +- New struct `VirtualHubsClientGetInboundRoutesResponse` +- New struct `VirtualHubsClientGetOutboundRoutesResponse` +- New struct `VirtualNetworkDdosProtectionStatusResult` +- New struct `VirtualNetworkGatewayPolicyGroup` +- New struct `VirtualNetworkGatewayPolicyGroupMember` +- New struct `VirtualNetworkGatewayPolicyGroupProperties` +- New struct `VirtualNetworksClientBeginListDdosProtectionStatusOptions` +- New struct `VirtualNetworksClientListDdosProtectionStatusResponse` +- New struct `VngClientConnectionConfiguration` +- New struct `VngClientConnectionConfigurationProperties` +- New field `RouteMaps` in struct `VirtualHubProperties` +- New field `Tiers` in struct `ApplicationGatewayFirewallRuleSetPropertiesFormat` +- New field `EnablePrivateLinkFastPath` in struct `VirtualNetworkGatewayConnectionListEntityPropertiesFormat` +- New field `ColoLocation` in struct `ExpressRouteLinkPropertiesFormat` +- New field `EnablePrivateLinkFastPath` in struct `VirtualNetworkGatewayConnectionPropertiesFormat` +- New field `DisableTCPStateTracking` in struct `InterfacePropertiesFormat` +- New field `Top` in struct `ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions` +- New field `Action` in struct `ManagedRuleOverride` +- New field `VngClientConnectionConfigurations` in struct `VPNClientConfiguration` +- New field `StaticRoutesConfig` in struct `VnetRoute` +- New field `AllowVirtualWanTraffic` in struct `VirtualNetworkGatewayPropertiesFormat` +- New field `VirtualNetworkGatewayPolicyGroups` in struct `VirtualNetworkGatewayPropertiesFormat` +- New field `AllowRemoteVnetTraffic` in struct `VirtualNetworkGatewayPropertiesFormat` +- New field `RuleIDString` in struct `ApplicationGatewayFirewallRule` +- New field `State` in struct `ApplicationGatewayFirewallRule` +- New field `Action` in struct `ApplicationGatewayFirewallRule` +- New field `Top` in struct `ManagerDeploymentStatusClientListOptions` +- New field `InboundRouteMap` in struct `RoutingConfiguration` +- New field `OutboundRouteMap` in struct `RoutingConfiguration` +- New field `VerifyClientRevocation` in struct `ApplicationGatewayClientAuthConfiguration` +- New field `Top` in struct `ManagementClientListActiveSecurityAdminRulesOptions` +- New field `ProbeThreshold` in struct `ProbePropertiesFormat` +- New field `AllowNonVirtualWanTraffic` in struct `ExpressRouteGatewayProperties` +- New field `Top` in struct `ManagementClientListActiveConnectivityConfigurationsOptions` +- New field `PublicIPAddresses` in struct `DdosProtectionPlanPropertiesFormat` +- New field `ProtectionMode` in struct `DdosSettings` +- New field `DdosProtectionPlan` in struct `DdosSettings` +- New field `ExpressRouteAdvertise` in struct `CustomIPPrefixPropertiesFormat` +- New field `Geo` in struct `CustomIPPrefixPropertiesFormat` +- New field `PrefixType` in struct `CustomIPPrefixPropertiesFormat` +- New field `Asn` in struct `CustomIPPrefixPropertiesFormat` +- New field `Top` in struct `ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions` +- New field `EnablePrivateLinkFastPath` in struct `ExpressRouteConnectionProperties` +- New field `BillingType` in struct `ExpressRoutePortPropertiesFormat` + + +## 1.1.0 (2022-08-05) +### Features Added + +- New const `SecurityConfigurationRuleDirectionInbound` +- New const `IsGlobalFalse` +- New const `EndpointTypeAzureVMSS` +- New const `ScopeConnectionStateConflict` +- New const `SecurityConfigurationRuleDirectionOutbound` +- New const `GroupConnectivityDirectlyConnected` +- New const `ScopeConnectionStateRejected` +- New const `ConfigurationTypeConnectivity` +- New const `AutoLearnPrivateRangesModeEnabled` +- New const `UseHubGatewayFalse` +- New const `NetworkIntentPolicyBasedServiceNone` +- New const `DeleteExistingPeeringFalse` +- New const `EffectiveAdminRuleKindDefault` +- New const `DeploymentStatusFailed` +- New const `AddressPrefixTypeIPPrefix` +- New const `AddressPrefixTypeServiceTag` +- New const `UseHubGatewayTrue` +- New const `WebApplicationFirewallOperatorAny` +- New const `SecurityConfigurationRuleAccessAlwaysAllow` +- New const `CreatedByTypeUser` +- New const `EndpointTypeAzureArcVM` +- New const `DeploymentStatusNotStarted` +- New const `SecurityConfigurationRuleProtocolTCP` +- New const `SecurityConfigurationRuleAccessDeny` +- New const `SecurityConfigurationRuleProtocolEsp` +- New const `IsGlobalTrue` +- New const `DeploymentStatusDeployed` +- New const `NetworkIntentPolicyBasedServiceAll` +- New const `SecurityConfigurationRuleProtocolUDP` +- New const `CreatedByTypeKey` +- New const `PacketCaptureTargetTypeAzureVMSS` +- New const `ApplicationGatewaySSLPolicyTypeCustomV2` +- New const `DeleteExistingPeeringTrue` +- New const `ScopeConnectionStateConnected` +- New const `ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101S` +- New const `ConnectivityTopologyMesh` +- New const `CreatedByTypeManagedIdentity` +- New const `AdminRuleKindCustom` +- New const `ApplicationGatewaySSLProtocolTLSv13` +- New const `ConnectivityTopologyHubAndSpoke` +- New const `ScopeConnectionStateRevoked` +- New const `ConfigurationTypeSecurityAdmin` +- New const `SecurityConfigurationRuleProtocolAh` +- New const `CommissionedStateCommissionedNoInternetAdvertise` +- New const `ScopeConnectionStatePending` +- New const `SecurityConfigurationRuleAccessAllow` +- New const `SecurityConfigurationRuleProtocolIcmp` +- New const `AutoLearnPrivateRangesModeDisabled` +- New const `SecurityConfigurationRuleProtocolAny` +- New const `ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101` +- New const `CreatedByTypeApplication` +- New const `GroupConnectivityNone` +- New const `EffectiveAdminRuleKindCustom` +- New const `AdminRuleKindDefault` +- New const `DeploymentStatusDeploying` +- New const `PacketCaptureTargetTypeAzureVM` +- New function `*ManagementClient.ListActiveConnectivityConfigurations(context.Context, string, string, ActiveConfigurationParameter, *ManagementClientListActiveConnectivityConfigurationsOptions) (ManagementClientListActiveConnectivityConfigurationsResponse, error)` +- New function `*ManagersClient.NewListBySubscriptionPager(*ManagersClientListBySubscriptionOptions) *runtime.Pager[ManagersClientListBySubscriptionResponse]` +- New function `NewStaticMembersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StaticMembersClient, error)` +- New function `NewAdminRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AdminRulesClient, error)` +- New function `*EffectiveDefaultSecurityAdminRule.GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule` +- New function `PossibleAddressPrefixTypeValues() []AddressPrefixType` +- New function `PossibleUseHubGatewayValues() []UseHubGateway` +- New function `*ScopeConnectionsClient.Delete(context.Context, string, string, string, *ScopeConnectionsClientDeleteOptions) (ScopeConnectionsClientDeleteResponse, error)` +- New function `PossibleIsGlobalValues() []IsGlobal` +- New function `*ManagementClient.ListActiveSecurityAdminRules(context.Context, string, string, ActiveConfigurationParameter, *ManagementClientListActiveSecurityAdminRulesOptions) (ManagementClientListActiveSecurityAdminRulesResponse, error)` +- New function `*ManagersClient.NewListPager(string, *ManagersClientListOptions) *runtime.Pager[ManagersClientListResponse]` +- New function `NewConnectivityConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectivityConfigurationsClient, error)` +- New function `*GroupsClient.Get(context.Context, string, string, string, *GroupsClientGetOptions) (GroupsClientGetResponse, error)` +- New function `PossibleAdminRuleKindValues() []AdminRuleKind` +- New function `*ScopeConnectionsClient.Get(context.Context, string, string, string, *ScopeConnectionsClientGetOptions) (ScopeConnectionsClientGetResponse, error)` +- New function `*AdminRuleCollectionsClient.CreateOrUpdate(context.Context, string, string, string, string, AdminRuleCollection, *AdminRuleCollectionsClientCreateOrUpdateOptions) (AdminRuleCollectionsClientCreateOrUpdateResponse, error)` +- New function `PossibleScopeConnectionStateValues() []ScopeConnectionState` +- New function `*ConnectivityConfigurationsClient.NewListPager(string, string, *ConnectivityConfigurationsClientListOptions) *runtime.Pager[ConnectivityConfigurationsClientListResponse]` +- New function `*BaseAdminRule.GetBaseAdminRule() *BaseAdminRule` +- New function `PossibleSecurityConfigurationRuleProtocolValues() []SecurityConfigurationRuleProtocol` +- New function `*AdminRulesClient.CreateOrUpdate(context.Context, string, string, string, string, string, BaseAdminRuleClassification, *AdminRulesClientCreateOrUpdateOptions) (AdminRulesClientCreateOrUpdateResponse, error)` +- New function `PossibleNetworkIntentPolicyBasedServiceValues() []NetworkIntentPolicyBasedService` +- New function `*ManagementGroupNetworkManagerConnectionsClient.Delete(context.Context, string, string, *ManagementGroupNetworkManagerConnectionsClientDeleteOptions) (ManagementGroupNetworkManagerConnectionsClientDeleteResponse, error)` +- New function `PossibleSecurityConfigurationRuleAccessValues() []SecurityConfigurationRuleAccess` +- New function `*ManagersClient.BeginDelete(context.Context, string, string, *ManagersClientBeginDeleteOptions) (*runtime.Poller[ManagersClientDeleteResponse], error)` +- New function `*ManagementClient.ExpressRouteProviderPort(context.Context, string, *ManagementClientExpressRouteProviderPortOptions) (ManagementClientExpressRouteProviderPortResponse, error)` +- New function `*ActiveBaseSecurityAdminRule.GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule` +- New function `*ConnectivityConfigurationsClient.BeginDelete(context.Context, string, string, string, *ConnectivityConfigurationsClientBeginDeleteOptions) (*runtime.Poller[ConnectivityConfigurationsClientDeleteResponse], error)` +- New function `*AdminRuleCollectionsClient.BeginDelete(context.Context, string, string, string, string, *AdminRuleCollectionsClientBeginDeleteOptions) (*runtime.Poller[AdminRuleCollectionsClientDeleteResponse], error)` +- New function `*ConnectivityConfigurationsClient.CreateOrUpdate(context.Context, string, string, string, ConnectivityConfiguration, *ConnectivityConfigurationsClientCreateOrUpdateOptions) (ConnectivityConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*SecurityAdminConfigurationsClient.Get(context.Context, string, string, string, *SecurityAdminConfigurationsClientGetOptions) (SecurityAdminConfigurationsClientGetResponse, error)` +- New function `*StaticMembersClient.Delete(context.Context, string, string, string, string, *StaticMembersClientDeleteOptions) (StaticMembersClientDeleteResponse, error)` +- New function `*ManagerDeploymentStatusClient.List(context.Context, string, string, ManagerDeploymentStatusParameter, *ManagerDeploymentStatusClientListOptions) (ManagerDeploymentStatusClientListResponse, error)` +- New function `*SubscriptionNetworkManagerConnectionsClient.Delete(context.Context, string, *SubscriptionNetworkManagerConnectionsClientDeleteOptions) (SubscriptionNetworkManagerConnectionsClientDeleteResponse, error)` +- New function `PossibleEffectiveAdminRuleKindValues() []EffectiveAdminRuleKind` +- New function `*AdminRulesClient.NewListPager(string, string, string, string, *AdminRulesClientListOptions) *runtime.Pager[AdminRulesClientListResponse]` +- New function `*GroupsClient.NewListPager(string, string, *GroupsClientListOptions) *runtime.Pager[GroupsClientListResponse]` +- New function `*GroupsClient.BeginDelete(context.Context, string, string, string, *GroupsClientBeginDeleteOptions) (*runtime.Poller[GroupsClientDeleteResponse], error)` +- New function `*StaticMembersClient.NewListPager(string, string, string, *StaticMembersClientListOptions) *runtime.Pager[StaticMembersClientListResponse]` +- New function `NewGroupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GroupsClient, error)` +- New function `PossibleCreatedByTypeValues() []CreatedByType` +- New function `PossibleAutoLearnPrivateRangesModeValues() []AutoLearnPrivateRangesMode` +- New function `*ManagementGroupNetworkManagerConnectionsClient.CreateOrUpdate(context.Context, string, string, ManagerConnection, *ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions) (ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse, error)` +- New function `*GroupsClient.CreateOrUpdate(context.Context, string, string, string, Group, *GroupsClientCreateOrUpdateOptions) (GroupsClientCreateOrUpdateResponse, error)` +- New function `*ActiveSecurityAdminRule.GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule` +- New function `*AdminRuleCollectionsClient.Get(context.Context, string, string, string, string, *AdminRuleCollectionsClientGetOptions) (AdminRuleCollectionsClientGetResponse, error)` +- New function `*ManagersClient.CreateOrUpdate(context.Context, string, string, Manager, *ManagersClientCreateOrUpdateOptions) (ManagersClientCreateOrUpdateResponse, error)` +- New function `*SubscriptionNetworkManagerConnectionsClient.NewListPager(*SubscriptionNetworkManagerConnectionsClientListOptions) *runtime.Pager[SubscriptionNetworkManagerConnectionsClientListResponse]` +- New function `*AdminRule.GetBaseAdminRule() *BaseAdminRule` +- New function `*AdminRulesClient.Get(context.Context, string, string, string, string, string, *AdminRulesClientGetOptions) (AdminRulesClientGetResponse, error)` +- New function `PossiblePacketCaptureTargetTypeValues() []PacketCaptureTargetType` +- New function `*ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules(context.Context, string, string, QueryRequestOptions, *ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse, error)` +- New function `*ManagementGroupNetworkManagerConnectionsClient.Get(context.Context, string, string, *ManagementGroupNetworkManagerConnectionsClientGetOptions) (ManagementGroupNetworkManagerConnectionsClientGetResponse, error)` +- New function `NewExpressRouteProviderPortsLocationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExpressRouteProviderPortsLocationClient, error)` +- New function `*DefaultAdminRule.GetBaseAdminRule() *BaseAdminRule` +- New function `*ConnectivityConfigurationsClient.Get(context.Context, string, string, string, *ConnectivityConfigurationsClientGetOptions) (ConnectivityConfigurationsClientGetResponse, error)` +- New function `NewManagersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagersClient, error)` +- New function `*SubscriptionNetworkManagerConnectionsClient.Get(context.Context, string, *SubscriptionNetworkManagerConnectionsClientGetOptions) (SubscriptionNetworkManagerConnectionsClientGetResponse, error)` +- New function `*EffectiveSecurityAdminRule.GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule` +- New function `*EffectiveBaseSecurityAdminRule.GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule` +- New function `NewScopeConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ScopeConnectionsClient, error)` +- New function `NewAdminRuleCollectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AdminRuleCollectionsClient, error)` +- New function `*ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations(context.Context, string, string, QueryRequestOptions, *ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse, error)` +- New function `PossibleGroupConnectivityValues() []GroupConnectivity` +- New function `NewSubscriptionNetworkManagerConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SubscriptionNetworkManagerConnectionsClient, error)` +- New function `*AzureFirewallsClient.BeginListLearnedPrefixes(context.Context, string, string, *AzureFirewallsClientBeginListLearnedPrefixesOptions) (*runtime.Poller[AzureFirewallsClientListLearnedPrefixesResponse], error)` +- New function `*ManagersClient.Patch(context.Context, string, string, PatchObject, *ManagersClientPatchOptions) (ManagersClientPatchResponse, error)` +- New function `*ManagersClient.Get(context.Context, string, string, *ManagersClientGetOptions) (ManagersClientGetResponse, error)` +- New function `*StaticMembersClient.CreateOrUpdate(context.Context, string, string, string, string, StaticMember, *StaticMembersClientCreateOrUpdateOptions) (StaticMembersClientCreateOrUpdateResponse, error)` +- New function `*AdminRuleCollectionsClient.NewListPager(string, string, string, *AdminRuleCollectionsClientListOptions) *runtime.Pager[AdminRuleCollectionsClientListResponse]` +- New function `*ScopeConnectionsClient.NewListPager(string, string, *ScopeConnectionsClientListOptions) *runtime.Pager[ScopeConnectionsClientListResponse]` +- New function `*ActiveDefaultSecurityAdminRule.GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule` +- New function `*ExpressRouteProviderPortsLocationClient.List(context.Context, *ExpressRouteProviderPortsLocationClientListOptions) (ExpressRouteProviderPortsLocationClientListResponse, error)` +- New function `*ManagerCommitsClient.BeginPost(context.Context, string, string, ManagerCommit, *ManagerCommitsClientBeginPostOptions) (*runtime.Poller[ManagerCommitsClientPostResponse], error)` +- New function `NewManagerCommitsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagerCommitsClient, error)` +- New function `PossibleConfigurationTypeValues() []ConfigurationType` +- New function `NewManagerDeploymentStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagerDeploymentStatusClient, error)` +- New function `*ScopeConnectionsClient.CreateOrUpdate(context.Context, string, string, string, ScopeConnection, *ScopeConnectionsClientCreateOrUpdateOptions) (ScopeConnectionsClientCreateOrUpdateResponse, error)` +- New function `*SecurityAdminConfigurationsClient.CreateOrUpdate(context.Context, string, string, string, SecurityAdminConfiguration, *SecurityAdminConfigurationsClientCreateOrUpdateOptions) (SecurityAdminConfigurationsClientCreateOrUpdateResponse, error)` +- New function `NewManagementGroupNetworkManagerConnectionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ManagementGroupNetworkManagerConnectionsClient, error)` +- New function `PossibleDeleteExistingPeeringValues() []DeleteExistingPeering` +- New function `PossibleDeploymentStatusValues() []DeploymentStatus` +- New function `*ManagementGroupNetworkManagerConnectionsClient.NewListPager(string, *ManagementGroupNetworkManagerConnectionsClientListOptions) *runtime.Pager[ManagementGroupNetworkManagerConnectionsClientListResponse]` +- New function `*SecurityAdminConfigurationsClient.NewListPager(string, string, *SecurityAdminConfigurationsClientListOptions) *runtime.Pager[SecurityAdminConfigurationsClientListResponse]` +- New function `PossibleConnectivityTopologyValues() []ConnectivityTopology` +- New function `*StaticMembersClient.Get(context.Context, string, string, string, string, *StaticMembersClientGetOptions) (StaticMembersClientGetResponse, error)` +- New function `PossibleSecurityConfigurationRuleDirectionValues() []SecurityConfigurationRuleDirection` +- New function `*SecurityAdminConfigurationsClient.BeginDelete(context.Context, string, string, string, *SecurityAdminConfigurationsClientBeginDeleteOptions) (*runtime.Poller[SecurityAdminConfigurationsClientDeleteResponse], error)` +- New function `NewSecurityAdminConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecurityAdminConfigurationsClient, error)` +- New function `*AdminRulesClient.BeginDelete(context.Context, string, string, string, string, string, *AdminRulesClientBeginDeleteOptions) (*runtime.Poller[AdminRulesClientDeleteResponse], error)` +- New function `*SubscriptionNetworkManagerConnectionsClient.CreateOrUpdate(context.Context, string, ManagerConnection, *SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions) (SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse, error)` +- New struct `ActiveBaseSecurityAdminRule` +- New struct `ActiveConfigurationParameter` +- New struct `ActiveConnectivityConfiguration` +- New struct `ActiveConnectivityConfigurationsListResult` +- New struct `ActiveDefaultSecurityAdminRule` +- New struct `ActiveSecurityAdminRule` +- New struct `ActiveSecurityAdminRulesListResult` +- New struct `AddressPrefixItem` +- New struct `AdminPropertiesFormat` +- New struct `AdminRule` +- New struct `AdminRuleCollection` +- New struct `AdminRuleCollectionListResult` +- New struct `AdminRuleCollectionPropertiesFormat` +- New struct `AdminRuleCollectionsClient` +- New struct `AdminRuleCollectionsClientBeginDeleteOptions` +- New struct `AdminRuleCollectionsClientCreateOrUpdateOptions` +- New struct `AdminRuleCollectionsClientCreateOrUpdateResponse` +- New struct `AdminRuleCollectionsClientDeleteResponse` +- New struct `AdminRuleCollectionsClientGetOptions` +- New struct `AdminRuleCollectionsClientGetResponse` +- New struct `AdminRuleCollectionsClientListOptions` +- New struct `AdminRuleCollectionsClientListResponse` +- New struct `AdminRuleListResult` +- New struct `AdminRulesClient` +- New struct `AdminRulesClientBeginDeleteOptions` +- New struct `AdminRulesClientCreateOrUpdateOptions` +- New struct `AdminRulesClientCreateOrUpdateResponse` +- New struct `AdminRulesClientDeleteResponse` +- New struct `AdminRulesClientGetOptions` +- New struct `AdminRulesClientGetResponse` +- New struct `AdminRulesClientListOptions` +- New struct `AdminRulesClientListResponse` +- New struct `AzureFirewallsClientBeginListLearnedPrefixesOptions` +- New struct `AzureFirewallsClientListLearnedPrefixesResponse` +- New struct `BaseAdminRule` +- New struct `ChildResource` +- New struct `ConfigurationGroup` +- New struct `ConnectivityConfiguration` +- New struct `ConnectivityConfigurationListResult` +- New struct `ConnectivityConfigurationProperties` +- New struct `ConnectivityConfigurationsClient` +- New struct `ConnectivityConfigurationsClientBeginDeleteOptions` +- New struct `ConnectivityConfigurationsClientCreateOrUpdateOptions` +- New struct `ConnectivityConfigurationsClientCreateOrUpdateResponse` +- New struct `ConnectivityConfigurationsClientDeleteResponse` +- New struct `ConnectivityConfigurationsClientGetOptions` +- New struct `ConnectivityConfigurationsClientGetResponse` +- New struct `ConnectivityConfigurationsClientListOptions` +- New struct `ConnectivityConfigurationsClientListResponse` +- New struct `ConnectivityGroupItem` +- New struct `CrossTenantScopes` +- New struct `DefaultAdminPropertiesFormat` +- New struct `DefaultAdminRule` +- New struct `EffectiveBaseSecurityAdminRule` +- New struct `EffectiveConnectivityConfiguration` +- New struct `EffectiveDefaultSecurityAdminRule` +- New struct `EffectiveSecurityAdminRule` +- New struct `ExpressRouteProviderPort` +- New struct `ExpressRouteProviderPortListResult` +- New struct `ExpressRouteProviderPortProperties` +- New struct `ExpressRouteProviderPortsLocationClient` +- New struct `ExpressRouteProviderPortsLocationClientListOptions` +- New struct `ExpressRouteProviderPortsLocationClientListResponse` +- New struct `Group` +- New struct `GroupListResult` +- New struct `GroupProperties` +- New struct `GroupsClient` +- New struct `GroupsClientBeginDeleteOptions` +- New struct `GroupsClientCreateOrUpdateOptions` +- New struct `GroupsClientCreateOrUpdateResponse` +- New struct `GroupsClientDeleteResponse` +- New struct `GroupsClientGetOptions` +- New struct `GroupsClientGetResponse` +- New struct `GroupsClientListOptions` +- New struct `GroupsClientListResponse` +- New struct `Hub` +- New struct `IPPrefixesList` +- New struct `ManagementClientExpressRouteProviderPortOptions` +- New struct `ManagementClientExpressRouteProviderPortResponse` +- New struct `ManagementClientListActiveConnectivityConfigurationsOptions` +- New struct `ManagementClientListActiveConnectivityConfigurationsResponse` +- New struct `ManagementClientListActiveSecurityAdminRulesOptions` +- New struct `ManagementClientListActiveSecurityAdminRulesResponse` +- New struct `ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions` +- New struct `ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse` +- New struct `ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions` +- New struct `ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse` +- New struct `ManagementGroupNetworkManagerConnectionsClient` +- New struct `ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions` +- New struct `ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse` +- New struct `ManagementGroupNetworkManagerConnectionsClientDeleteOptions` +- New struct `ManagementGroupNetworkManagerConnectionsClientDeleteResponse` +- New struct `ManagementGroupNetworkManagerConnectionsClientGetOptions` +- New struct `ManagementGroupNetworkManagerConnectionsClientGetResponse` +- New struct `ManagementGroupNetworkManagerConnectionsClientListOptions` +- New struct `ManagementGroupNetworkManagerConnectionsClientListResponse` +- New struct `Manager` +- New struct `ManagerCommit` +- New struct `ManagerCommitsClient` +- New struct `ManagerCommitsClientBeginPostOptions` +- New struct `ManagerCommitsClientPostResponse` +- New struct `ManagerConnection` +- New struct `ManagerConnectionListResult` +- New struct `ManagerConnectionProperties` +- New struct `ManagerDeploymentStatus` +- New struct `ManagerDeploymentStatusClient` +- New struct `ManagerDeploymentStatusClientListOptions` +- New struct `ManagerDeploymentStatusClientListResponse` +- New struct `ManagerDeploymentStatusListResult` +- New struct `ManagerDeploymentStatusParameter` +- New struct `ManagerEffectiveConnectivityConfigurationListResult` +- New struct `ManagerEffectiveSecurityAdminRulesListResult` +- New struct `ManagerListResult` +- New struct `ManagerProperties` +- New struct `ManagerPropertiesNetworkManagerScopes` +- New struct `ManagerSecurityGroupItem` +- New struct `ManagersClient` +- New struct `ManagersClientBeginDeleteOptions` +- New struct `ManagersClientCreateOrUpdateOptions` +- New struct `ManagersClientCreateOrUpdateResponse` +- New struct `ManagersClientDeleteResponse` +- New struct `ManagersClientGetOptions` +- New struct `ManagersClientGetResponse` +- New struct `ManagersClientListBySubscriptionOptions` +- New struct `ManagersClientListBySubscriptionResponse` +- New struct `ManagersClientListOptions` +- New struct `ManagersClientListResponse` +- New struct `ManagersClientPatchOptions` +- New struct `ManagersClientPatchResponse` +- New struct `PacketCaptureMachineScope` +- New struct `PatchObject` +- New struct `QueryRequestOptions` +- New struct `ScopeConnection` +- New struct `ScopeConnectionListResult` +- New struct `ScopeConnectionProperties` +- New struct `ScopeConnectionsClient` +- New struct `ScopeConnectionsClientCreateOrUpdateOptions` +- New struct `ScopeConnectionsClientCreateOrUpdateResponse` +- New struct `ScopeConnectionsClientDeleteOptions` +- New struct `ScopeConnectionsClientDeleteResponse` +- New struct `ScopeConnectionsClientGetOptions` +- New struct `ScopeConnectionsClientGetResponse` +- New struct `ScopeConnectionsClientListOptions` +- New struct `ScopeConnectionsClientListResponse` +- New struct `SecurityAdminConfiguration` +- New struct `SecurityAdminConfigurationListResult` +- New struct `SecurityAdminConfigurationPropertiesFormat` +- New struct `SecurityAdminConfigurationsClient` +- New struct `SecurityAdminConfigurationsClientBeginDeleteOptions` +- New struct `SecurityAdminConfigurationsClientCreateOrUpdateOptions` +- New struct `SecurityAdminConfigurationsClientCreateOrUpdateResponse` +- New struct `SecurityAdminConfigurationsClientDeleteResponse` +- New struct `SecurityAdminConfigurationsClientGetOptions` +- New struct `SecurityAdminConfigurationsClientGetResponse` +- New struct `SecurityAdminConfigurationsClientListOptions` +- New struct `SecurityAdminConfigurationsClientListResponse` +- New struct `StaticMember` +- New struct `StaticMemberListResult` +- New struct `StaticMemberProperties` +- New struct `StaticMembersClient` +- New struct `StaticMembersClientCreateOrUpdateOptions` +- New struct `StaticMembersClientCreateOrUpdateResponse` +- New struct `StaticMembersClientDeleteOptions` +- New struct `StaticMembersClientDeleteResponse` +- New struct `StaticMembersClientGetOptions` +- New struct `StaticMembersClientGetResponse` +- New struct `StaticMembersClientListOptions` +- New struct `StaticMembersClientListResponse` +- New struct `SubscriptionNetworkManagerConnectionsClient` +- New struct `SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions` +- New struct `SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse` +- New struct `SubscriptionNetworkManagerConnectionsClientDeleteOptions` +- New struct `SubscriptionNetworkManagerConnectionsClientDeleteResponse` +- New struct `SubscriptionNetworkManagerConnectionsClientGetOptions` +- New struct `SubscriptionNetworkManagerConnectionsClientGetResponse` +- New struct `SubscriptionNetworkManagerConnectionsClientListOptions` +- New struct `SubscriptionNetworkManagerConnectionsClientListResponse` +- New struct `SystemData` +- New struct `VirtualRouterAutoScaleConfiguration` +- New field `NoInternetAdvertise` in struct `CustomIPPrefixPropertiesFormat` +- New field `FlushConnection` in struct `SecurityGroupPropertiesFormat` +- New field `EnablePacFile` in struct `ExplicitProxySettings` +- New field `Scope` in struct `PacketCaptureParameters` +- New field `TargetType` in struct `PacketCaptureParameters` +- New field `Scope` in struct `PacketCaptureResultProperties` +- New field `TargetType` in struct `PacketCaptureResultProperties` +- New field `AutoLearnPrivateRanges` in struct `FirewallPolicySNAT` +- New field `VirtualRouterAutoScaleConfiguration` in struct `VirtualHubProperties` +- New field `Priority` in struct `ApplicationGatewayRoutingRulePropertiesFormat` + + +## 1.0.0 (2022-05-16) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/README.md new file mode 100644 index 000000000..84e8f5958 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/README.md @@ -0,0 +1,86 @@ +# Azure Network Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2) + +The `armnetwork` module provides operations for working with Azure Network. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/network/armnetwork) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Network module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Network. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Network modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client, err := armnetwork.NewVirtualHubBgpConnectionsClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armnetwork.NewVirtualHubBgpConnectionsClient(, cred, &options) +``` + +## More sample code + +- [IP Address](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/ipaddress) +- [Load Balancer](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/loadbalancer) +- [Network Interface](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/networkInterface) +- [Security Group](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/securitygroups) +- [Subnet](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/subnets) +- [Virtual Network](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/network/virtualnetwork) + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Network` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrulecollections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrulecollections_client.go new file mode 100644 index 000000000..b19c1f73f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrulecollections_client.go @@ -0,0 +1,351 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AdminRuleCollectionsClient contains the methods for the AdminRuleCollections group. +// Don't use this type directly, use NewAdminRuleCollectionsClient() instead. +type AdminRuleCollectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAdminRuleCollectionsClient creates a new instance of AdminRuleCollectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAdminRuleCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdminRuleCollectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AdminRuleCollectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates an admin rule collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// ruleCollection - The Rule Collection to create or update +// options - AdminRuleCollectionsClientCreateOrUpdateOptions contains the optional parameters for the AdminRuleCollectionsClient.CreateOrUpdate +// method. +func (client *AdminRuleCollectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleCollection AdminRuleCollection, options *AdminRuleCollectionsClientCreateOrUpdateOptions) (AdminRuleCollectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleCollection, options) + if err != nil { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AdminRuleCollectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleCollection AdminRuleCollection, options *AdminRuleCollectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, ruleCollection) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AdminRuleCollectionsClient) createOrUpdateHandleResponse(resp *http.Response) (AdminRuleCollectionsClientCreateOrUpdateResponse, error) { + result := AdminRuleCollectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdminRuleCollection); err != nil { + return AdminRuleCollectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes an admin rule collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// options - AdminRuleCollectionsClientBeginDeleteOptions contains the optional parameters for the AdminRuleCollectionsClient.BeginDelete +// method. +func (client *AdminRuleCollectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientBeginDeleteOptions) (*runtime.Poller[AdminRuleCollectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AdminRuleCollectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AdminRuleCollectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes an admin rule collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AdminRuleCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AdminRuleCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a network manager security admin configuration rule collection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// options - AdminRuleCollectionsClientGetOptions contains the optional parameters for the AdminRuleCollectionsClient.Get +// method. +func (client *AdminRuleCollectionsClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientGetOptions) (AdminRuleCollectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + if err != nil { + return AdminRuleCollectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRuleCollectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdminRuleCollectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AdminRuleCollectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRuleCollectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AdminRuleCollectionsClient) getHandleResponse(resp *http.Response) (AdminRuleCollectionsClientGetResponse, error) { + result := AdminRuleCollectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdminRuleCollection); err != nil { + return AdminRuleCollectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the rule collections in a security admin configuration, in a paginated format. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// options - AdminRuleCollectionsClientListOptions contains the optional parameters for the AdminRuleCollectionsClient.List +// method. +func (client *AdminRuleCollectionsClient) NewListPager(resourceGroupName string, networkManagerName string, configurationName string, options *AdminRuleCollectionsClientListOptions) *runtime.Pager[AdminRuleCollectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AdminRuleCollectionsClientListResponse]{ + More: func(page AdminRuleCollectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AdminRuleCollectionsClientListResponse) (AdminRuleCollectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AdminRuleCollectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRuleCollectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdminRuleCollectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AdminRuleCollectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *AdminRuleCollectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AdminRuleCollectionsClient) listHandleResponse(resp *http.Response) (AdminRuleCollectionsClientListResponse, error) { + result := AdminRuleCollectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdminRuleCollectionListResult); err != nil { + return AdminRuleCollectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrules_client.go new file mode 100644 index 000000000..97b53973e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/adminrules_client.go @@ -0,0 +1,368 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// AdminRulesClient contains the methods for the AdminRules group. +// Don't use this type directly, use NewAdminRulesClient() instead. +type AdminRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAdminRulesClient creates a new instance of AdminRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAdminRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdminRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AdminRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates an admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// ruleName - The name of the rule. +// adminRule - The admin rule to create or update +// options - AdminRulesClientCreateOrUpdateOptions contains the optional parameters for the AdminRulesClient.CreateOrUpdate +// method. +func (client *AdminRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, adminRule BaseAdminRuleClassification, options *AdminRulesClientCreateOrUpdateOptions) (AdminRulesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, adminRule, options) + if err != nil { + return AdminRulesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRulesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AdminRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AdminRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, adminRule BaseAdminRuleClassification, options *AdminRulesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, adminRule) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AdminRulesClient) createOrUpdateHandleResponse(resp *http.Response) (AdminRulesClientCreateOrUpdateResponse, error) { + result := AdminRulesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return AdminRulesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes an admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// ruleName - The name of the rule. +// options - AdminRulesClientBeginDeleteOptions contains the optional parameters for the AdminRulesClient.BeginDelete method. +func (client *AdminRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientBeginDeleteOptions) (*runtime.Poller[AdminRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AdminRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AdminRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes an admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AdminRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AdminRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a network manager security configuration admin rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// ruleName - The name of the rule. +// options - AdminRulesClientGetOptions contains the optional parameters for the AdminRulesClient.Get method. +func (client *AdminRulesClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientGetOptions) (AdminRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, ruleName, options) + if err != nil { + return AdminRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdminRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AdminRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, ruleName string, options *AdminRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AdminRulesClient) getHandleResponse(resp *http.Response) (AdminRulesClientGetResponse, error) { + result := AdminRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return AdminRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all network manager security configuration admin rules. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// ruleCollectionName - The name of the network manager security Configuration rule collection. +// options - AdminRulesClientListOptions contains the optional parameters for the AdminRulesClient.List method. +func (client *AdminRulesClient) NewListPager(resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRulesClientListOptions) *runtime.Pager[AdminRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AdminRulesClientListResponse]{ + More: func(page AdminRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AdminRulesClientListResponse) (AdminRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, ruleCollectionName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AdminRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdminRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdminRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AdminRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, ruleCollectionName string, options *AdminRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AdminRulesClient) listHandleResponse(resp *http.Response) (AdminRulesClientListResponse, error) { + result := AdminRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdminRuleListResult); err != nil { + return AdminRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivateendpointconnections_client.go new file mode 100644 index 000000000..ccd84f476 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivateendpointconnections_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationGatewayPrivateEndpointConnectionsClient contains the methods for the ApplicationGatewayPrivateEndpointConnections group. +// Don't use this type directly, use NewApplicationGatewayPrivateEndpointConnectionsClient() instead. +type ApplicationGatewayPrivateEndpointConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationGatewayPrivateEndpointConnectionsClient creates a new instance of ApplicationGatewayPrivateEndpointConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationGatewayPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewayPrivateEndpointConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayPrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginDelete - Deletes the specified private endpoint connection on application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// connectionName - The name of the application gateway private endpoint connection. +// options - ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the +// ApplicationGatewayPrivateEndpointConnectionsClient.BeginDelete method. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, applicationGatewayName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified private endpoint connection on application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified private endpoint connection on application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// connectionName - The name of the application gateway private endpoint connection. +// options - ApplicationGatewayPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.Get +// method. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientGetOptions) (ApplicationGatewayPrivateEndpointConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, options) + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, options *ApplicationGatewayPrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (ApplicationGatewayPrivateEndpointConnectionsClientGetResponse, error) { + result := ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateEndpointConnection); err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all private endpoint connections on an application gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewayPrivateEndpointConnectionsClientListOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.List +// method. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, applicationGatewayName string, options *ApplicationGatewayPrivateEndpointConnectionsClientListOptions) *runtime.Pager[ApplicationGatewayPrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewayPrivateEndpointConnectionsClientListResponse]{ + More: func(page ApplicationGatewayPrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewayPrivateEndpointConnectionsClientListResponse) (ApplicationGatewayPrivateEndpointConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewayPrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewayPrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (ApplicationGatewayPrivateEndpointConnectionsClientListResponse, error) { + result := ApplicationGatewayPrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateEndpointConnectionListResult); err != nil { + return ApplicationGatewayPrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates the specified private endpoint connection on application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// connectionName - The name of the application gateway private endpoint connection. +// parameters - Parameters supplied to update application gateway private endpoint connection operation. +// options - ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the +// ApplicationGatewayPrivateEndpointConnectionsClient.BeginUpdate method. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions) (*runtime.Poller[ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, applicationGatewayName, connectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates the specified private endpoint connection on application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, applicationGatewayName, connectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ApplicationGatewayPrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection, options *ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivatelinkresources_client.go new file mode 100644 index 000000000..579d6733a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewayprivatelinkresources_client.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationGatewayPrivateLinkResourcesClient contains the methods for the ApplicationGatewayPrivateLinkResources group. +// Don't use this type directly, use NewApplicationGatewayPrivateLinkResourcesClient() instead. +type ApplicationGatewayPrivateLinkResourcesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationGatewayPrivateLinkResourcesClient creates a new instance of ApplicationGatewayPrivateLinkResourcesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationGatewayPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewayPrivateLinkResourcesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayPrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists all private link resources on an application gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewayPrivateLinkResourcesClientListOptions contains the optional parameters for the ApplicationGatewayPrivateLinkResourcesClient.List +// method. +func (client *ApplicationGatewayPrivateLinkResourcesClient) NewListPager(resourceGroupName string, applicationGatewayName string, options *ApplicationGatewayPrivateLinkResourcesClientListOptions) *runtime.Pager[ApplicationGatewayPrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewayPrivateLinkResourcesClientListResponse]{ + More: func(page ApplicationGatewayPrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewayPrivateLinkResourcesClientListResponse) (ApplicationGatewayPrivateLinkResourcesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewayPrivateLinkResourcesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewayPrivateLinkResourcesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewayPrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ApplicationGatewayPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewayPrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateLinkResources" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ApplicationGatewayPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (ApplicationGatewayPrivateLinkResourcesClientListResponse, error) { + result := ApplicationGatewayPrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateLinkResourceListResult); err != nil { + return ApplicationGatewayPrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgateways_client.go new file mode 100644 index 000000000..e94e89912 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgateways_client.go @@ -0,0 +1,1040 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationGatewaysClient contains the methods for the ApplicationGateways group. +// Don't use this type directly, use NewApplicationGatewaysClient() instead. +type ApplicationGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationGatewaysClient creates a new instance of ApplicationGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginBackendHealth - Gets the backend health of the specified application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewaysClientBeginBackendHealthOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealth +// method. +func (client *ApplicationGatewaysClient) BeginBackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*runtime.Poller[ApplicationGatewaysClientBackendHealthResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.backendHealth(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientBackendHealthResponse](options.ResumeToken, client.pl, nil) + } +} + +// BackendHealth - Gets the backend health of the specified application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) backendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*http.Response, error) { + req, err := client.backendHealthCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// backendHealthCreateRequest creates the BackendHealth request. +func (client *ApplicationGatewaysClient) backendHealthCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginBackendHealthOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginBackendHealthOnDemand - Gets the backend health for given combination of backend pool and http setting of the specified +// application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// probeRequest - Request body for on-demand test probe operation. +// options - ApplicationGatewaysClientBeginBackendHealthOnDemandOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealthOnDemand +// method. +func (client *ApplicationGatewaysClient) BeginBackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*runtime.Poller[ApplicationGatewaysClientBackendHealthOnDemandResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.backendHealthOnDemand(ctx, resourceGroupName, applicationGatewayName, probeRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientBackendHealthOnDemandResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientBackendHealthOnDemandResponse](options.ResumeToken, client.pl, nil) + } +} + +// BackendHealthOnDemand - Gets the backend health for given combination of backend pool and http setting of the specified +// application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) backendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*http.Response, error) { + req, err := client.backendHealthOnDemandCreateRequest(ctx, resourceGroupName, applicationGatewayName, probeRequest, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// backendHealthOnDemandCreateRequest creates the BackendHealthOnDemand request. +func (client *ApplicationGatewaysClient) backendHealthOnDemandCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, options *ApplicationGatewaysClientBeginBackendHealthOnDemandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, probeRequest) +} + +// BeginCreateOrUpdate - Creates or updates the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// parameters - Parameters supplied to the create or update application gateway operation. +// options - ApplicationGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationGatewaysClient.BeginCreateOrUpdate +// method. +func (client *ApplicationGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[ApplicationGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, applicationGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ApplicationGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, options *ApplicationGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewaysClientBeginDeleteOptions contains the optional parameters for the ApplicationGatewaysClient.BeginDelete +// method. +func (client *ApplicationGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*runtime.Poller[ApplicationGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewaysClientGetOptions contains the optional parameters for the ApplicationGatewaysClient.Get method. +func (client *ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientGetOptions) (ApplicationGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return ApplicationGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationGatewaysClient) getHandleResponse(resp *http.Response) (ApplicationGatewaysClientGetResponse, error) { + result := ApplicationGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil { + return ApplicationGatewaysClientGetResponse{}, err + } + return result, nil +} + +// GetSSLPredefinedPolicy - Gets Ssl predefined policy with the specified policy name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// predefinedPolicyName - Name of Ssl predefined policy. +// options - ApplicationGatewaysClientGetSSLPredefinedPolicyOptions contains the optional parameters for the ApplicationGatewaysClient.GetSSLPredefinedPolicy +// method. +func (client *ApplicationGatewaysClient) GetSSLPredefinedPolicy(ctx context.Context, predefinedPolicyName string, options *ApplicationGatewaysClientGetSSLPredefinedPolicyOptions) (ApplicationGatewaysClientGetSSLPredefinedPolicyResponse, error) { + req, err := client.getSSLPredefinedPolicyCreateRequest(ctx, predefinedPolicyName, options) + if err != nil { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, runtime.NewResponseError(resp) + } + return client.getSSLPredefinedPolicyHandleResponse(resp) +} + +// getSSLPredefinedPolicyCreateRequest creates the GetSSLPredefinedPolicy request. +func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyCreateRequest(ctx context.Context, predefinedPolicyName string, options *ApplicationGatewaysClientGetSSLPredefinedPolicyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if predefinedPolicyName == "" { + return nil, errors.New("parameter predefinedPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{predefinedPolicyName}", url.PathEscape(predefinedPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSSLPredefinedPolicyHandleResponse handles the GetSSLPredefinedPolicy response. +func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyHandleResponse(resp *http.Response) (ApplicationGatewaysClientGetSSLPredefinedPolicyResponse, error) { + result := ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewaySSLPredefinedPolicy); err != nil { + return ApplicationGatewaysClientGetSSLPredefinedPolicyResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all application gateways in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ApplicationGatewaysClientListOptions contains the optional parameters for the ApplicationGatewaysClient.List +// method. +func (client *ApplicationGatewaysClient) NewListPager(resourceGroupName string, options *ApplicationGatewaysClientListOptions) *runtime.Pager[ApplicationGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListResponse]{ + More: func(page ApplicationGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListResponse) (ApplicationGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ApplicationGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ApplicationGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ApplicationGatewaysClient) listHandleResponse(resp *http.Response) (ApplicationGatewaysClientListResponse, error) { + result := ApplicationGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil { + return ApplicationGatewaysClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the application gateways in a subscription. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAllOptions contains the optional parameters for the ApplicationGatewaysClient.ListAll +// method. +func (client *ApplicationGatewaysClient) NewListAllPager(options *ApplicationGatewaysClientListAllOptions) *runtime.Pager[ApplicationGatewaysClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListAllResponse]{ + More: func(page ApplicationGatewaysClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListAllResponse) (ApplicationGatewaysClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewaysClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *ApplicationGatewaysClient) listAllCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *ApplicationGatewaysClient) listAllHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAllResponse, error) { + result := ApplicationGatewaysClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil { + return ApplicationGatewaysClientListAllResponse{}, err + } + return result, nil +} + +// ListAvailableRequestHeaders - Lists all available request headers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableRequestHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableRequestHeaders +// method. +func (client *ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableRequestHeadersOptions) (ApplicationGatewaysClientListAvailableRequestHeadersResponse, error) { + req, err := client.listAvailableRequestHeadersCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableRequestHeadersHandleResponse(resp) +} + +// listAvailableRequestHeadersCreateRequest creates the ListAvailableRequestHeaders request. +func (client *ApplicationGatewaysClient) listAvailableRequestHeadersCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableRequestHeadersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableRequestHeadersHandleResponse handles the ListAvailableRequestHeaders response. +func (client *ApplicationGatewaysClient) listAvailableRequestHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableRequestHeadersResponse, error) { + result := ApplicationGatewaysClientListAvailableRequestHeadersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { + return ApplicationGatewaysClientListAvailableRequestHeadersResponse{}, err + } + return result, nil +} + +// ListAvailableResponseHeaders - Lists all available response headers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableResponseHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableResponseHeaders +// method. +func (client *ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context, options *ApplicationGatewaysClientListAvailableResponseHeadersOptions) (ApplicationGatewaysClientListAvailableResponseHeadersResponse, error) { + req, err := client.listAvailableResponseHeadersCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableResponseHeadersHandleResponse(resp) +} + +// listAvailableResponseHeadersCreateRequest creates the ListAvailableResponseHeaders request. +func (client *ApplicationGatewaysClient) listAvailableResponseHeadersCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableResponseHeadersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableResponseHeadersHandleResponse handles the ListAvailableResponseHeaders response. +func (client *ApplicationGatewaysClient) listAvailableResponseHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableResponseHeadersResponse, error) { + result := ApplicationGatewaysClientListAvailableResponseHeadersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { + return ApplicationGatewaysClientListAvailableResponseHeadersResponse{}, err + } + return result, nil +} + +// ListAvailableSSLOptions - Lists available Ssl options for configuring Ssl policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableSSLOptionsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLOptions +// method. +func (client *ApplicationGatewaysClient) ListAvailableSSLOptions(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLOptionsOptions) (ApplicationGatewaysClientListAvailableSSLOptionsResponse, error) { + req, err := client.listAvailableSSLOptionsCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSSLOptionsHandleResponse(resp) +} + +// listAvailableSSLOptionsCreateRequest creates the ListAvailableSSLOptions request. +func (client *ApplicationGatewaysClient) listAvailableSSLOptionsCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLOptionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSSLOptionsHandleResponse handles the ListAvailableSSLOptions response. +func (client *ApplicationGatewaysClient) listAvailableSSLOptionsHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableSSLOptionsResponse, error) { + result := ApplicationGatewaysClientListAvailableSSLOptionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLOptions); err != nil { + return ApplicationGatewaysClientListAvailableSSLOptionsResponse{}, err + } + return result, nil +} + +// NewListAvailableSSLPredefinedPoliciesPager - Lists all SSL predefined policies for configuring Ssl policy. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLPredefinedPolicies +// method. +func (client *ApplicationGatewaysClient) NewListAvailableSSLPredefinedPoliciesPager(options *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions) *runtime.Pager[ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse]{ + More: func(page ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse) (ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAvailableSSLPredefinedPoliciesCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableSSLPredefinedPoliciesHandleResponse(resp) + }, + }) +} + +// listAvailableSSLPredefinedPoliciesCreateRequest creates the ListAvailableSSLPredefinedPolicies request. +func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSSLPredefinedPoliciesHandleResponse handles the ListAvailableSSLPredefinedPolicies response. +func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse, error) { + result := ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLPredefinedPolicies); err != nil { + return ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse{}, err + } + return result, nil +} + +// ListAvailableServerVariables - Lists all available server variables. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableServerVariablesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableServerVariables +// method. +func (client *ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context, options *ApplicationGatewaysClientListAvailableServerVariablesOptions) (ApplicationGatewaysClientListAvailableServerVariablesResponse, error) { + req, err := client.listAvailableServerVariablesCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableServerVariablesHandleResponse(resp) +} + +// listAvailableServerVariablesCreateRequest creates the ListAvailableServerVariables request. +func (client *ApplicationGatewaysClient) listAvailableServerVariablesCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableServerVariablesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableServerVariablesHandleResponse handles the ListAvailableServerVariables response. +func (client *ApplicationGatewaysClient) listAvailableServerVariablesHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableServerVariablesResponse, error) { + result := ApplicationGatewaysClientListAvailableServerVariablesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { + return ApplicationGatewaysClientListAvailableServerVariablesResponse{}, err + } + return result, nil +} + +// ListAvailableWafRuleSets - Lists all available web application firewall rule sets. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ApplicationGatewaysClientListAvailableWafRuleSetsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableWafRuleSets +// method. +func (client *ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context, options *ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (ApplicationGatewaysClientListAvailableWafRuleSetsResponse, error) { + req, err := client.listAvailableWafRuleSetsCreateRequest(ctx, options) + if err != nil { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, runtime.NewResponseError(resp) + } + return client.listAvailableWafRuleSetsHandleResponse(resp) +} + +// listAvailableWafRuleSetsCreateRequest creates the ListAvailableWafRuleSets request. +func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsCreateRequest(ctx context.Context, options *ApplicationGatewaysClientListAvailableWafRuleSetsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableWafRuleSetsHandleResponse handles the ListAvailableWafRuleSets response. +func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsHandleResponse(resp *http.Response) (ApplicationGatewaysClientListAvailableWafRuleSetsResponse, error) { + result := ApplicationGatewaysClientListAvailableWafRuleSetsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableWafRuleSetsResult); err != nil { + return ApplicationGatewaysClientListAvailableWafRuleSetsResponse{}, err + } + return result, nil +} + +// BeginStart - Starts the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewaysClientBeginStartOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStart +// method. +func (client *ApplicationGatewaysClient) BeginStart(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*runtime.Poller[ApplicationGatewaysClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts the specified application gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) start(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *ApplicationGatewaysClient) startCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - Stops the specified application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// options - ApplicationGatewaysClientBeginStopOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStop +// method. +func (client *ApplicationGatewaysClient) BeginStop(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*runtime.Poller[ApplicationGatewaysClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationGatewaysClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationGatewaysClientStopResponse](options.ResumeToken, client.pl, nil) + } +} + +// Stop - Stops the specified application gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationGatewaysClient) stop(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, applicationGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ApplicationGatewaysClient) stopCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, options *ApplicationGatewaysClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateTags - Updates the specified application gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationGatewayName - The name of the application gateway. +// parameters - Parameters supplied to update application gateway tags. +// options - ApplicationGatewaysClientUpdateTagsOptions contains the optional parameters for the ApplicationGatewaysClient.UpdateTags +// method. +func (client *ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject, options *ApplicationGatewaysClientUpdateTagsOptions) (ApplicationGatewaysClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, applicationGatewayName, parameters, options) + if err != nil { + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewaysClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ApplicationGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject, options *ApplicationGatewaysClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationGatewayName == "" { + return nil, errors.New("parameter applicationGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationGatewayName}", url.PathEscape(applicationGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ApplicationGatewaysClient) updateTagsHandleResponse(resp *http.Response) (ApplicationGatewaysClientUpdateTagsResponse, error) { + result := ApplicationGatewaysClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil { + return ApplicationGatewaysClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifests_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifests_client.go new file mode 100644 index 000000000..232148ed8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifests_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationGatewayWafDynamicManifestsClient contains the methods for the ApplicationGatewayWafDynamicManifests group. +// Don't use this type directly, use NewApplicationGatewayWafDynamicManifestsClient() instead. +type ApplicationGatewayWafDynamicManifestsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationGatewayWafDynamicManifestsClient creates a new instance of ApplicationGatewayWafDynamicManifestsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationGatewayWafDynamicManifestsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewayWafDynamicManifestsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayWafDynamicManifestsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewGetPager - Gets the regional application gateway waf manifest. +// Generated from API version 2022-05-01 +// location - The region where the nrp are located at. +// options - ApplicationGatewayWafDynamicManifestsClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsClient.Get +// method. +func (client *ApplicationGatewayWafDynamicManifestsClient) NewGetPager(location string, options *ApplicationGatewayWafDynamicManifestsClientGetOptions) *runtime.Pager[ApplicationGatewayWafDynamicManifestsClientGetResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationGatewayWafDynamicManifestsClientGetResponse]{ + More: func(page ApplicationGatewayWafDynamicManifestsClientGetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationGatewayWafDynamicManifestsClientGetResponse) (ApplicationGatewayWafDynamicManifestsClientGetResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationGatewayWafDynamicManifestsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewayWafDynamicManifestsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewayWafDynamicManifestsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) + }, + }) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationGatewayWafDynamicManifestsClient) getCreateRequest(ctx context.Context, location string, options *ApplicationGatewayWafDynamicManifestsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationGatewayWafDynamicManifestsClient) getHandleResponse(resp *http.Response) (ApplicationGatewayWafDynamicManifestsClientGetResponse, error) { + result := ApplicationGatewayWafDynamicManifestsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayWafDynamicManifestResultList); err != nil { + return ApplicationGatewayWafDynamicManifestsClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifestsdefault_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifestsdefault_client.go new file mode 100644 index 000000000..ef7e5f79f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationgatewaywafdynamicmanifestsdefault_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationGatewayWafDynamicManifestsDefaultClient contains the methods for the ApplicationGatewayWafDynamicManifestsDefault group. +// Don't use this type directly, use NewApplicationGatewayWafDynamicManifestsDefaultClient() instead. +type ApplicationGatewayWafDynamicManifestsDefaultClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationGatewayWafDynamicManifestsDefaultClient creates a new instance of ApplicationGatewayWafDynamicManifestsDefaultClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationGatewayWafDynamicManifestsDefaultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationGatewayWafDynamicManifestsDefaultClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationGatewayWafDynamicManifestsDefaultClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the regional application gateway waf manifest. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The region where the nrp are located at. +// options - ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsDefaultClient.Get +// method. +func (client *ApplicationGatewayWafDynamicManifestsDefaultClient) Get(ctx context.Context, location string, options *ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions) (ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, options) + if err != nil { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationGatewayWafDynamicManifestsDefaultClient) getCreateRequest(ctx context.Context, location string, options *ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationGatewayWafDynamicManifestsDefaultClient) getHandleResponse(resp *http.Response) (ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse, error) { + result := ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayWafDynamicManifestResult); err != nil { + return ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationsecuritygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationsecuritygroups_client.go new file mode 100644 index 000000000..124345371 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/applicationsecuritygroups_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ApplicationSecurityGroupsClient contains the methods for the ApplicationSecurityGroups group. +// Don't use this type directly, use NewApplicationSecurityGroupsClient() instead. +type ApplicationSecurityGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationSecurityGroupsClient creates a new instance of ApplicationSecurityGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationSecurityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationSecurityGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationSecurityGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationSecurityGroupName - The name of the application security group. +// parameters - Parameters supplied to the create or update ApplicationSecurityGroup operation. +// options - ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationSecurityGroupsClient.BeginCreateOrUpdate +// method. +func (client *ApplicationSecurityGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, options *ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ApplicationSecurityGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, applicationSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationSecurityGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationSecurityGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationSecurityGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, options *ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ApplicationSecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, options *ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationSecurityGroupName == "" { + return nil, errors.New("parameter applicationSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationSecurityGroupName}", url.PathEscape(applicationSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationSecurityGroupName - The name of the application security group. +// options - ApplicationSecurityGroupsClientBeginDeleteOptions contains the optional parameters for the ApplicationSecurityGroupsClient.BeginDelete +// method. +func (client *ApplicationSecurityGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientBeginDeleteOptions) (*runtime.Poller[ApplicationSecurityGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, applicationSecurityGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ApplicationSecurityGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ApplicationSecurityGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ApplicationSecurityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationSecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationSecurityGroupName == "" { + return nil, errors.New("parameter applicationSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationSecurityGroupName}", url.PathEscape(applicationSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified application security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationSecurityGroupName - The name of the application security group. +// options - ApplicationSecurityGroupsClientGetOptions contains the optional parameters for the ApplicationSecurityGroupsClient.Get +// method. +func (client *ApplicationSecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientGetOptions) (ApplicationSecurityGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, options) + if err != nil { + return ApplicationSecurityGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationSecurityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationSecurityGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationSecurityGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, options *ApplicationSecurityGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationSecurityGroupName == "" { + return nil, errors.New("parameter applicationSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationSecurityGroupName}", url.PathEscape(applicationSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationSecurityGroupsClient) getHandleResponse(resp *http.Response) (ApplicationSecurityGroupsClientGetResponse, error) { + result := ApplicationSecurityGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroup); err != nil { + return ApplicationSecurityGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the application security groups in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ApplicationSecurityGroupsClientListOptions contains the optional parameters for the ApplicationSecurityGroupsClient.List +// method. +func (client *ApplicationSecurityGroupsClient) NewListPager(resourceGroupName string, options *ApplicationSecurityGroupsClientListOptions) *runtime.Pager[ApplicationSecurityGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationSecurityGroupsClientListResponse]{ + More: func(page ApplicationSecurityGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationSecurityGroupsClientListResponse) (ApplicationSecurityGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationSecurityGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationSecurityGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationSecurityGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ApplicationSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ApplicationSecurityGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ApplicationSecurityGroupsClient) listHandleResponse(resp *http.Response) (ApplicationSecurityGroupsClientListResponse, error) { + result := ApplicationSecurityGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroupListResult); err != nil { + return ApplicationSecurityGroupsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all application security groups in a subscription. +// Generated from API version 2022-05-01 +// options - ApplicationSecurityGroupsClientListAllOptions contains the optional parameters for the ApplicationSecurityGroupsClient.ListAll +// method. +func (client *ApplicationSecurityGroupsClient) NewListAllPager(options *ApplicationSecurityGroupsClientListAllOptions) *runtime.Pager[ApplicationSecurityGroupsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationSecurityGroupsClientListAllResponse]{ + More: func(page ApplicationSecurityGroupsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationSecurityGroupsClientListAllResponse) (ApplicationSecurityGroupsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationSecurityGroupsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationSecurityGroupsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationSecurityGroupsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *ApplicationSecurityGroupsClient) listAllCreateRequest(ctx context.Context, options *ApplicationSecurityGroupsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *ApplicationSecurityGroupsClient) listAllHandleResponse(resp *http.Response) (ApplicationSecurityGroupsClientListAllResponse, error) { + result := ApplicationSecurityGroupsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroupListResult); err != nil { + return ApplicationSecurityGroupsClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates an application security group's tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// applicationSecurityGroupName - The name of the application security group. +// parameters - Parameters supplied to update application security group tags. +// options - ApplicationSecurityGroupsClientUpdateTagsOptions contains the optional parameters for the ApplicationSecurityGroupsClient.UpdateTags +// method. +func (client *ApplicationSecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters TagsObject, options *ApplicationSecurityGroupsClientUpdateTagsOptions) (ApplicationSecurityGroupsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, applicationSecurityGroupName, parameters, options) + if err != nil { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ApplicationSecurityGroupsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters TagsObject, options *ApplicationSecurityGroupsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if applicationSecurityGroupName == "" { + return nil, errors.New("parameter applicationSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationSecurityGroupName}", url.PathEscape(applicationSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ApplicationSecurityGroupsClient) updateTagsHandleResponse(resp *http.Response) (ApplicationSecurityGroupsClientUpdateTagsResponse, error) { + result := ApplicationSecurityGroupsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroup); err != nil { + return ApplicationSecurityGroupsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/autorest.md new file mode 100644 index 000000000..8723daf68 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/ddca448bd879175a928b990e0f25ca3a0e6c1c33/specification/network/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/ddca448bd879175a928b990e0f25ca3a0e6c1c33/specification/network/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 2.0.1 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availabledelegations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availabledelegations_client.go new file mode 100644 index 000000000..fc41b0157 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availabledelegations_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableDelegationsClient contains the methods for the AvailableDelegations group. +// Don't use this type directly, use NewAvailableDelegationsClient() instead. +type AvailableDelegationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailableDelegationsClient creates a new instance of AvailableDelegationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailableDelegationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableDelegationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailableDelegationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets all of the available subnet delegations for this subscription in this region. +// Generated from API version 2022-05-01 +// location - The location of the subnet. +// options - AvailableDelegationsClientListOptions contains the optional parameters for the AvailableDelegationsClient.List +// method. +func (client *AvailableDelegationsClient) NewListPager(location string, options *AvailableDelegationsClientListOptions) *runtime.Pager[AvailableDelegationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableDelegationsClientListResponse]{ + More: func(page AvailableDelegationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableDelegationsClientListResponse) (AvailableDelegationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableDelegationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableDelegationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableDelegationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableDelegationsClient) listCreateRequest(ctx context.Context, location string, options *AvailableDelegationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableDelegationsClient) listHandleResponse(resp *http.Response) (AvailableDelegationsClientListResponse, error) { + result := AvailableDelegationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableDelegationsResult); err != nil { + return AvailableDelegationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableendpointservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableendpointservices_client.go new file mode 100644 index 000000000..c8a3bf6d6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableendpointservices_client.go @@ -0,0 +1,121 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableEndpointServicesClient contains the methods for the AvailableEndpointServices group. +// Don't use this type directly, use NewAvailableEndpointServicesClient() instead. +type AvailableEndpointServicesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailableEndpointServicesClient creates a new instance of AvailableEndpointServicesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailableEndpointServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableEndpointServicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailableEndpointServicesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List what values of endpoint services are available for use. +// Generated from API version 2022-05-01 +// location - The location to check available endpoint services. +// options - AvailableEndpointServicesClientListOptions contains the optional parameters for the AvailableEndpointServicesClient.List +// method. +func (client *AvailableEndpointServicesClient) NewListPager(location string, options *AvailableEndpointServicesClientListOptions) *runtime.Pager[AvailableEndpointServicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableEndpointServicesClientListResponse]{ + More: func(page AvailableEndpointServicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableEndpointServicesClientListResponse) (AvailableEndpointServicesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableEndpointServicesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableEndpointServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableEndpointServicesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableEndpointServicesClient) listCreateRequest(ctx context.Context, location string, options *AvailableEndpointServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableEndpointServicesClient) listHandleResponse(resp *http.Response) (AvailableEndpointServicesClientListResponse, error) { + result := AvailableEndpointServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EndpointServicesListResult); err != nil { + return AvailableEndpointServicesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableprivateendpointtypes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableprivateendpointtypes_client.go new file mode 100644 index 000000000..12d395c10 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableprivateendpointtypes_client.go @@ -0,0 +1,192 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailablePrivateEndpointTypesClient contains the methods for the AvailablePrivateEndpointTypes group. +// Don't use this type directly, use NewAvailablePrivateEndpointTypesClient() instead. +type AvailablePrivateEndpointTypesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailablePrivateEndpointTypesClient creates a new instance of AvailablePrivateEndpointTypesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailablePrivateEndpointTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailablePrivateEndpointTypesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailablePrivateEndpointTypesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this +// region. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// options - AvailablePrivateEndpointTypesClientListOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.List +// method. +func (client *AvailablePrivateEndpointTypesClient) NewListPager(location string, options *AvailablePrivateEndpointTypesClientListOptions) *runtime.Pager[AvailablePrivateEndpointTypesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailablePrivateEndpointTypesClientListResponse]{ + More: func(page AvailablePrivateEndpointTypesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailablePrivateEndpointTypesClientListResponse) (AvailablePrivateEndpointTypesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailablePrivateEndpointTypesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailablePrivateEndpointTypesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailablePrivateEndpointTypesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailablePrivateEndpointTypesClient) listCreateRequest(ctx context.Context, location string, options *AvailablePrivateEndpointTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailablePrivateEndpointTypesClient) listHandleResponse(resp *http.Response) (AvailablePrivateEndpointTypesClientListResponse, error) { + result := AvailablePrivateEndpointTypesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailablePrivateEndpointTypesResult); err != nil { + return AvailablePrivateEndpointTypesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Returns all of the resource types that can be linked to a Private Endpoint in this subscription +// in this region. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// resourceGroupName - The name of the resource group. +// options - AvailablePrivateEndpointTypesClientListByResourceGroupOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.ListByResourceGroup +// method. +func (client *AvailablePrivateEndpointTypesClient) NewListByResourceGroupPager(location string, resourceGroupName string, options *AvailablePrivateEndpointTypesClientListByResourceGroupOptions) *runtime.Pager[AvailablePrivateEndpointTypesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailablePrivateEndpointTypesClientListByResourceGroupResponse]{ + More: func(page AvailablePrivateEndpointTypesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailablePrivateEndpointTypesClientListByResourceGroupResponse) (AvailablePrivateEndpointTypesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, location, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailablePrivateEndpointTypesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailablePrivateEndpointTypesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailablePrivateEndpointTypesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AvailablePrivateEndpointTypesClient) listByResourceGroupCreateRequest(ctx context.Context, location string, resourceGroupName string, options *AvailablePrivateEndpointTypesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AvailablePrivateEndpointTypesClient) listByResourceGroupHandleResponse(resp *http.Response) (AvailablePrivateEndpointTypesClientListByResourceGroupResponse, error) { + result := AvailablePrivateEndpointTypesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailablePrivateEndpointTypesResult); err != nil { + return AvailablePrivateEndpointTypesClientListByResourceGroupResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableresourcegroupdelegations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableresourcegroupdelegations_client.go new file mode 100644 index 000000000..9ed1fb614 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableresourcegroupdelegations_client.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableResourceGroupDelegationsClient contains the methods for the AvailableResourceGroupDelegations group. +// Don't use this type directly, use NewAvailableResourceGroupDelegationsClient() instead. +type AvailableResourceGroupDelegationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailableResourceGroupDelegationsClient creates a new instance of AvailableResourceGroupDelegationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailableResourceGroupDelegationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableResourceGroupDelegationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailableResourceGroupDelegationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets all of the available subnet delegations for this resource group in this region. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// resourceGroupName - The name of the resource group. +// options - AvailableResourceGroupDelegationsClientListOptions contains the optional parameters for the AvailableResourceGroupDelegationsClient.List +// method. +func (client *AvailableResourceGroupDelegationsClient) NewListPager(location string, resourceGroupName string, options *AvailableResourceGroupDelegationsClientListOptions) *runtime.Pager[AvailableResourceGroupDelegationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableResourceGroupDelegationsClientListResponse]{ + More: func(page AvailableResourceGroupDelegationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableResourceGroupDelegationsClientListResponse) (AvailableResourceGroupDelegationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableResourceGroupDelegationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableResourceGroupDelegationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableResourceGroupDelegationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableResourceGroupDelegationsClient) listCreateRequest(ctx context.Context, location string, resourceGroupName string, options *AvailableResourceGroupDelegationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableResourceGroupDelegationsClient) listHandleResponse(resp *http.Response) (AvailableResourceGroupDelegationsClientListResponse, error) { + result := AvailableResourceGroupDelegationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableDelegationsResult); err != nil { + return AvailableResourceGroupDelegationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableservicealiases_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableservicealiases_client.go new file mode 100644 index 000000000..d86ad782f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/availableservicealiases_client.go @@ -0,0 +1,190 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableServiceAliasesClient contains the methods for the AvailableServiceAliases group. +// Don't use this type directly, use NewAvailableServiceAliasesClient() instead. +type AvailableServiceAliasesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAvailableServiceAliasesClient creates a new instance of AvailableServiceAliasesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAvailableServiceAliasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableServiceAliasesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AvailableServiceAliasesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets all available service aliases for this subscription in this region. +// Generated from API version 2022-05-01 +// location - The location. +// options - AvailableServiceAliasesClientListOptions contains the optional parameters for the AvailableServiceAliasesClient.List +// method. +func (client *AvailableServiceAliasesClient) NewListPager(location string, options *AvailableServiceAliasesClientListOptions) *runtime.Pager[AvailableServiceAliasesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableServiceAliasesClientListResponse]{ + More: func(page AvailableServiceAliasesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableServiceAliasesClientListResponse) (AvailableServiceAliasesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableServiceAliasesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableServiceAliasesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableServiceAliasesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableServiceAliasesClient) listCreateRequest(ctx context.Context, location string, options *AvailableServiceAliasesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableServiceAliasesClient) listHandleResponse(resp *http.Response) (AvailableServiceAliasesClientListResponse, error) { + result := AvailableServiceAliasesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableServiceAliasesResult); err != nil { + return AvailableServiceAliasesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all available service aliases for this resource group in this region. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// location - The location. +// options - AvailableServiceAliasesClientListByResourceGroupOptions contains the optional parameters for the AvailableServiceAliasesClient.ListByResourceGroup +// method. +func (client *AvailableServiceAliasesClient) NewListByResourceGroupPager(resourceGroupName string, location string, options *AvailableServiceAliasesClientListByResourceGroupOptions) *runtime.Pager[AvailableServiceAliasesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableServiceAliasesClientListByResourceGroupResponse]{ + More: func(page AvailableServiceAliasesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableServiceAliasesClientListByResourceGroupResponse) (AvailableServiceAliasesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableServiceAliasesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AvailableServiceAliasesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableServiceAliasesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AvailableServiceAliasesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, location string, options *AvailableServiceAliasesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AvailableServiceAliasesClient) listByResourceGroupHandleResponse(resp *http.Response) (AvailableServiceAliasesClientListByResourceGroupResponse, error) { + result := AvailableServiceAliasesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableServiceAliasesResult); err != nil { + return AvailableServiceAliasesClientListByResourceGroupResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewallfqdntags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewallfqdntags_client.go new file mode 100644 index 000000000..f75354b7b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewallfqdntags_client.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureFirewallFqdnTagsClient contains the methods for the AzureFirewallFqdnTags group. +// Don't use this type directly, use NewAzureFirewallFqdnTagsClient() instead. +type AzureFirewallFqdnTagsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAzureFirewallFqdnTagsClient creates a new instance of AzureFirewallFqdnTagsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAzureFirewallFqdnTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureFirewallFqdnTagsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AzureFirewallFqdnTagsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListAllPager - Gets all the Azure Firewall FQDN Tags in a subscription. +// Generated from API version 2022-05-01 +// options - AzureFirewallFqdnTagsClientListAllOptions contains the optional parameters for the AzureFirewallFqdnTagsClient.ListAll +// method. +func (client *AzureFirewallFqdnTagsClient) NewListAllPager(options *AzureFirewallFqdnTagsClientListAllOptions) *runtime.Pager[AzureFirewallFqdnTagsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureFirewallFqdnTagsClientListAllResponse]{ + More: func(page AzureFirewallFqdnTagsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureFirewallFqdnTagsClientListAllResponse) (AzureFirewallFqdnTagsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureFirewallFqdnTagsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureFirewallFqdnTagsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureFirewallFqdnTagsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *AzureFirewallFqdnTagsClient) listAllCreateRequest(ctx context.Context, options *AzureFirewallFqdnTagsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *AzureFirewallFqdnTagsClient) listAllHandleResponse(resp *http.Response) (AzureFirewallFqdnTagsClientListAllResponse, error) { + result := AzureFirewallFqdnTagsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallFqdnTagListResult); err != nil { + return AzureFirewallFqdnTagsClientListAllResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewalls_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewalls_client.go new file mode 100644 index 000000000..945e68563 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/azurefirewalls_client.go @@ -0,0 +1,496 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureFirewallsClient contains the methods for the AzureFirewalls group. +// Don't use this type directly, use NewAzureFirewallsClient() instead. +type AzureFirewallsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAzureFirewallsClient creates a new instance of AzureFirewallsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAzureFirewallsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureFirewallsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AzureFirewallsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// azureFirewallName - The name of the Azure Firewall. +// parameters - Parameters supplied to the create or update Azure Firewall operation. +// options - AzureFirewallsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureFirewallsClient.BeginCreateOrUpdate +// method. +func (client *AzureFirewallsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall, options *AzureFirewallsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureFirewallsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AzureFirewallsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AzureFirewallsClient) createOrUpdate(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall, options *AzureFirewallsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AzureFirewallsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall, options *AzureFirewallsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureFirewallName == "" { + return nil, errors.New("parameter azureFirewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureFirewallName}", url.PathEscape(azureFirewallName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// azureFirewallName - The name of the Azure Firewall. +// options - AzureFirewallsClientBeginDeleteOptions contains the optional parameters for the AzureFirewallsClient.BeginDelete +// method. +func (client *AzureFirewallsClient) BeginDelete(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginDeleteOptions) (*runtime.Poller[AzureFirewallsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AzureFirewallsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AzureFirewallsClient) deleteOperation(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureFirewallsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureFirewallName == "" { + return nil, errors.New("parameter azureFirewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureFirewallName}", url.PathEscape(azureFirewallName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Azure Firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// azureFirewallName - The name of the Azure Firewall. +// options - AzureFirewallsClientGetOptions contains the optional parameters for the AzureFirewallsClient.Get method. +func (client *AzureFirewallsClient) Get(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientGetOptions) (AzureFirewallsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return AzureFirewallsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureFirewallsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureFirewallsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AzureFirewallsClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureFirewallName == "" { + return nil, errors.New("parameter azureFirewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureFirewallName}", url.PathEscape(azureFirewallName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureFirewallsClient) getHandleResponse(resp *http.Response) (AzureFirewallsClientGetResponse, error) { + result := AzureFirewallsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewall); err != nil { + return AzureFirewallsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all Azure Firewalls in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - AzureFirewallsClientListOptions contains the optional parameters for the AzureFirewallsClient.List method. +func (client *AzureFirewallsClient) NewListPager(resourceGroupName string, options *AzureFirewallsClientListOptions) *runtime.Pager[AzureFirewallsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureFirewallsClientListResponse]{ + More: func(page AzureFirewallsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureFirewallsClientListResponse) (AzureFirewallsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureFirewallsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureFirewallsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureFirewallsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AzureFirewallsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AzureFirewallsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AzureFirewallsClient) listHandleResponse(resp *http.Response) (AzureFirewallsClientListResponse, error) { + result := AzureFirewallsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallListResult); err != nil { + return AzureFirewallsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the Azure Firewalls in a subscription. +// Generated from API version 2022-05-01 +// options - AzureFirewallsClientListAllOptions contains the optional parameters for the AzureFirewallsClient.ListAll method. +func (client *AzureFirewallsClient) NewListAllPager(options *AzureFirewallsClientListAllOptions) *runtime.Pager[AzureFirewallsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureFirewallsClientListAllResponse]{ + More: func(page AzureFirewallsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureFirewallsClientListAllResponse) (AzureFirewallsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureFirewallsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureFirewallsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureFirewallsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *AzureFirewallsClient) listAllCreateRequest(ctx context.Context, options *AzureFirewallsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *AzureFirewallsClient) listAllHandleResponse(resp *http.Response) (AzureFirewallsClientListAllResponse, error) { + result := AzureFirewallsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallListResult); err != nil { + return AzureFirewallsClientListAllResponse{}, err + } + return result, nil +} + +// BeginListLearnedPrefixes - Retrieves a list of all IP prefixes that azure firewall has learned to not SNAT. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// azureFirewallName - The name of the azure firewall. +// options - AzureFirewallsClientBeginListLearnedPrefixesOptions contains the optional parameters for the AzureFirewallsClient.BeginListLearnedPrefixes +// method. +func (client *AzureFirewallsClient) BeginListLearnedPrefixes(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginListLearnedPrefixesOptions) (*runtime.Poller[AzureFirewallsClientListLearnedPrefixesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listLearnedPrefixes(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AzureFirewallsClientListLearnedPrefixesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientListLearnedPrefixesResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListLearnedPrefixes - Retrieves a list of all IP prefixes that azure firewall has learned to not SNAT. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AzureFirewallsClient) listLearnedPrefixes(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginListLearnedPrefixesOptions) (*http.Response, error) { + req, err := client.listLearnedPrefixesCreateRequest(ctx, resourceGroupName, azureFirewallName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listLearnedPrefixesCreateRequest creates the ListLearnedPrefixes request. +func (client *AzureFirewallsClient) listLearnedPrefixesCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, options *AzureFirewallsClientBeginListLearnedPrefixesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}/learnedIPPrefixes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureFirewallName == "" { + return nil, errors.New("parameter azureFirewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureFirewallName}", url.PathEscape(azureFirewallName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdateTags - Updates tags of an Azure Firewall resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// azureFirewallName - The name of the Azure Firewall. +// parameters - Parameters supplied to update azure firewall tags. +// options - AzureFirewallsClientBeginUpdateTagsOptions contains the optional parameters for the AzureFirewallsClient.BeginUpdateTags +// method. +func (client *AzureFirewallsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject, options *AzureFirewallsClientBeginUpdateTagsOptions) (*runtime.Poller[AzureFirewallsClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AzureFirewallsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureFirewallsClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates tags of an Azure Firewall resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AzureFirewallsClient) updateTags(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject, options *AzureFirewallsClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, azureFirewallName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *AzureFirewallsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject, options *AzureFirewallsClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureFirewallName == "" { + return nil, errors.New("parameter azureFirewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureFirewallName}", url.PathEscape(azureFirewallName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bastionhosts_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bastionhosts_client.go new file mode 100644 index 000000000..dfad6bc22 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bastionhosts_client.go @@ -0,0 +1,432 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BastionHostsClient contains the methods for the BastionHosts group. +// Don't use this type directly, use NewBastionHostsClient() instead. +type BastionHostsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewBastionHostsClient creates a new instance of BastionHostsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewBastionHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BastionHostsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BastionHostsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// parameters - Parameters supplied to the create or update Bastion Host operation. +// options - BastionHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the BastionHostsClient.BeginCreateOrUpdate +// method. +func (client *BastionHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost, options *BastionHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BastionHostsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[BastionHostsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *BastionHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost, options *BastionHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BastionHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost, options *BastionHostsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// options - BastionHostsClientBeginDeleteOptions contains the optional parameters for the BastionHostsClient.BeginDelete +// method. +func (client *BastionHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientBeginDeleteOptions) (*runtime.Poller[BastionHostsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[BastionHostsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *BastionHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BastionHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Bastion Host. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// options - BastionHostsClientGetOptions contains the optional parameters for the BastionHostsClient.Get method. +func (client *BastionHostsClient) Get(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientGetOptions) (BastionHostsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return BastionHostsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BastionHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BastionHostsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BastionHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, options *BastionHostsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BastionHostsClient) getHandleResponse(resp *http.Response) (BastionHostsClientGetResponse, error) { + result := BastionHostsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionHost); err != nil { + return BastionHostsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all Bastion Hosts in a subscription. +// Generated from API version 2022-05-01 +// options - BastionHostsClientListOptions contains the optional parameters for the BastionHostsClient.List method. +func (client *BastionHostsClient) NewListPager(options *BastionHostsClientListOptions) *runtime.Pager[BastionHostsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BastionHostsClientListResponse]{ + More: func(page BastionHostsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BastionHostsClientListResponse) (BastionHostsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BastionHostsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BastionHostsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BastionHostsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BastionHostsClient) listCreateRequest(ctx context.Context, options *BastionHostsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BastionHostsClient) listHandleResponse(resp *http.Response) (BastionHostsClientListResponse, error) { + result := BastionHostsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionHostListResult); err != nil { + return BastionHostsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all Bastion Hosts in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - BastionHostsClientListByResourceGroupOptions contains the optional parameters for the BastionHostsClient.ListByResourceGroup +// method. +func (client *BastionHostsClient) NewListByResourceGroupPager(resourceGroupName string, options *BastionHostsClientListByResourceGroupOptions) *runtime.Pager[BastionHostsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[BastionHostsClientListByResourceGroupResponse]{ + More: func(page BastionHostsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BastionHostsClientListByResourceGroupResponse) (BastionHostsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BastionHostsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BastionHostsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BastionHostsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *BastionHostsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *BastionHostsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *BastionHostsClient) listByResourceGroupHandleResponse(resp *http.Response) (BastionHostsClientListByResourceGroupResponse, error) { + result := BastionHostsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionHostListResult); err != nil { + return BastionHostsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdateTags - Updates Tags for BastionHost resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// parameters - Parameters supplied to update BastionHost tags. +// options - BastionHostsClientBeginUpdateTagsOptions contains the optional parameters for the BastionHostsClient.BeginUpdateTags +// method. +func (client *BastionHostsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject, options *BastionHostsClientBeginUpdateTagsOptions) (*runtime.Poller[BastionHostsClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[BastionHostsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[BastionHostsClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates Tags for BastionHost resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *BastionHostsClient) updateTags(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject, options *BastionHostsClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, bastionHostName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *BastionHostsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject, options *BastionHostsClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bgpservicecommunities_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bgpservicecommunities_client.go new file mode 100644 index 000000000..48568efe7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/bgpservicecommunities_client.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BgpServiceCommunitiesClient contains the methods for the BgpServiceCommunities group. +// Don't use this type directly, use NewBgpServiceCommunitiesClient() instead. +type BgpServiceCommunitiesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewBgpServiceCommunitiesClient creates a new instance of BgpServiceCommunitiesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewBgpServiceCommunitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BgpServiceCommunitiesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BgpServiceCommunitiesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets all the available bgp service communities. +// Generated from API version 2022-05-01 +// options - BgpServiceCommunitiesClientListOptions contains the optional parameters for the BgpServiceCommunitiesClient.List +// method. +func (client *BgpServiceCommunitiesClient) NewListPager(options *BgpServiceCommunitiesClientListOptions) *runtime.Pager[BgpServiceCommunitiesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BgpServiceCommunitiesClientListResponse]{ + More: func(page BgpServiceCommunitiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BgpServiceCommunitiesClientListResponse) (BgpServiceCommunitiesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BgpServiceCommunitiesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BgpServiceCommunitiesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BgpServiceCommunitiesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BgpServiceCommunitiesClient) listCreateRequest(ctx context.Context, options *BgpServiceCommunitiesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BgpServiceCommunitiesClient) listHandleResponse(resp *http.Response) (BgpServiceCommunitiesClientListResponse, error) { + result := BgpServiceCommunitiesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BgpServiceCommunityListResult); err != nil { + return BgpServiceCommunitiesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/build.go new file mode 100644 index 000000000..a22250100 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/network/armnetwork + +package armnetwork diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ci.yml new file mode 100644 index 000000000..d1d36edca --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/network/armnetwork/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/network/armnetwork/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/network/armnetwork' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/configurationpolicygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/configurationpolicygroups_client.go new file mode 100644 index 000000000..73b072277 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/configurationpolicygroups_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConfigurationPolicyGroupsClient contains the methods for the ConfigurationPolicyGroups group. +// Don't use this type directly, use NewConfigurationPolicyGroupsClient() instead. +type ConfigurationPolicyGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConfigurationPolicyGroupsClient creates a new instance of ConfigurationPolicyGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConfigurationPolicyGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationPolicyGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConfigurationPolicyGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the ConfigurationPolicyGroup. +// vpnServerConfigurationName - The name of the VpnServerConfiguration. +// configurationPolicyGroupName - The name of the ConfigurationPolicyGroup. +// vpnServerConfigurationPolicyGroupParameters - Parameters supplied to create or update a VpnServerConfiguration PolicyGroup. +// options - ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.BeginCreateOrUpdate +// method. +func (client *ConfigurationPolicyGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VPNServerConfigurationPolicyGroup, options *ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationPolicyGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, vpnServerConfigurationPolicyGroupParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationPolicyGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConfigurationPolicyGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConfigurationPolicyGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VPNServerConfigurationPolicyGroup, options *ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, vpnServerConfigurationPolicyGroupParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConfigurationPolicyGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VPNServerConfigurationPolicyGroup, options *ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + if configurationPolicyGroupName == "" { + return nil, errors.New("parameter configurationPolicyGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationPolicyGroupName}", url.PathEscape(configurationPolicyGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnServerConfigurationPolicyGroupParameters) +} + +// BeginDelete - Deletes a ConfigurationPolicyGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the ConfigurationPolicyGroup. +// vpnServerConfigurationName - The name of the VpnServerConfiguration. +// configurationPolicyGroupName - The name of the ConfigurationPolicyGroup. +// options - ConfigurationPolicyGroupsClientBeginDeleteOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.BeginDelete +// method. +func (client *ConfigurationPolicyGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientBeginDeleteOptions) (*runtime.Poller[ConfigurationPolicyGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationPolicyGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConfigurationPolicyGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a ConfigurationPolicyGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConfigurationPolicyGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConfigurationPolicyGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + if configurationPolicyGroupName == "" { + return nil, errors.New("parameter configurationPolicyGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationPolicyGroupName}", url.PathEscape(configurationPolicyGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a ConfigurationPolicyGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration. +// configurationPolicyGroupName - The name of the ConfigurationPolicyGroup being retrieved. +// options - ConfigurationPolicyGroupsClientGetOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.Get +// method. +func (client *ConfigurationPolicyGroupsClient) Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientGetOptions) (ConfigurationPolicyGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, options) + if err != nil { + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationPolicyGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConfigurationPolicyGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, options *ConfigurationPolicyGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + if configurationPolicyGroupName == "" { + return nil, errors.New("parameter configurationPolicyGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationPolicyGroupName}", url.PathEscape(configurationPolicyGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConfigurationPolicyGroupsClient) getHandleResponse(resp *http.Response) (ConfigurationPolicyGroupsClientGetResponse, error) { + result := ConfigurationPolicyGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfigurationPolicyGroup); err != nil { + return ConfigurationPolicyGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByVPNServerConfigurationPager - Lists all the configurationPolicyGroups in a resource group for a vpnServerConfiguration. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration. +// options - ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.ListByVPNServerConfiguration +// method. +func (client *ConfigurationPolicyGroupsClient) NewListByVPNServerConfigurationPager(resourceGroupName string, vpnServerConfigurationName string, options *ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions) *runtime.Pager[ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse] { + return runtime.NewPager(runtime.PagingHandler[ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse]{ + More: func(page ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse) (ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVPNServerConfigurationCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse{}, runtime.NewResponseError(resp) + } + return client.listByVPNServerConfigurationHandleResponse(resp) + }, + }) +} + +// listByVPNServerConfigurationCreateRequest creates the ListByVPNServerConfiguration request. +func (client *ConfigurationPolicyGroupsClient) listByVPNServerConfigurationCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVPNServerConfigurationHandleResponse handles the ListByVPNServerConfiguration response. +func (client *ConfigurationPolicyGroupsClient) listByVPNServerConfigurationHandleResponse(resp *http.Response) (ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse, error) { + result := ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationPolicyGroupsResult); err != nil { + return ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectionmonitors_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectionmonitors_client.go new file mode 100644 index 000000000..1fff9748d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectionmonitors_client.go @@ -0,0 +1,597 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectionMonitorsClient contains the methods for the ConnectionMonitors group. +// Don't use this type directly, use NewConnectionMonitorsClient() instead. +type ConnectionMonitorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectionMonitorsClient creates a new instance of ConnectionMonitorsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectionMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectionMonitorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectionMonitorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name of the connection monitor. +// parameters - Parameters that define the operation to create a connection monitor. +// options - ConnectionMonitorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectionMonitorsClient.BeginCreateOrUpdate +// method. +func (client *ConnectionMonitorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, options *ConnectionMonitorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConnectionMonitorsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectionMonitorsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectionMonitorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, options *ConnectionMonitorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectionMonitorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, options *ConnectionMonitorsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Migrate != nil { + reqQP.Set("migrate", *options.Migrate) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name of the connection monitor. +// options - ConnectionMonitorsClientBeginDeleteOptions contains the optional parameters for the ConnectionMonitorsClient.BeginDelete +// method. +func (client *ConnectionMonitorsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginDeleteOptions) (*runtime.Poller[ConnectionMonitorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectionMonitorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectionMonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectionMonitorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a connection monitor by name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name of the connection monitor. +// options - ConnectionMonitorsClientGetOptions contains the optional parameters for the ConnectionMonitorsClient.Get method. +func (client *ConnectionMonitorsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientGetOptions) (ConnectionMonitorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return ConnectionMonitorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectionMonitorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectionMonitorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectionMonitorsClient) getHandleResponse(resp *http.Response) (ConnectionMonitorsClientGetResponse, error) { + result := ConnectionMonitorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorResult); err != nil { + return ConnectionMonitorsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all connection monitors for the specified Network Watcher. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// options - ConnectionMonitorsClientListOptions contains the optional parameters for the ConnectionMonitorsClient.List method. +func (client *ConnectionMonitorsClient) NewListPager(resourceGroupName string, networkWatcherName string, options *ConnectionMonitorsClientListOptions) *runtime.Pager[ConnectionMonitorsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectionMonitorsClientListResponse]{ + More: func(page ConnectionMonitorsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ConnectionMonitorsClientListResponse) (ConnectionMonitorsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return ConnectionMonitorsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectionMonitorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectionMonitorsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, options *ConnectionMonitorsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectionMonitorsClient) listHandleResponse(resp *http.Response) (ConnectionMonitorsClientListResponse, error) { + result := ConnectionMonitorsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorListResult); err != nil { + return ConnectionMonitorsClientListResponse{}, err + } + return result, nil +} + +// BeginQuery - Query a snapshot of the most recent connection states. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name given to the connection monitor. +// options - ConnectionMonitorsClientBeginQueryOptions contains the optional parameters for the ConnectionMonitorsClient.BeginQuery +// method. +func (client *ConnectionMonitorsClient) BeginQuery(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginQueryOptions) (*runtime.Poller[ConnectionMonitorsClientQueryResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.query(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectionMonitorsClientQueryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientQueryResponse](options.ResumeToken, client.pl, nil) + } +} + +// Query - Query a snapshot of the most recent connection states. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectionMonitorsClient) query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginQueryOptions) (*http.Response, error) { + req, err := client.queryCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// queryCreateRequest creates the Query request. +func (client *ConnectionMonitorsClient) queryCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginQueryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - Starts the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name of the connection monitor. +// options - ConnectionMonitorsClientBeginStartOptions contains the optional parameters for the ConnectionMonitorsClient.BeginStart +// method. +func (client *ConnectionMonitorsClient) BeginStart(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStartOptions) (*runtime.Poller[ConnectionMonitorsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectionMonitorsClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectionMonitorsClient) start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *ConnectionMonitorsClient) startCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - Stops the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// connectionMonitorName - The name of the connection monitor. +// options - ConnectionMonitorsClientBeginStopOptions contains the optional parameters for the ConnectionMonitorsClient.BeginStop +// method. +func (client *ConnectionMonitorsClient) BeginStop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStopOptions) (*runtime.Poller[ConnectionMonitorsClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectionMonitorsClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectionMonitorsClientStopResponse](options.ResumeToken, client.pl, nil) + } +} + +// Stop - Stops the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectionMonitorsClient) stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ConnectionMonitorsClient) stopCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, options *ConnectionMonitorsClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateTags - Update tags of the specified connection monitor. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// connectionMonitorName - The name of the connection monitor. +// parameters - Parameters supplied to update connection monitor tags. +// options - ConnectionMonitorsClientUpdateTagsOptions contains the optional parameters for the ConnectionMonitorsClient.UpdateTags +// method. +func (client *ConnectionMonitorsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters TagsObject, options *ConnectionMonitorsClientUpdateTagsOptions) (ConnectionMonitorsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) + if err != nil { + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectionMonitorsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ConnectionMonitorsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters TagsObject, options *ConnectionMonitorsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if connectionMonitorName == "" { + return nil, errors.New("parameter connectionMonitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorName}", url.PathEscape(connectionMonitorName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ConnectionMonitorsClient) updateTagsHandleResponse(resp *http.Response) (ConnectionMonitorsClientUpdateTagsResponse, error) { + result := ConnectionMonitorsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorResult); err != nil { + return ConnectionMonitorsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectivityconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectivityconfigurations_client.go new file mode 100644 index 000000000..b7eaec675 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/connectivityconfigurations_client.go @@ -0,0 +1,334 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ConnectivityConfigurationsClient contains the methods for the ConnectivityConfigurations group. +// Don't use this type directly, use NewConnectivityConfigurationsClient() instead. +type ConnectivityConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectivityConfigurationsClient creates a new instance of ConnectivityConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectivityConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectivityConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectivityConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates/Updates a new network manager connectivity configuration +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager connectivity configuration. +// connectivityConfiguration - Parameters supplied to create/update a network manager connectivity configuration +// options - ConnectivityConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the ConnectivityConfigurationsClient.CreateOrUpdate +// method. +func (client *ConnectivityConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, connectivityConfiguration ConnectivityConfiguration, options *ConnectivityConfigurationsClientCreateOrUpdateOptions) (ConnectivityConfigurationsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, connectivityConfiguration, options) + if err != nil { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectivityConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, connectivityConfiguration ConnectivityConfiguration, options *ConnectivityConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, connectivityConfiguration) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectivityConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectivityConfigurationsClientCreateOrUpdateResponse, error) { + result := ConnectivityConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectivityConfiguration); err != nil { + return ConnectivityConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes a network manager connectivity configuration, specified by the resource group, network manager name, +// and connectivity configuration name +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager connectivity configuration. +// options - ConnectivityConfigurationsClientBeginDeleteOptions contains the optional parameters for the ConnectivityConfigurationsClient.BeginDelete +// method. +func (client *ConnectivityConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientBeginDeleteOptions) (*runtime.Poller[ConnectivityConfigurationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConnectivityConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ConnectivityConfigurationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a network manager connectivity configuration, specified by the resource group, network manager name, and +// connectivity configuration name +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ConnectivityConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectivityConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a Network Connectivity Configuration, specified by the resource group, network manager name, and connectivity +// Configuration name +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager connectivity configuration. +// options - ConnectivityConfigurationsClientGetOptions contains the optional parameters for the ConnectivityConfigurationsClient.Get +// method. +func (client *ConnectivityConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientGetOptions) (ConnectivityConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return ConnectivityConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectivityConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectivityConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectivityConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *ConnectivityConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectivityConfigurationsClient) getHandleResponse(resp *http.Response) (ConnectivityConfigurationsClientGetResponse, error) { + result := ConnectivityConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectivityConfiguration); err != nil { + return ConnectivityConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the network manager connectivity configuration in a specified network manager. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - ConnectivityConfigurationsClientListOptions contains the optional parameters for the ConnectivityConfigurationsClient.List +// method. +func (client *ConnectivityConfigurationsClient) NewListPager(resourceGroupName string, networkManagerName string, options *ConnectivityConfigurationsClientListOptions) *runtime.Pager[ConnectivityConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectivityConfigurationsClientListResponse]{ + More: func(page ConnectivityConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectivityConfigurationsClientListResponse) (ConnectivityConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectivityConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectivityConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectivityConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectivityConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ConnectivityConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectivityConfigurationsClient) listHandleResponse(resp *http.Response) (ConnectivityConfigurationsClientListResponse, error) { + result := ConnectivityConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectivityConfigurationListResult); err != nil { + return ConnectivityConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/constants.go new file mode 100644 index 000000000..dfae5302d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/constants.go @@ -0,0 +1,3952 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +const ( + moduleName = "armnetwork" + moduleVersion = "v2.0.1" +) + +// Access - Access to be allowed or denied. +type Access string + +const ( + AccessAllow Access = "Allow" + AccessDeny Access = "Deny" +) + +// PossibleAccessValues returns the possible values for the Access const type. +func PossibleAccessValues() []Access { + return []Access{ + AccessAllow, + AccessDeny, + } +} + +// ActionType - Defines the action to take on rule match. +type ActionType string + +const ( + ActionTypeAllow ActionType = "Allow" + ActionTypeAnomalyScoring ActionType = "AnomalyScoring" + ActionTypeBlock ActionType = "Block" + ActionTypeLog ActionType = "Log" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeAllow, + ActionTypeAnomalyScoring, + ActionTypeBlock, + ActionTypeLog, + } +} + +// AddressPrefixType - Address prefix type. +type AddressPrefixType string + +const ( + AddressPrefixTypeIPPrefix AddressPrefixType = "IPPrefix" + AddressPrefixTypeServiceTag AddressPrefixType = "ServiceTag" +) + +// PossibleAddressPrefixTypeValues returns the possible values for the AddressPrefixType const type. +func PossibleAddressPrefixTypeValues() []AddressPrefixType { + return []AddressPrefixType{ + AddressPrefixTypeIPPrefix, + AddressPrefixTypeServiceTag, + } +} + +// AdminRuleKind - Whether the rule is custom or default. +type AdminRuleKind string + +const ( + AdminRuleKindCustom AdminRuleKind = "Custom" + AdminRuleKindDefault AdminRuleKind = "Default" +) + +// PossibleAdminRuleKindValues returns the possible values for the AdminRuleKind const type. +func PossibleAdminRuleKindValues() []AdminRuleKind { + return []AdminRuleKind{ + AdminRuleKindCustom, + AdminRuleKindDefault, + } +} + +// ApplicationGatewayBackendHealthServerHealth - Health of backend server. +type ApplicationGatewayBackendHealthServerHealth string + +const ( + ApplicationGatewayBackendHealthServerHealthDown ApplicationGatewayBackendHealthServerHealth = "Down" + ApplicationGatewayBackendHealthServerHealthDraining ApplicationGatewayBackendHealthServerHealth = "Draining" + ApplicationGatewayBackendHealthServerHealthPartial ApplicationGatewayBackendHealthServerHealth = "Partial" + ApplicationGatewayBackendHealthServerHealthUnknown ApplicationGatewayBackendHealthServerHealth = "Unknown" + ApplicationGatewayBackendHealthServerHealthUp ApplicationGatewayBackendHealthServerHealth = "Up" +) + +// PossibleApplicationGatewayBackendHealthServerHealthValues returns the possible values for the ApplicationGatewayBackendHealthServerHealth const type. +func PossibleApplicationGatewayBackendHealthServerHealthValues() []ApplicationGatewayBackendHealthServerHealth { + return []ApplicationGatewayBackendHealthServerHealth{ + ApplicationGatewayBackendHealthServerHealthDown, + ApplicationGatewayBackendHealthServerHealthDraining, + ApplicationGatewayBackendHealthServerHealthPartial, + ApplicationGatewayBackendHealthServerHealthUnknown, + ApplicationGatewayBackendHealthServerHealthUp, + } +} + +// ApplicationGatewayClientRevocationOptions - Verify client certificate revocation status. +type ApplicationGatewayClientRevocationOptions string + +const ( + ApplicationGatewayClientRevocationOptionsNone ApplicationGatewayClientRevocationOptions = "None" + ApplicationGatewayClientRevocationOptionsOCSP ApplicationGatewayClientRevocationOptions = "OCSP" +) + +// PossibleApplicationGatewayClientRevocationOptionsValues returns the possible values for the ApplicationGatewayClientRevocationOptions const type. +func PossibleApplicationGatewayClientRevocationOptionsValues() []ApplicationGatewayClientRevocationOptions { + return []ApplicationGatewayClientRevocationOptions{ + ApplicationGatewayClientRevocationOptionsNone, + ApplicationGatewayClientRevocationOptionsOCSP, + } +} + +// ApplicationGatewayCookieBasedAffinity - Cookie based affinity. +type ApplicationGatewayCookieBasedAffinity string + +const ( + ApplicationGatewayCookieBasedAffinityDisabled ApplicationGatewayCookieBasedAffinity = "Disabled" + ApplicationGatewayCookieBasedAffinityEnabled ApplicationGatewayCookieBasedAffinity = "Enabled" +) + +// PossibleApplicationGatewayCookieBasedAffinityValues returns the possible values for the ApplicationGatewayCookieBasedAffinity const type. +func PossibleApplicationGatewayCookieBasedAffinityValues() []ApplicationGatewayCookieBasedAffinity { + return []ApplicationGatewayCookieBasedAffinity{ + ApplicationGatewayCookieBasedAffinityDisabled, + ApplicationGatewayCookieBasedAffinityEnabled, + } +} + +// ApplicationGatewayCustomErrorStatusCode - Status code of the application gateway customer error. +type ApplicationGatewayCustomErrorStatusCode string + +const ( + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ApplicationGatewayCustomErrorStatusCode = "HttpStatus403" + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ApplicationGatewayCustomErrorStatusCode = "HttpStatus502" +) + +// PossibleApplicationGatewayCustomErrorStatusCodeValues returns the possible values for the ApplicationGatewayCustomErrorStatusCode const type. +func PossibleApplicationGatewayCustomErrorStatusCodeValues() []ApplicationGatewayCustomErrorStatusCode { + return []ApplicationGatewayCustomErrorStatusCode{ + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403, + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502, + } +} + +// ApplicationGatewayFirewallMode - Web application firewall mode. +type ApplicationGatewayFirewallMode string + +const ( + ApplicationGatewayFirewallModeDetection ApplicationGatewayFirewallMode = "Detection" + ApplicationGatewayFirewallModePrevention ApplicationGatewayFirewallMode = "Prevention" +) + +// PossibleApplicationGatewayFirewallModeValues returns the possible values for the ApplicationGatewayFirewallMode const type. +func PossibleApplicationGatewayFirewallModeValues() []ApplicationGatewayFirewallMode { + return []ApplicationGatewayFirewallMode{ + ApplicationGatewayFirewallModeDetection, + ApplicationGatewayFirewallModePrevention, + } +} + +// ApplicationGatewayLoadDistributionAlgorithm - Load Distribution Algorithm enums. +type ApplicationGatewayLoadDistributionAlgorithm string + +const ( + ApplicationGatewayLoadDistributionAlgorithmIPHash ApplicationGatewayLoadDistributionAlgorithm = "IpHash" + ApplicationGatewayLoadDistributionAlgorithmLeastConnections ApplicationGatewayLoadDistributionAlgorithm = "LeastConnections" + ApplicationGatewayLoadDistributionAlgorithmRoundRobin ApplicationGatewayLoadDistributionAlgorithm = "RoundRobin" +) + +// PossibleApplicationGatewayLoadDistributionAlgorithmValues returns the possible values for the ApplicationGatewayLoadDistributionAlgorithm const type. +func PossibleApplicationGatewayLoadDistributionAlgorithmValues() []ApplicationGatewayLoadDistributionAlgorithm { + return []ApplicationGatewayLoadDistributionAlgorithm{ + ApplicationGatewayLoadDistributionAlgorithmIPHash, + ApplicationGatewayLoadDistributionAlgorithmLeastConnections, + ApplicationGatewayLoadDistributionAlgorithmRoundRobin, + } +} + +// ApplicationGatewayOperationalState - Operational state of the application gateway resource. +type ApplicationGatewayOperationalState string + +const ( + ApplicationGatewayOperationalStateRunning ApplicationGatewayOperationalState = "Running" + ApplicationGatewayOperationalStateStarting ApplicationGatewayOperationalState = "Starting" + ApplicationGatewayOperationalStateStopped ApplicationGatewayOperationalState = "Stopped" + ApplicationGatewayOperationalStateStopping ApplicationGatewayOperationalState = "Stopping" +) + +// PossibleApplicationGatewayOperationalStateValues returns the possible values for the ApplicationGatewayOperationalState const type. +func PossibleApplicationGatewayOperationalStateValues() []ApplicationGatewayOperationalState { + return []ApplicationGatewayOperationalState{ + ApplicationGatewayOperationalStateRunning, + ApplicationGatewayOperationalStateStarting, + ApplicationGatewayOperationalStateStopped, + ApplicationGatewayOperationalStateStopping, + } +} + +// ApplicationGatewayProtocol - Application Gateway protocol. +type ApplicationGatewayProtocol string + +const ( + ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = "Http" + ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = "Https" + ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = "Tcp" + ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = "Tls" +) + +// PossibleApplicationGatewayProtocolValues returns the possible values for the ApplicationGatewayProtocol const type. +func PossibleApplicationGatewayProtocolValues() []ApplicationGatewayProtocol { + return []ApplicationGatewayProtocol{ + ApplicationGatewayProtocolHTTP, + ApplicationGatewayProtocolHTTPS, + ApplicationGatewayProtocolTCP, + ApplicationGatewayProtocolTLS, + } +} + +// ApplicationGatewayRedirectType - Redirect type enum. +type ApplicationGatewayRedirectType string + +const ( + ApplicationGatewayRedirectTypeFound ApplicationGatewayRedirectType = "Found" + ApplicationGatewayRedirectTypePermanent ApplicationGatewayRedirectType = "Permanent" + ApplicationGatewayRedirectTypeSeeOther ApplicationGatewayRedirectType = "SeeOther" + ApplicationGatewayRedirectTypeTemporary ApplicationGatewayRedirectType = "Temporary" +) + +// PossibleApplicationGatewayRedirectTypeValues returns the possible values for the ApplicationGatewayRedirectType const type. +func PossibleApplicationGatewayRedirectTypeValues() []ApplicationGatewayRedirectType { + return []ApplicationGatewayRedirectType{ + ApplicationGatewayRedirectTypeFound, + ApplicationGatewayRedirectTypePermanent, + ApplicationGatewayRedirectTypeSeeOther, + ApplicationGatewayRedirectTypeTemporary, + } +} + +// ApplicationGatewayRequestRoutingRuleType - Rule type. +type ApplicationGatewayRequestRoutingRuleType string + +const ( + ApplicationGatewayRequestRoutingRuleTypeBasic ApplicationGatewayRequestRoutingRuleType = "Basic" + ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" +) + +// PossibleApplicationGatewayRequestRoutingRuleTypeValues returns the possible values for the ApplicationGatewayRequestRoutingRuleType const type. +func PossibleApplicationGatewayRequestRoutingRuleTypeValues() []ApplicationGatewayRequestRoutingRuleType { + return []ApplicationGatewayRequestRoutingRuleType{ + ApplicationGatewayRequestRoutingRuleTypeBasic, + ApplicationGatewayRequestRoutingRuleTypePathBasedRouting, + } +} + +// ApplicationGatewayRuleSetStatusOptions - The rule set status +type ApplicationGatewayRuleSetStatusOptions string + +const ( + ApplicationGatewayRuleSetStatusOptionsDeprecated ApplicationGatewayRuleSetStatusOptions = "Deprecated" + ApplicationGatewayRuleSetStatusOptionsGA ApplicationGatewayRuleSetStatusOptions = "GA" + ApplicationGatewayRuleSetStatusOptionsPreview ApplicationGatewayRuleSetStatusOptions = "Preview" + ApplicationGatewayRuleSetStatusOptionsSupported ApplicationGatewayRuleSetStatusOptions = "Supported" +) + +// PossibleApplicationGatewayRuleSetStatusOptionsValues returns the possible values for the ApplicationGatewayRuleSetStatusOptions const type. +func PossibleApplicationGatewayRuleSetStatusOptionsValues() []ApplicationGatewayRuleSetStatusOptions { + return []ApplicationGatewayRuleSetStatusOptions{ + ApplicationGatewayRuleSetStatusOptionsDeprecated, + ApplicationGatewayRuleSetStatusOptionsGA, + ApplicationGatewayRuleSetStatusOptionsPreview, + ApplicationGatewayRuleSetStatusOptionsSupported, + } +} + +// ApplicationGatewaySKUName - Name of an application gateway SKU. +type ApplicationGatewaySKUName string + +const ( + ApplicationGatewaySKUNameStandardLarge ApplicationGatewaySKUName = "Standard_Large" + ApplicationGatewaySKUNameStandardMedium ApplicationGatewaySKUName = "Standard_Medium" + ApplicationGatewaySKUNameStandardSmall ApplicationGatewaySKUName = "Standard_Small" + ApplicationGatewaySKUNameStandardV2 ApplicationGatewaySKUName = "Standard_v2" + ApplicationGatewaySKUNameWAFLarge ApplicationGatewaySKUName = "WAF_Large" + ApplicationGatewaySKUNameWAFMedium ApplicationGatewaySKUName = "WAF_Medium" + ApplicationGatewaySKUNameWAFV2 ApplicationGatewaySKUName = "WAF_v2" +) + +// PossibleApplicationGatewaySKUNameValues returns the possible values for the ApplicationGatewaySKUName const type. +func PossibleApplicationGatewaySKUNameValues() []ApplicationGatewaySKUName { + return []ApplicationGatewaySKUName{ + ApplicationGatewaySKUNameStandardLarge, + ApplicationGatewaySKUNameStandardMedium, + ApplicationGatewaySKUNameStandardSmall, + ApplicationGatewaySKUNameStandardV2, + ApplicationGatewaySKUNameWAFLarge, + ApplicationGatewaySKUNameWAFMedium, + ApplicationGatewaySKUNameWAFV2, + } +} + +// ApplicationGatewaySSLCipherSuite - Ssl cipher suites enums. +type ApplicationGatewaySSLCipherSuite string + +const ( + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ApplicationGatewaySSLCipherSuite = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ApplicationGatewaySSLCipherSuite = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ApplicationGatewaySSLCipherSuite = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ApplicationGatewaySSLCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" + ApplicationGatewaySSLCipherSuiteTLSRSAWITH3DESEDECBCSHA ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256 ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_128_GCM_SHA256" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256 ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA256" + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384 ApplicationGatewaySSLCipherSuite = "TLS_RSA_WITH_AES_256_GCM_SHA384" +) + +// PossibleApplicationGatewaySSLCipherSuiteValues returns the possible values for the ApplicationGatewaySSLCipherSuite const type. +func PossibleApplicationGatewaySSLCipherSuiteValues() []ApplicationGatewaySSLCipherSuite { + return []ApplicationGatewaySSLCipherSuite{ + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA, + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES128CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSDHEDSSWITHAES256CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES128GCMSHA256, + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSDHERSAWITHAES256GCMSHA384, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384, + ApplicationGatewaySSLCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES128GCMSHA256, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256CBCSHA384, + ApplicationGatewaySSLCipherSuiteTLSECDHERSAWITHAES256GCMSHA384, + ApplicationGatewaySSLCipherSuiteTLSRSAWITH3DESEDECBCSHA, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES128GCMSHA256, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256CBCSHA256, + ApplicationGatewaySSLCipherSuiteTLSRSAWITHAES256GCMSHA384, + } +} + +// ApplicationGatewaySSLPolicyName - Ssl predefined policy name enums. +type ApplicationGatewaySSLPolicyName string + +const ( + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20150501 ApplicationGatewaySSLPolicyName = "AppGwSslPolicy20150501" + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20170401 ApplicationGatewaySSLPolicyName = "AppGwSslPolicy20170401" + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20170401S ApplicationGatewaySSLPolicyName = "AppGwSslPolicy20170401S" + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101 ApplicationGatewaySSLPolicyName = "AppGwSslPolicy20220101" + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101S ApplicationGatewaySSLPolicyName = "AppGwSslPolicy20220101S" +) + +// PossibleApplicationGatewaySSLPolicyNameValues returns the possible values for the ApplicationGatewaySSLPolicyName const type. +func PossibleApplicationGatewaySSLPolicyNameValues() []ApplicationGatewaySSLPolicyName { + return []ApplicationGatewaySSLPolicyName{ + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20150501, + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20170401, + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20170401S, + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101, + ApplicationGatewaySSLPolicyNameAppGwSSLPolicy20220101S, + } +} + +// ApplicationGatewaySSLPolicyType - Type of Ssl Policy. +type ApplicationGatewaySSLPolicyType string + +const ( + ApplicationGatewaySSLPolicyTypeCustom ApplicationGatewaySSLPolicyType = "Custom" + ApplicationGatewaySSLPolicyTypeCustomV2 ApplicationGatewaySSLPolicyType = "CustomV2" + ApplicationGatewaySSLPolicyTypePredefined ApplicationGatewaySSLPolicyType = "Predefined" +) + +// PossibleApplicationGatewaySSLPolicyTypeValues returns the possible values for the ApplicationGatewaySSLPolicyType const type. +func PossibleApplicationGatewaySSLPolicyTypeValues() []ApplicationGatewaySSLPolicyType { + return []ApplicationGatewaySSLPolicyType{ + ApplicationGatewaySSLPolicyTypeCustom, + ApplicationGatewaySSLPolicyTypeCustomV2, + ApplicationGatewaySSLPolicyTypePredefined, + } +} + +// ApplicationGatewaySSLProtocol - Ssl protocol enums. +type ApplicationGatewaySSLProtocol string + +const ( + ApplicationGatewaySSLProtocolTLSv10 ApplicationGatewaySSLProtocol = "TLSv1_0" + ApplicationGatewaySSLProtocolTLSv11 ApplicationGatewaySSLProtocol = "TLSv1_1" + ApplicationGatewaySSLProtocolTLSv12 ApplicationGatewaySSLProtocol = "TLSv1_2" + ApplicationGatewaySSLProtocolTLSv13 ApplicationGatewaySSLProtocol = "TLSv1_3" +) + +// PossibleApplicationGatewaySSLProtocolValues returns the possible values for the ApplicationGatewaySSLProtocol const type. +func PossibleApplicationGatewaySSLProtocolValues() []ApplicationGatewaySSLProtocol { + return []ApplicationGatewaySSLProtocol{ + ApplicationGatewaySSLProtocolTLSv10, + ApplicationGatewaySSLProtocolTLSv11, + ApplicationGatewaySSLProtocolTLSv12, + ApplicationGatewaySSLProtocolTLSv13, + } +} + +// ApplicationGatewayTier - Tier of an application gateway. +type ApplicationGatewayTier string + +const ( + ApplicationGatewayTierStandard ApplicationGatewayTier = "Standard" + ApplicationGatewayTierStandardV2 ApplicationGatewayTier = "Standard_v2" + ApplicationGatewayTierWAF ApplicationGatewayTier = "WAF" + ApplicationGatewayTierWAFV2 ApplicationGatewayTier = "WAF_v2" +) + +// PossibleApplicationGatewayTierValues returns the possible values for the ApplicationGatewayTier const type. +func PossibleApplicationGatewayTierValues() []ApplicationGatewayTier { + return []ApplicationGatewayTier{ + ApplicationGatewayTierStandard, + ApplicationGatewayTierStandardV2, + ApplicationGatewayTierWAF, + ApplicationGatewayTierWAFV2, + } +} + +type ApplicationGatewayTierTypes string + +const ( + ApplicationGatewayTierTypesStandard ApplicationGatewayTierTypes = "Standard" + ApplicationGatewayTierTypesStandardV2 ApplicationGatewayTierTypes = "Standard_v2" + ApplicationGatewayTierTypesWAF ApplicationGatewayTierTypes = "WAF" + ApplicationGatewayTierTypesWAFV2 ApplicationGatewayTierTypes = "WAF_v2" +) + +// PossibleApplicationGatewayTierTypesValues returns the possible values for the ApplicationGatewayTierTypes const type. +func PossibleApplicationGatewayTierTypesValues() []ApplicationGatewayTierTypes { + return []ApplicationGatewayTierTypes{ + ApplicationGatewayTierTypesStandard, + ApplicationGatewayTierTypesStandardV2, + ApplicationGatewayTierTypesWAF, + ApplicationGatewayTierTypesWAFV2, + } +} + +// ApplicationGatewayWafRuleActionTypes - The string representation of the web application firewall rule action. +type ApplicationGatewayWafRuleActionTypes string + +const ( + ApplicationGatewayWafRuleActionTypesAllow ApplicationGatewayWafRuleActionTypes = "Allow" + ApplicationGatewayWafRuleActionTypesAnomalyScoring ApplicationGatewayWafRuleActionTypes = "AnomalyScoring" + ApplicationGatewayWafRuleActionTypesBlock ApplicationGatewayWafRuleActionTypes = "Block" + ApplicationGatewayWafRuleActionTypesLog ApplicationGatewayWafRuleActionTypes = "Log" + ApplicationGatewayWafRuleActionTypesNone ApplicationGatewayWafRuleActionTypes = "None" +) + +// PossibleApplicationGatewayWafRuleActionTypesValues returns the possible values for the ApplicationGatewayWafRuleActionTypes const type. +func PossibleApplicationGatewayWafRuleActionTypesValues() []ApplicationGatewayWafRuleActionTypes { + return []ApplicationGatewayWafRuleActionTypes{ + ApplicationGatewayWafRuleActionTypesAllow, + ApplicationGatewayWafRuleActionTypesAnomalyScoring, + ApplicationGatewayWafRuleActionTypesBlock, + ApplicationGatewayWafRuleActionTypesLog, + ApplicationGatewayWafRuleActionTypesNone, + } +} + +// ApplicationGatewayWafRuleStateTypes - The string representation of the web application firewall rule state. +type ApplicationGatewayWafRuleStateTypes string + +const ( + ApplicationGatewayWafRuleStateTypesDisabled ApplicationGatewayWafRuleStateTypes = "Disabled" + ApplicationGatewayWafRuleStateTypesEnabled ApplicationGatewayWafRuleStateTypes = "Enabled" +) + +// PossibleApplicationGatewayWafRuleStateTypesValues returns the possible values for the ApplicationGatewayWafRuleStateTypes const type. +func PossibleApplicationGatewayWafRuleStateTypesValues() []ApplicationGatewayWafRuleStateTypes { + return []ApplicationGatewayWafRuleStateTypes{ + ApplicationGatewayWafRuleStateTypesDisabled, + ApplicationGatewayWafRuleStateTypesEnabled, + } +} + +// AssociationType - The association type of the child resource to the parent resource. +type AssociationType string + +const ( + AssociationTypeAssociated AssociationType = "Associated" + AssociationTypeContains AssociationType = "Contains" +) + +// PossibleAssociationTypeValues returns the possible values for the AssociationType const type. +func PossibleAssociationTypeValues() []AssociationType { + return []AssociationType{ + AssociationTypeAssociated, + AssociationTypeContains, + } +} + +// AuthenticationMethod - VPN client authentication method. +type AuthenticationMethod string + +const ( + AuthenticationMethodEAPMSCHAPv2 AuthenticationMethod = "EAPMSCHAPv2" + AuthenticationMethodEAPTLS AuthenticationMethod = "EAPTLS" +) + +// PossibleAuthenticationMethodValues returns the possible values for the AuthenticationMethod const type. +func PossibleAuthenticationMethodValues() []AuthenticationMethod { + return []AuthenticationMethod{ + AuthenticationMethodEAPMSCHAPv2, + AuthenticationMethodEAPTLS, + } +} + +// AuthorizationUseStatus - The authorization use status. +type AuthorizationUseStatus string + +const ( + AuthorizationUseStatusAvailable AuthorizationUseStatus = "Available" + AuthorizationUseStatusInUse AuthorizationUseStatus = "InUse" +) + +// PossibleAuthorizationUseStatusValues returns the possible values for the AuthorizationUseStatus const type. +func PossibleAuthorizationUseStatusValues() []AuthorizationUseStatus { + return []AuthorizationUseStatus{ + AuthorizationUseStatusAvailable, + AuthorizationUseStatusInUse, + } +} + +// AutoLearnPrivateRangesMode - The operation mode for automatically learning private ranges to not be SNAT +type AutoLearnPrivateRangesMode string + +const ( + AutoLearnPrivateRangesModeDisabled AutoLearnPrivateRangesMode = "Disabled" + AutoLearnPrivateRangesModeEnabled AutoLearnPrivateRangesMode = "Enabled" +) + +// PossibleAutoLearnPrivateRangesModeValues returns the possible values for the AutoLearnPrivateRangesMode const type. +func PossibleAutoLearnPrivateRangesModeValues() []AutoLearnPrivateRangesMode { + return []AutoLearnPrivateRangesMode{ + AutoLearnPrivateRangesModeDisabled, + AutoLearnPrivateRangesModeEnabled, + } +} + +// AzureFirewallApplicationRuleProtocolType - The protocol type of a Application Rule resource. +type AzureFirewallApplicationRuleProtocolType string + +const ( + AzureFirewallApplicationRuleProtocolTypeHTTP AzureFirewallApplicationRuleProtocolType = "Http" + AzureFirewallApplicationRuleProtocolTypeHTTPS AzureFirewallApplicationRuleProtocolType = "Https" + AzureFirewallApplicationRuleProtocolTypeMssql AzureFirewallApplicationRuleProtocolType = "Mssql" +) + +// PossibleAzureFirewallApplicationRuleProtocolTypeValues returns the possible values for the AzureFirewallApplicationRuleProtocolType const type. +func PossibleAzureFirewallApplicationRuleProtocolTypeValues() []AzureFirewallApplicationRuleProtocolType { + return []AzureFirewallApplicationRuleProtocolType{ + AzureFirewallApplicationRuleProtocolTypeHTTP, + AzureFirewallApplicationRuleProtocolTypeHTTPS, + AzureFirewallApplicationRuleProtocolTypeMssql, + } +} + +// AzureFirewallNatRCActionType - The action type of a NAT rule collection. +type AzureFirewallNatRCActionType string + +const ( + AzureFirewallNatRCActionTypeDnat AzureFirewallNatRCActionType = "Dnat" + AzureFirewallNatRCActionTypeSnat AzureFirewallNatRCActionType = "Snat" +) + +// PossibleAzureFirewallNatRCActionTypeValues returns the possible values for the AzureFirewallNatRCActionType const type. +func PossibleAzureFirewallNatRCActionTypeValues() []AzureFirewallNatRCActionType { + return []AzureFirewallNatRCActionType{ + AzureFirewallNatRCActionTypeDnat, + AzureFirewallNatRCActionTypeSnat, + } +} + +// AzureFirewallNetworkRuleProtocol - The protocol of a Network Rule resource. +type AzureFirewallNetworkRuleProtocol string + +const ( + AzureFirewallNetworkRuleProtocolAny AzureFirewallNetworkRuleProtocol = "Any" + AzureFirewallNetworkRuleProtocolICMP AzureFirewallNetworkRuleProtocol = "ICMP" + AzureFirewallNetworkRuleProtocolTCP AzureFirewallNetworkRuleProtocol = "TCP" + AzureFirewallNetworkRuleProtocolUDP AzureFirewallNetworkRuleProtocol = "UDP" +) + +// PossibleAzureFirewallNetworkRuleProtocolValues returns the possible values for the AzureFirewallNetworkRuleProtocol const type. +func PossibleAzureFirewallNetworkRuleProtocolValues() []AzureFirewallNetworkRuleProtocol { + return []AzureFirewallNetworkRuleProtocol{ + AzureFirewallNetworkRuleProtocolAny, + AzureFirewallNetworkRuleProtocolICMP, + AzureFirewallNetworkRuleProtocolTCP, + AzureFirewallNetworkRuleProtocolUDP, + } +} + +// AzureFirewallRCActionType - The action type of a rule collection. +type AzureFirewallRCActionType string + +const ( + AzureFirewallRCActionTypeAllow AzureFirewallRCActionType = "Allow" + AzureFirewallRCActionTypeDeny AzureFirewallRCActionType = "Deny" +) + +// PossibleAzureFirewallRCActionTypeValues returns the possible values for the AzureFirewallRCActionType const type. +func PossibleAzureFirewallRCActionTypeValues() []AzureFirewallRCActionType { + return []AzureFirewallRCActionType{ + AzureFirewallRCActionTypeAllow, + AzureFirewallRCActionTypeDeny, + } +} + +// AzureFirewallSKUName - Name of an Azure Firewall SKU. +type AzureFirewallSKUName string + +const ( + AzureFirewallSKUNameAZFWHub AzureFirewallSKUName = "AZFW_Hub" + AzureFirewallSKUNameAZFWVnet AzureFirewallSKUName = "AZFW_VNet" +) + +// PossibleAzureFirewallSKUNameValues returns the possible values for the AzureFirewallSKUName const type. +func PossibleAzureFirewallSKUNameValues() []AzureFirewallSKUName { + return []AzureFirewallSKUName{ + AzureFirewallSKUNameAZFWHub, + AzureFirewallSKUNameAZFWVnet, + } +} + +// AzureFirewallSKUTier - Tier of an Azure Firewall. +type AzureFirewallSKUTier string + +const ( + AzureFirewallSKUTierBasic AzureFirewallSKUTier = "Basic" + AzureFirewallSKUTierPremium AzureFirewallSKUTier = "Premium" + AzureFirewallSKUTierStandard AzureFirewallSKUTier = "Standard" +) + +// PossibleAzureFirewallSKUTierValues returns the possible values for the AzureFirewallSKUTier const type. +func PossibleAzureFirewallSKUTierValues() []AzureFirewallSKUTier { + return []AzureFirewallSKUTier{ + AzureFirewallSKUTierBasic, + AzureFirewallSKUTierPremium, + AzureFirewallSKUTierStandard, + } +} + +// AzureFirewallThreatIntelMode - The operation mode for Threat Intel. +type AzureFirewallThreatIntelMode string + +const ( + AzureFirewallThreatIntelModeAlert AzureFirewallThreatIntelMode = "Alert" + AzureFirewallThreatIntelModeDeny AzureFirewallThreatIntelMode = "Deny" + AzureFirewallThreatIntelModeOff AzureFirewallThreatIntelMode = "Off" +) + +// PossibleAzureFirewallThreatIntelModeValues returns the possible values for the AzureFirewallThreatIntelMode const type. +func PossibleAzureFirewallThreatIntelModeValues() []AzureFirewallThreatIntelMode { + return []AzureFirewallThreatIntelMode{ + AzureFirewallThreatIntelModeAlert, + AzureFirewallThreatIntelModeDeny, + AzureFirewallThreatIntelModeOff, + } +} + +// BastionConnectProtocol - The protocol used to connect to the target. +type BastionConnectProtocol string + +const ( + BastionConnectProtocolRDP BastionConnectProtocol = "RDP" + BastionConnectProtocolSSH BastionConnectProtocol = "SSH" +) + +// PossibleBastionConnectProtocolValues returns the possible values for the BastionConnectProtocol const type. +func PossibleBastionConnectProtocolValues() []BastionConnectProtocol { + return []BastionConnectProtocol{ + BastionConnectProtocolRDP, + BastionConnectProtocolSSH, + } +} + +// BastionHostSKUName - The name of this Bastion Host. +type BastionHostSKUName string + +const ( + BastionHostSKUNameBasic BastionHostSKUName = "Basic" + BastionHostSKUNameStandard BastionHostSKUName = "Standard" +) + +// PossibleBastionHostSKUNameValues returns the possible values for the BastionHostSKUName const type. +func PossibleBastionHostSKUNameValues() []BastionHostSKUName { + return []BastionHostSKUName{ + BastionHostSKUNameBasic, + BastionHostSKUNameStandard, + } +} + +// BgpPeerState - The BGP peer state. +type BgpPeerState string + +const ( + BgpPeerStateConnected BgpPeerState = "Connected" + BgpPeerStateConnecting BgpPeerState = "Connecting" + BgpPeerStateIdle BgpPeerState = "Idle" + BgpPeerStateStopped BgpPeerState = "Stopped" + BgpPeerStateUnknown BgpPeerState = "Unknown" +) + +// PossibleBgpPeerStateValues returns the possible values for the BgpPeerState const type. +func PossibleBgpPeerStateValues() []BgpPeerState { + return []BgpPeerState{ + BgpPeerStateConnected, + BgpPeerStateConnecting, + BgpPeerStateIdle, + BgpPeerStateStopped, + BgpPeerStateUnknown, + } +} + +// CircuitConnectionStatus - Express Route Circuit connection state. +type CircuitConnectionStatus string + +const ( + CircuitConnectionStatusConnected CircuitConnectionStatus = "Connected" + CircuitConnectionStatusConnecting CircuitConnectionStatus = "Connecting" + CircuitConnectionStatusDisconnected CircuitConnectionStatus = "Disconnected" +) + +// PossibleCircuitConnectionStatusValues returns the possible values for the CircuitConnectionStatus const type. +func PossibleCircuitConnectionStatusValues() []CircuitConnectionStatus { + return []CircuitConnectionStatus{ + CircuitConnectionStatusConnected, + CircuitConnectionStatusConnecting, + CircuitConnectionStatusDisconnected, + } +} + +// CommissionedState - The commissioned state of the Custom IP Prefix. +type CommissionedState string + +const ( + CommissionedStateCommissioned CommissionedState = "Commissioned" + CommissionedStateCommissionedNoInternetAdvertise CommissionedState = "CommissionedNoInternetAdvertise" + CommissionedStateCommissioning CommissionedState = "Commissioning" + CommissionedStateDecommissioning CommissionedState = "Decommissioning" + CommissionedStateDeprovisioned CommissionedState = "Deprovisioned" + CommissionedStateDeprovisioning CommissionedState = "Deprovisioning" + CommissionedStateProvisioned CommissionedState = "Provisioned" + CommissionedStateProvisioning CommissionedState = "Provisioning" +) + +// PossibleCommissionedStateValues returns the possible values for the CommissionedState const type. +func PossibleCommissionedStateValues() []CommissionedState { + return []CommissionedState{ + CommissionedStateCommissioned, + CommissionedStateCommissionedNoInternetAdvertise, + CommissionedStateCommissioning, + CommissionedStateDecommissioning, + CommissionedStateDeprovisioned, + CommissionedStateDeprovisioning, + CommissionedStateProvisioned, + CommissionedStateProvisioning, + } +} + +// ConfigurationType - Configuration Deployment Type. +type ConfigurationType string + +const ( + ConfigurationTypeConnectivity ConfigurationType = "Connectivity" + ConfigurationTypeSecurityAdmin ConfigurationType = "SecurityAdmin" +) + +// PossibleConfigurationTypeValues returns the possible values for the ConfigurationType const type. +func PossibleConfigurationTypeValues() []ConfigurationType { + return []ConfigurationType{ + ConfigurationTypeConnectivity, + ConfigurationTypeSecurityAdmin, + } +} + +// ConnectionMonitorEndpointFilterItemType - The type of item included in the filter. Currently only 'AgentAddress' is supported. +type ConnectionMonitorEndpointFilterItemType string + +const ( + ConnectionMonitorEndpointFilterItemTypeAgentAddress ConnectionMonitorEndpointFilterItemType = "AgentAddress" +) + +// PossibleConnectionMonitorEndpointFilterItemTypeValues returns the possible values for the ConnectionMonitorEndpointFilterItemType const type. +func PossibleConnectionMonitorEndpointFilterItemTypeValues() []ConnectionMonitorEndpointFilterItemType { + return []ConnectionMonitorEndpointFilterItemType{ + ConnectionMonitorEndpointFilterItemTypeAgentAddress, + } +} + +// ConnectionMonitorEndpointFilterType - The behavior of the endpoint filter. Currently only 'Include' is supported. +type ConnectionMonitorEndpointFilterType string + +const ( + ConnectionMonitorEndpointFilterTypeInclude ConnectionMonitorEndpointFilterType = "Include" +) + +// PossibleConnectionMonitorEndpointFilterTypeValues returns the possible values for the ConnectionMonitorEndpointFilterType const type. +func PossibleConnectionMonitorEndpointFilterTypeValues() []ConnectionMonitorEndpointFilterType { + return []ConnectionMonitorEndpointFilterType{ + ConnectionMonitorEndpointFilterTypeInclude, + } +} + +// ConnectionMonitorSourceStatus - Status of connection monitor source. +type ConnectionMonitorSourceStatus string + +const ( + ConnectionMonitorSourceStatusActive ConnectionMonitorSourceStatus = "Active" + ConnectionMonitorSourceStatusInactive ConnectionMonitorSourceStatus = "Inactive" + ConnectionMonitorSourceStatusUnknown ConnectionMonitorSourceStatus = "Unknown" +) + +// PossibleConnectionMonitorSourceStatusValues returns the possible values for the ConnectionMonitorSourceStatus const type. +func PossibleConnectionMonitorSourceStatusValues() []ConnectionMonitorSourceStatus { + return []ConnectionMonitorSourceStatus{ + ConnectionMonitorSourceStatusActive, + ConnectionMonitorSourceStatusInactive, + ConnectionMonitorSourceStatusUnknown, + } +} + +// ConnectionMonitorTestConfigurationProtocol - The protocol to use in test evaluation. +type ConnectionMonitorTestConfigurationProtocol string + +const ( + ConnectionMonitorTestConfigurationProtocolHTTP ConnectionMonitorTestConfigurationProtocol = "Http" + ConnectionMonitorTestConfigurationProtocolIcmp ConnectionMonitorTestConfigurationProtocol = "Icmp" + ConnectionMonitorTestConfigurationProtocolTCP ConnectionMonitorTestConfigurationProtocol = "Tcp" +) + +// PossibleConnectionMonitorTestConfigurationProtocolValues returns the possible values for the ConnectionMonitorTestConfigurationProtocol const type. +func PossibleConnectionMonitorTestConfigurationProtocolValues() []ConnectionMonitorTestConfigurationProtocol { + return []ConnectionMonitorTestConfigurationProtocol{ + ConnectionMonitorTestConfigurationProtocolHTTP, + ConnectionMonitorTestConfigurationProtocolIcmp, + ConnectionMonitorTestConfigurationProtocolTCP, + } +} + +// ConnectionMonitorType - Type of connection monitor. +type ConnectionMonitorType string + +const ( + ConnectionMonitorTypeMultiEndpoint ConnectionMonitorType = "MultiEndpoint" + ConnectionMonitorTypeSingleSourceDestination ConnectionMonitorType = "SingleSourceDestination" +) + +// PossibleConnectionMonitorTypeValues returns the possible values for the ConnectionMonitorType const type. +func PossibleConnectionMonitorTypeValues() []ConnectionMonitorType { + return []ConnectionMonitorType{ + ConnectionMonitorTypeMultiEndpoint, + ConnectionMonitorTypeSingleSourceDestination, + } +} + +// ConnectionState - The connection state. +type ConnectionState string + +const ( + ConnectionStateReachable ConnectionState = "Reachable" + ConnectionStateUnknown ConnectionState = "Unknown" + ConnectionStateUnreachable ConnectionState = "Unreachable" +) + +// PossibleConnectionStateValues returns the possible values for the ConnectionState const type. +func PossibleConnectionStateValues() []ConnectionState { + return []ConnectionState{ + ConnectionStateReachable, + ConnectionStateUnknown, + ConnectionStateUnreachable, + } +} + +// ConnectionStatus - The connection status. +type ConnectionStatus string + +const ( + ConnectionStatusConnected ConnectionStatus = "Connected" + ConnectionStatusDegraded ConnectionStatus = "Degraded" + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + ConnectionStatusUnknown ConnectionStatus = "Unknown" +) + +// PossibleConnectionStatusValues returns the possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ + ConnectionStatusConnected, + ConnectionStatusDegraded, + ConnectionStatusDisconnected, + ConnectionStatusUnknown, + } +} + +// ConnectivityTopology - Connectivity topology type. +type ConnectivityTopology string + +const ( + ConnectivityTopologyHubAndSpoke ConnectivityTopology = "HubAndSpoke" + ConnectivityTopologyMesh ConnectivityTopology = "Mesh" +) + +// PossibleConnectivityTopologyValues returns the possible values for the ConnectivityTopology const type. +func PossibleConnectivityTopologyValues() []ConnectivityTopology { + return []ConnectivityTopology{ + ConnectivityTopologyHubAndSpoke, + ConnectivityTopologyMesh, + } +} + +// CoverageLevel - Test coverage for the endpoint. +type CoverageLevel string + +const ( + CoverageLevelAboveAverage CoverageLevel = "AboveAverage" + CoverageLevelAverage CoverageLevel = "Average" + CoverageLevelBelowAverage CoverageLevel = "BelowAverage" + CoverageLevelDefault CoverageLevel = "Default" + CoverageLevelFull CoverageLevel = "Full" + CoverageLevelLow CoverageLevel = "Low" +) + +// PossibleCoverageLevelValues returns the possible values for the CoverageLevel const type. +func PossibleCoverageLevelValues() []CoverageLevel { + return []CoverageLevel{ + CoverageLevelAboveAverage, + CoverageLevelAverage, + CoverageLevelBelowAverage, + CoverageLevelDefault, + CoverageLevelFull, + CoverageLevelLow, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// CustomIPPrefixType - Type of custom IP prefix. Should be Singular, Parent, or Child. +type CustomIPPrefixType string + +const ( + CustomIPPrefixTypeChild CustomIPPrefixType = "Child" + CustomIPPrefixTypeParent CustomIPPrefixType = "Parent" + CustomIPPrefixTypeSingular CustomIPPrefixType = "Singular" +) + +// PossibleCustomIPPrefixTypeValues returns the possible values for the CustomIPPrefixType const type. +func PossibleCustomIPPrefixTypeValues() []CustomIPPrefixType { + return []CustomIPPrefixType{ + CustomIPPrefixTypeChild, + CustomIPPrefixTypeParent, + CustomIPPrefixTypeSingular, + } +} + +// DdosSettingsProtectionMode - The DDoS protection mode of the public IP +type DdosSettingsProtectionMode string + +const ( + DdosSettingsProtectionModeDisabled DdosSettingsProtectionMode = "Disabled" + DdosSettingsProtectionModeEnabled DdosSettingsProtectionMode = "Enabled" + DdosSettingsProtectionModeVirtualNetworkInherited DdosSettingsProtectionMode = "VirtualNetworkInherited" +) + +// PossibleDdosSettingsProtectionModeValues returns the possible values for the DdosSettingsProtectionMode const type. +func PossibleDdosSettingsProtectionModeValues() []DdosSettingsProtectionMode { + return []DdosSettingsProtectionMode{ + DdosSettingsProtectionModeDisabled, + DdosSettingsProtectionModeEnabled, + DdosSettingsProtectionModeVirtualNetworkInherited, + } +} + +// DeleteExistingPeering - Flag if need to remove current existing peerings. +type DeleteExistingPeering string + +const ( + DeleteExistingPeeringFalse DeleteExistingPeering = "False" + DeleteExistingPeeringTrue DeleteExistingPeering = "True" +) + +// PossibleDeleteExistingPeeringValues returns the possible values for the DeleteExistingPeering const type. +func PossibleDeleteExistingPeeringValues() []DeleteExistingPeering { + return []DeleteExistingPeering{ + DeleteExistingPeeringFalse, + DeleteExistingPeeringTrue, + } +} + +// DeleteOptions - Specify what happens to the public IP address when the VM using it is deleted +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +// PossibleDeleteOptionsValues returns the possible values for the DeleteOptions const type. +func PossibleDeleteOptionsValues() []DeleteOptions { + return []DeleteOptions{ + DeleteOptionsDelete, + DeleteOptionsDetach, + } +} + +// DeploymentStatus - Deployment Status. +type DeploymentStatus string + +const ( + DeploymentStatusDeployed DeploymentStatus = "Deployed" + DeploymentStatusDeploying DeploymentStatus = "Deploying" + DeploymentStatusFailed DeploymentStatus = "Failed" + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" +) + +// PossibleDeploymentStatusValues returns the possible values for the DeploymentStatus const type. +func PossibleDeploymentStatusValues() []DeploymentStatus { + return []DeploymentStatus{ + DeploymentStatusDeployed, + DeploymentStatusDeploying, + DeploymentStatusFailed, + DeploymentStatusNotStarted, + } +} + +// DestinationPortBehavior - Destination port behavior. +type DestinationPortBehavior string + +const ( + DestinationPortBehaviorListenIfAvailable DestinationPortBehavior = "ListenIfAvailable" + DestinationPortBehaviorNone DestinationPortBehavior = "None" +) + +// PossibleDestinationPortBehaviorValues returns the possible values for the DestinationPortBehavior const type. +func PossibleDestinationPortBehaviorValues() []DestinationPortBehavior { + return []DestinationPortBehavior{ + DestinationPortBehaviorListenIfAvailable, + DestinationPortBehaviorNone, + } +} + +// DhGroup - The DH Groups used in IKE Phase 1 for initial SA. +type DhGroup string + +const ( + DhGroupDHGroup1 DhGroup = "DHGroup1" + DhGroupDHGroup14 DhGroup = "DHGroup14" + DhGroupDHGroup2 DhGroup = "DHGroup2" + DhGroupDHGroup2048 DhGroup = "DHGroup2048" + DhGroupDHGroup24 DhGroup = "DHGroup24" + DhGroupECP256 DhGroup = "ECP256" + DhGroupECP384 DhGroup = "ECP384" + DhGroupNone DhGroup = "None" +) + +// PossibleDhGroupValues returns the possible values for the DhGroup const type. +func PossibleDhGroupValues() []DhGroup { + return []DhGroup{ + DhGroupDHGroup1, + DhGroupDHGroup14, + DhGroupDHGroup2, + DhGroupDHGroup2048, + DhGroupDHGroup24, + DhGroupECP256, + DhGroupECP384, + DhGroupNone, + } +} + +// Direction - The direction of the traffic. +type Direction string + +const ( + DirectionInbound Direction = "Inbound" + DirectionOutbound Direction = "Outbound" +) + +// PossibleDirectionValues returns the possible values for the Direction const type. +func PossibleDirectionValues() []Direction { + return []Direction{ + DirectionInbound, + DirectionOutbound, + } +} + +// EffectiveAdminRuleKind - Whether the rule is custom or default. +type EffectiveAdminRuleKind string + +const ( + EffectiveAdminRuleKindCustom EffectiveAdminRuleKind = "Custom" + EffectiveAdminRuleKindDefault EffectiveAdminRuleKind = "Default" +) + +// PossibleEffectiveAdminRuleKindValues returns the possible values for the EffectiveAdminRuleKind const type. +func PossibleEffectiveAdminRuleKindValues() []EffectiveAdminRuleKind { + return []EffectiveAdminRuleKind{ + EffectiveAdminRuleKindCustom, + EffectiveAdminRuleKindDefault, + } +} + +// EffectiveRouteSource - Who created the route. +type EffectiveRouteSource string + +const ( + EffectiveRouteSourceDefault EffectiveRouteSource = "Default" + EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" + EffectiveRouteSourceUser EffectiveRouteSource = "User" + EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" +) + +// PossibleEffectiveRouteSourceValues returns the possible values for the EffectiveRouteSource const type. +func PossibleEffectiveRouteSourceValues() []EffectiveRouteSource { + return []EffectiveRouteSource{ + EffectiveRouteSourceDefault, + EffectiveRouteSourceUnknown, + EffectiveRouteSourceUser, + EffectiveRouteSourceVirtualNetworkGateway, + } +} + +// EffectiveRouteState - The value of effective route. +type EffectiveRouteState string + +const ( + EffectiveRouteStateActive EffectiveRouteState = "Active" + EffectiveRouteStateInvalid EffectiveRouteState = "Invalid" +) + +// PossibleEffectiveRouteStateValues returns the possible values for the EffectiveRouteState const type. +func PossibleEffectiveRouteStateValues() []EffectiveRouteState { + return []EffectiveRouteState{ + EffectiveRouteStateActive, + EffectiveRouteStateInvalid, + } +} + +// EffectiveSecurityRuleProtocol - The network protocol this rule applies to. +type EffectiveSecurityRuleProtocol string + +const ( + EffectiveSecurityRuleProtocolAll EffectiveSecurityRuleProtocol = "All" + EffectiveSecurityRuleProtocolTCP EffectiveSecurityRuleProtocol = "Tcp" + EffectiveSecurityRuleProtocolUDP EffectiveSecurityRuleProtocol = "Udp" +) + +// PossibleEffectiveSecurityRuleProtocolValues returns the possible values for the EffectiveSecurityRuleProtocol const type. +func PossibleEffectiveSecurityRuleProtocolValues() []EffectiveSecurityRuleProtocol { + return []EffectiveSecurityRuleProtocol{ + EffectiveSecurityRuleProtocolAll, + EffectiveSecurityRuleProtocolTCP, + EffectiveSecurityRuleProtocolUDP, + } +} + +// EndpointType - The endpoint type. +type EndpointType string + +const ( + EndpointTypeAzureArcVM EndpointType = "AzureArcVM" + EndpointTypeAzureSubnet EndpointType = "AzureSubnet" + EndpointTypeAzureVM EndpointType = "AzureVM" + EndpointTypeAzureVMSS EndpointType = "AzureVMSS" + EndpointTypeAzureVNet EndpointType = "AzureVNet" + EndpointTypeExternalAddress EndpointType = "ExternalAddress" + EndpointTypeMMAWorkspaceMachine EndpointType = "MMAWorkspaceMachine" + EndpointTypeMMAWorkspaceNetwork EndpointType = "MMAWorkspaceNetwork" +) + +// PossibleEndpointTypeValues returns the possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{ + EndpointTypeAzureArcVM, + EndpointTypeAzureSubnet, + EndpointTypeAzureVM, + EndpointTypeAzureVMSS, + EndpointTypeAzureVNet, + EndpointTypeExternalAddress, + EndpointTypeMMAWorkspaceMachine, + EndpointTypeMMAWorkspaceNetwork, + } +} + +// EvaluationState - Connectivity analysis evaluation state. +type EvaluationState string + +const ( + EvaluationStateCompleted EvaluationState = "Completed" + EvaluationStateInProgress EvaluationState = "InProgress" + EvaluationStateNotStarted EvaluationState = "NotStarted" +) + +// PossibleEvaluationStateValues returns the possible values for the EvaluationState const type. +func PossibleEvaluationStateValues() []EvaluationState { + return []EvaluationState{ + EvaluationStateCompleted, + EvaluationStateInProgress, + EvaluationStateNotStarted, + } +} + +// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState - The advertised public prefix state of the Peering resource. +type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string + +const ( + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" +) + +// PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues returns the possible values for the ExpressRouteCircuitPeeringAdvertisedPublicPrefixState const type. +func PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues() []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState { + return []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState{ + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured, + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring, + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured, + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded, + } +} + +// ExpressRouteCircuitPeeringState - The state of peering. +type ExpressRouteCircuitPeeringState string + +const ( + ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" + ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" +) + +// PossibleExpressRouteCircuitPeeringStateValues returns the possible values for the ExpressRouteCircuitPeeringState const type. +func PossibleExpressRouteCircuitPeeringStateValues() []ExpressRouteCircuitPeeringState { + return []ExpressRouteCircuitPeeringState{ + ExpressRouteCircuitPeeringStateDisabled, + ExpressRouteCircuitPeeringStateEnabled, + } +} + +// ExpressRouteCircuitSKUFamily - The family of the SKU. +type ExpressRouteCircuitSKUFamily string + +const ( + ExpressRouteCircuitSKUFamilyMeteredData ExpressRouteCircuitSKUFamily = "MeteredData" + ExpressRouteCircuitSKUFamilyUnlimitedData ExpressRouteCircuitSKUFamily = "UnlimitedData" +) + +// PossibleExpressRouteCircuitSKUFamilyValues returns the possible values for the ExpressRouteCircuitSKUFamily const type. +func PossibleExpressRouteCircuitSKUFamilyValues() []ExpressRouteCircuitSKUFamily { + return []ExpressRouteCircuitSKUFamily{ + ExpressRouteCircuitSKUFamilyMeteredData, + ExpressRouteCircuitSKUFamilyUnlimitedData, + } +} + +// ExpressRouteCircuitSKUTier - The tier of the SKU. +type ExpressRouteCircuitSKUTier string + +const ( + ExpressRouteCircuitSKUTierBasic ExpressRouteCircuitSKUTier = "Basic" + ExpressRouteCircuitSKUTierLocal ExpressRouteCircuitSKUTier = "Local" + ExpressRouteCircuitSKUTierPremium ExpressRouteCircuitSKUTier = "Premium" + ExpressRouteCircuitSKUTierStandard ExpressRouteCircuitSKUTier = "Standard" +) + +// PossibleExpressRouteCircuitSKUTierValues returns the possible values for the ExpressRouteCircuitSKUTier const type. +func PossibleExpressRouteCircuitSKUTierValues() []ExpressRouteCircuitSKUTier { + return []ExpressRouteCircuitSKUTier{ + ExpressRouteCircuitSKUTierBasic, + ExpressRouteCircuitSKUTierLocal, + ExpressRouteCircuitSKUTierPremium, + ExpressRouteCircuitSKUTierStandard, + } +} + +// ExpressRouteLinkAdminState - Administrative state of the physical port. +type ExpressRouteLinkAdminState string + +const ( + ExpressRouteLinkAdminStateDisabled ExpressRouteLinkAdminState = "Disabled" + ExpressRouteLinkAdminStateEnabled ExpressRouteLinkAdminState = "Enabled" +) + +// PossibleExpressRouteLinkAdminStateValues returns the possible values for the ExpressRouteLinkAdminState const type. +func PossibleExpressRouteLinkAdminStateValues() []ExpressRouteLinkAdminState { + return []ExpressRouteLinkAdminState{ + ExpressRouteLinkAdminStateDisabled, + ExpressRouteLinkAdminStateEnabled, + } +} + +// ExpressRouteLinkConnectorType - Physical fiber port type. +type ExpressRouteLinkConnectorType string + +const ( + ExpressRouteLinkConnectorTypeLC ExpressRouteLinkConnectorType = "LC" + ExpressRouteLinkConnectorTypeSC ExpressRouteLinkConnectorType = "SC" +) + +// PossibleExpressRouteLinkConnectorTypeValues returns the possible values for the ExpressRouteLinkConnectorType const type. +func PossibleExpressRouteLinkConnectorTypeValues() []ExpressRouteLinkConnectorType { + return []ExpressRouteLinkConnectorType{ + ExpressRouteLinkConnectorTypeLC, + ExpressRouteLinkConnectorTypeSC, + } +} + +// ExpressRouteLinkMacSecCipher - Mac security cipher. +type ExpressRouteLinkMacSecCipher string + +const ( + ExpressRouteLinkMacSecCipherGCMAES128 ExpressRouteLinkMacSecCipher = "GcmAes128" + ExpressRouteLinkMacSecCipherGCMAES256 ExpressRouteLinkMacSecCipher = "GcmAes256" + ExpressRouteLinkMacSecCipherGCMAesXpn128 ExpressRouteLinkMacSecCipher = "GcmAesXpn128" + ExpressRouteLinkMacSecCipherGCMAesXpn256 ExpressRouteLinkMacSecCipher = "GcmAesXpn256" +) + +// PossibleExpressRouteLinkMacSecCipherValues returns the possible values for the ExpressRouteLinkMacSecCipher const type. +func PossibleExpressRouteLinkMacSecCipherValues() []ExpressRouteLinkMacSecCipher { + return []ExpressRouteLinkMacSecCipher{ + ExpressRouteLinkMacSecCipherGCMAES128, + ExpressRouteLinkMacSecCipherGCMAES256, + ExpressRouteLinkMacSecCipherGCMAesXpn128, + ExpressRouteLinkMacSecCipherGCMAesXpn256, + } +} + +// ExpressRouteLinkMacSecSciState - Sci mode enabled/disabled. +type ExpressRouteLinkMacSecSciState string + +const ( + ExpressRouteLinkMacSecSciStateDisabled ExpressRouteLinkMacSecSciState = "Disabled" + ExpressRouteLinkMacSecSciStateEnabled ExpressRouteLinkMacSecSciState = "Enabled" +) + +// PossibleExpressRouteLinkMacSecSciStateValues returns the possible values for the ExpressRouteLinkMacSecSciState const type. +func PossibleExpressRouteLinkMacSecSciStateValues() []ExpressRouteLinkMacSecSciState { + return []ExpressRouteLinkMacSecSciState{ + ExpressRouteLinkMacSecSciStateDisabled, + ExpressRouteLinkMacSecSciStateEnabled, + } +} + +// ExpressRoutePeeringState - The state of peering. +type ExpressRoutePeeringState string + +const ( + ExpressRoutePeeringStateDisabled ExpressRoutePeeringState = "Disabled" + ExpressRoutePeeringStateEnabled ExpressRoutePeeringState = "Enabled" +) + +// PossibleExpressRoutePeeringStateValues returns the possible values for the ExpressRoutePeeringState const type. +func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { + return []ExpressRoutePeeringState{ + ExpressRoutePeeringStateDisabled, + ExpressRoutePeeringStateEnabled, + } +} + +// ExpressRoutePeeringType - The peering type. +type ExpressRoutePeeringType string + +const ( + ExpressRoutePeeringTypeAzurePrivatePeering ExpressRoutePeeringType = "AzurePrivatePeering" + ExpressRoutePeeringTypeAzurePublicPeering ExpressRoutePeeringType = "AzurePublicPeering" + ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = "MicrosoftPeering" +) + +// PossibleExpressRoutePeeringTypeValues returns the possible values for the ExpressRoutePeeringType const type. +func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { + return []ExpressRoutePeeringType{ + ExpressRoutePeeringTypeAzurePrivatePeering, + ExpressRoutePeeringTypeAzurePublicPeering, + ExpressRoutePeeringTypeMicrosoftPeering, + } +} + +// ExpressRoutePortAuthorizationUseStatus - The authorization use status. +type ExpressRoutePortAuthorizationUseStatus string + +const ( + ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = "Available" + ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = "InUse" +) + +// PossibleExpressRoutePortAuthorizationUseStatusValues returns the possible values for the ExpressRoutePortAuthorizationUseStatus const type. +func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { + return []ExpressRoutePortAuthorizationUseStatus{ + ExpressRoutePortAuthorizationUseStatusAvailable, + ExpressRoutePortAuthorizationUseStatusInUse, + } +} + +// ExpressRoutePortsBillingType - The billing type of the ExpressRoutePort resource. +type ExpressRoutePortsBillingType string + +const ( + ExpressRoutePortsBillingTypeMeteredData ExpressRoutePortsBillingType = "MeteredData" + ExpressRoutePortsBillingTypeUnlimitedData ExpressRoutePortsBillingType = "UnlimitedData" +) + +// PossibleExpressRoutePortsBillingTypeValues returns the possible values for the ExpressRoutePortsBillingType const type. +func PossibleExpressRoutePortsBillingTypeValues() []ExpressRoutePortsBillingType { + return []ExpressRoutePortsBillingType{ + ExpressRoutePortsBillingTypeMeteredData, + ExpressRoutePortsBillingTypeUnlimitedData, + } +} + +// ExpressRoutePortsEncapsulation - Encapsulation method on physical ports. +type ExpressRoutePortsEncapsulation string + +const ( + ExpressRoutePortsEncapsulationDot1Q ExpressRoutePortsEncapsulation = "Dot1Q" + ExpressRoutePortsEncapsulationQinQ ExpressRoutePortsEncapsulation = "QinQ" +) + +// PossibleExpressRoutePortsEncapsulationValues returns the possible values for the ExpressRoutePortsEncapsulation const type. +func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { + return []ExpressRoutePortsEncapsulation{ + ExpressRoutePortsEncapsulationDot1Q, + ExpressRoutePortsEncapsulationQinQ, + } +} + +// ExtendedLocationTypes - The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network +// resources. +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesEdgeZone, + } +} + +// FirewallPolicyFilterRuleCollectionActionType - The action type of a rule. +type FirewallPolicyFilterRuleCollectionActionType string + +const ( + FirewallPolicyFilterRuleCollectionActionTypeAllow FirewallPolicyFilterRuleCollectionActionType = "Allow" + FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = "Deny" +) + +// PossibleFirewallPolicyFilterRuleCollectionActionTypeValues returns the possible values for the FirewallPolicyFilterRuleCollectionActionType const type. +func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { + return []FirewallPolicyFilterRuleCollectionActionType{ + FirewallPolicyFilterRuleCollectionActionTypeAllow, + FirewallPolicyFilterRuleCollectionActionTypeDeny, + } +} + +// FirewallPolicyIDPSQuerySortOrder - Describes if results should be in ascending/descending order +type FirewallPolicyIDPSQuerySortOrder string + +const ( + FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = "Ascending" + FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = "Descending" +) + +// PossibleFirewallPolicyIDPSQuerySortOrderValues returns the possible values for the FirewallPolicyIDPSQuerySortOrder const type. +func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { + return []FirewallPolicyIDPSQuerySortOrder{ + FirewallPolicyIDPSQuerySortOrderAscending, + FirewallPolicyIDPSQuerySortOrderDescending, + } +} + +// FirewallPolicyIDPSSignatureDirection - Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, +// 2 - Bidirectional +type FirewallPolicyIDPSSignatureDirection int32 + +const ( + FirewallPolicyIDPSSignatureDirectionZero FirewallPolicyIDPSSignatureDirection = 0 + FirewallPolicyIDPSSignatureDirectionOne FirewallPolicyIDPSSignatureDirection = 1 + FirewallPolicyIDPSSignatureDirectionTwo FirewallPolicyIDPSSignatureDirection = 2 +) + +// PossibleFirewallPolicyIDPSSignatureDirectionValues returns the possible values for the FirewallPolicyIDPSSignatureDirection const type. +func PossibleFirewallPolicyIDPSSignatureDirectionValues() []FirewallPolicyIDPSSignatureDirection { + return []FirewallPolicyIDPSSignatureDirection{ + FirewallPolicyIDPSSignatureDirectionZero, + FirewallPolicyIDPSSignatureDirectionOne, + FirewallPolicyIDPSSignatureDirectionTwo, + } +} + +// FirewallPolicyIDPSSignatureMode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny +type FirewallPolicyIDPSSignatureMode int32 + +const ( + FirewallPolicyIDPSSignatureModeZero FirewallPolicyIDPSSignatureMode = 0 + FirewallPolicyIDPSSignatureModeOne FirewallPolicyIDPSSignatureMode = 1 + FirewallPolicyIDPSSignatureModeTwo FirewallPolicyIDPSSignatureMode = 2 +) + +// PossibleFirewallPolicyIDPSSignatureModeValues returns the possible values for the FirewallPolicyIDPSSignatureMode const type. +func PossibleFirewallPolicyIDPSSignatureModeValues() []FirewallPolicyIDPSSignatureMode { + return []FirewallPolicyIDPSSignatureMode{ + FirewallPolicyIDPSSignatureModeZero, + FirewallPolicyIDPSSignatureModeOne, + FirewallPolicyIDPSSignatureModeTwo, + } +} + +// FirewallPolicyIDPSSignatureSeverity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High +type FirewallPolicyIDPSSignatureSeverity int32 + +const ( + FirewallPolicyIDPSSignatureSeverityOne FirewallPolicyIDPSSignatureSeverity = 1 + FirewallPolicyIDPSSignatureSeverityTwo FirewallPolicyIDPSSignatureSeverity = 2 + FirewallPolicyIDPSSignatureSeverityThree FirewallPolicyIDPSSignatureSeverity = 3 +) + +// PossibleFirewallPolicyIDPSSignatureSeverityValues returns the possible values for the FirewallPolicyIDPSSignatureSeverity const type. +func PossibleFirewallPolicyIDPSSignatureSeverityValues() []FirewallPolicyIDPSSignatureSeverity { + return []FirewallPolicyIDPSSignatureSeverity{ + FirewallPolicyIDPSSignatureSeverityOne, + FirewallPolicyIDPSSignatureSeverityTwo, + FirewallPolicyIDPSSignatureSeverityThree, + } +} + +// FirewallPolicyIntrusionDetectionProtocol - Possible intrusion detection bypass traffic protocols. +type FirewallPolicyIntrusionDetectionProtocol string + +const ( + FirewallPolicyIntrusionDetectionProtocolANY FirewallPolicyIntrusionDetectionProtocol = "ANY" + FirewallPolicyIntrusionDetectionProtocolICMP FirewallPolicyIntrusionDetectionProtocol = "ICMP" + FirewallPolicyIntrusionDetectionProtocolTCP FirewallPolicyIntrusionDetectionProtocol = "TCP" + FirewallPolicyIntrusionDetectionProtocolUDP FirewallPolicyIntrusionDetectionProtocol = "UDP" +) + +// PossibleFirewallPolicyIntrusionDetectionProtocolValues returns the possible values for the FirewallPolicyIntrusionDetectionProtocol const type. +func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { + return []FirewallPolicyIntrusionDetectionProtocol{ + FirewallPolicyIntrusionDetectionProtocolANY, + FirewallPolicyIntrusionDetectionProtocolICMP, + FirewallPolicyIntrusionDetectionProtocolTCP, + FirewallPolicyIntrusionDetectionProtocolUDP, + } +} + +// FirewallPolicyIntrusionDetectionStateType - Possible state values. +type FirewallPolicyIntrusionDetectionStateType string + +const ( + FirewallPolicyIntrusionDetectionStateTypeAlert FirewallPolicyIntrusionDetectionStateType = "Alert" + FirewallPolicyIntrusionDetectionStateTypeDeny FirewallPolicyIntrusionDetectionStateType = "Deny" + FirewallPolicyIntrusionDetectionStateTypeOff FirewallPolicyIntrusionDetectionStateType = "Off" +) + +// PossibleFirewallPolicyIntrusionDetectionStateTypeValues returns the possible values for the FirewallPolicyIntrusionDetectionStateType const type. +func PossibleFirewallPolicyIntrusionDetectionStateTypeValues() []FirewallPolicyIntrusionDetectionStateType { + return []FirewallPolicyIntrusionDetectionStateType{ + FirewallPolicyIntrusionDetectionStateTypeAlert, + FirewallPolicyIntrusionDetectionStateTypeDeny, + FirewallPolicyIntrusionDetectionStateTypeOff, + } +} + +// FirewallPolicyNatRuleCollectionActionType - The action type of a rule. +type FirewallPolicyNatRuleCollectionActionType string + +const ( + FirewallPolicyNatRuleCollectionActionTypeDNAT FirewallPolicyNatRuleCollectionActionType = "DNAT" +) + +// PossibleFirewallPolicyNatRuleCollectionActionTypeValues returns the possible values for the FirewallPolicyNatRuleCollectionActionType const type. +func PossibleFirewallPolicyNatRuleCollectionActionTypeValues() []FirewallPolicyNatRuleCollectionActionType { + return []FirewallPolicyNatRuleCollectionActionType{ + FirewallPolicyNatRuleCollectionActionTypeDNAT, + } +} + +// FirewallPolicyRuleApplicationProtocolType - The application protocol type of a Rule. +type FirewallPolicyRuleApplicationProtocolType string + +const ( + FirewallPolicyRuleApplicationProtocolTypeHTTP FirewallPolicyRuleApplicationProtocolType = "Http" + FirewallPolicyRuleApplicationProtocolTypeHTTPS FirewallPolicyRuleApplicationProtocolType = "Https" +) + +// PossibleFirewallPolicyRuleApplicationProtocolTypeValues returns the possible values for the FirewallPolicyRuleApplicationProtocolType const type. +func PossibleFirewallPolicyRuleApplicationProtocolTypeValues() []FirewallPolicyRuleApplicationProtocolType { + return []FirewallPolicyRuleApplicationProtocolType{ + FirewallPolicyRuleApplicationProtocolTypeHTTP, + FirewallPolicyRuleApplicationProtocolTypeHTTPS, + } +} + +// FirewallPolicyRuleCollectionType - The type of the rule collection. +type FirewallPolicyRuleCollectionType string + +const ( + FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection FirewallPolicyRuleCollectionType = "FirewallPolicyFilterRuleCollection" + FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection FirewallPolicyRuleCollectionType = "FirewallPolicyNatRuleCollection" +) + +// PossibleFirewallPolicyRuleCollectionTypeValues returns the possible values for the FirewallPolicyRuleCollectionType const type. +func PossibleFirewallPolicyRuleCollectionTypeValues() []FirewallPolicyRuleCollectionType { + return []FirewallPolicyRuleCollectionType{ + FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection, + FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection, + } +} + +// FirewallPolicyRuleNetworkProtocol - The Network protocol of a Rule. +type FirewallPolicyRuleNetworkProtocol string + +const ( + FirewallPolicyRuleNetworkProtocolAny FirewallPolicyRuleNetworkProtocol = "Any" + FirewallPolicyRuleNetworkProtocolICMP FirewallPolicyRuleNetworkProtocol = "ICMP" + FirewallPolicyRuleNetworkProtocolTCP FirewallPolicyRuleNetworkProtocol = "TCP" + FirewallPolicyRuleNetworkProtocolUDP FirewallPolicyRuleNetworkProtocol = "UDP" +) + +// PossibleFirewallPolicyRuleNetworkProtocolValues returns the possible values for the FirewallPolicyRuleNetworkProtocol const type. +func PossibleFirewallPolicyRuleNetworkProtocolValues() []FirewallPolicyRuleNetworkProtocol { + return []FirewallPolicyRuleNetworkProtocol{ + FirewallPolicyRuleNetworkProtocolAny, + FirewallPolicyRuleNetworkProtocolICMP, + FirewallPolicyRuleNetworkProtocolTCP, + FirewallPolicyRuleNetworkProtocolUDP, + } +} + +// FirewallPolicyRuleType - Rule Type. +type FirewallPolicyRuleType string + +const ( + FirewallPolicyRuleTypeApplicationRule FirewallPolicyRuleType = "ApplicationRule" + FirewallPolicyRuleTypeNatRule FirewallPolicyRuleType = "NatRule" + FirewallPolicyRuleTypeNetworkRule FirewallPolicyRuleType = "NetworkRule" +) + +// PossibleFirewallPolicyRuleTypeValues returns the possible values for the FirewallPolicyRuleType const type. +func PossibleFirewallPolicyRuleTypeValues() []FirewallPolicyRuleType { + return []FirewallPolicyRuleType{ + FirewallPolicyRuleTypeApplicationRule, + FirewallPolicyRuleTypeNatRule, + FirewallPolicyRuleTypeNetworkRule, + } +} + +// FirewallPolicySKUTier - Tier of Firewall Policy. +type FirewallPolicySKUTier string + +const ( + FirewallPolicySKUTierBasic FirewallPolicySKUTier = "Basic" + FirewallPolicySKUTierPremium FirewallPolicySKUTier = "Premium" + FirewallPolicySKUTierStandard FirewallPolicySKUTier = "Standard" +) + +// PossibleFirewallPolicySKUTierValues returns the possible values for the FirewallPolicySKUTier const type. +func PossibleFirewallPolicySKUTierValues() []FirewallPolicySKUTier { + return []FirewallPolicySKUTier{ + FirewallPolicySKUTierBasic, + FirewallPolicySKUTierPremium, + FirewallPolicySKUTierStandard, + } +} + +// FlowLogFormatType - The file type of flow log. +type FlowLogFormatType string + +const ( + FlowLogFormatTypeJSON FlowLogFormatType = "JSON" +) + +// PossibleFlowLogFormatTypeValues returns the possible values for the FlowLogFormatType const type. +func PossibleFlowLogFormatTypeValues() []FlowLogFormatType { + return []FlowLogFormatType{ + FlowLogFormatTypeJSON, + } +} + +// GatewayLoadBalancerTunnelInterfaceType - Traffic type of gateway load balancer tunnel interface. +type GatewayLoadBalancerTunnelInterfaceType string + +const ( + GatewayLoadBalancerTunnelInterfaceTypeExternal GatewayLoadBalancerTunnelInterfaceType = "External" + GatewayLoadBalancerTunnelInterfaceTypeInternal GatewayLoadBalancerTunnelInterfaceType = "Internal" + GatewayLoadBalancerTunnelInterfaceTypeNone GatewayLoadBalancerTunnelInterfaceType = "None" +) + +// PossibleGatewayLoadBalancerTunnelInterfaceTypeValues returns the possible values for the GatewayLoadBalancerTunnelInterfaceType const type. +func PossibleGatewayLoadBalancerTunnelInterfaceTypeValues() []GatewayLoadBalancerTunnelInterfaceType { + return []GatewayLoadBalancerTunnelInterfaceType{ + GatewayLoadBalancerTunnelInterfaceTypeExternal, + GatewayLoadBalancerTunnelInterfaceTypeInternal, + GatewayLoadBalancerTunnelInterfaceTypeNone, + } +} + +// GatewayLoadBalancerTunnelProtocol - Protocol of gateway load balancer tunnel interface. +type GatewayLoadBalancerTunnelProtocol string + +const ( + GatewayLoadBalancerTunnelProtocolNative GatewayLoadBalancerTunnelProtocol = "Native" + GatewayLoadBalancerTunnelProtocolNone GatewayLoadBalancerTunnelProtocol = "None" + GatewayLoadBalancerTunnelProtocolVXLAN GatewayLoadBalancerTunnelProtocol = "VXLAN" +) + +// PossibleGatewayLoadBalancerTunnelProtocolValues returns the possible values for the GatewayLoadBalancerTunnelProtocol const type. +func PossibleGatewayLoadBalancerTunnelProtocolValues() []GatewayLoadBalancerTunnelProtocol { + return []GatewayLoadBalancerTunnelProtocol{ + GatewayLoadBalancerTunnelProtocolNative, + GatewayLoadBalancerTunnelProtocolNone, + GatewayLoadBalancerTunnelProtocolVXLAN, + } +} + +// Geo - The Geo for CIDR advertising. Should be an Geo code. +type Geo string + +const ( + GeoAFRI Geo = "AFRI" + GeoAPAC Geo = "APAC" + GeoAQ Geo = "AQ" + GeoEURO Geo = "EURO" + GeoGLOBAL Geo = "GLOBAL" + GeoLATAM Geo = "LATAM" + GeoME Geo = "ME" + GeoNAM Geo = "NAM" + GeoOCEANIA Geo = "OCEANIA" +) + +// PossibleGeoValues returns the possible values for the Geo const type. +func PossibleGeoValues() []Geo { + return []Geo{ + GeoAFRI, + GeoAPAC, + GeoAQ, + GeoEURO, + GeoGLOBAL, + GeoLATAM, + GeoME, + GeoNAM, + GeoOCEANIA, + } +} + +// GroupConnectivity - Group connectivity type. +type GroupConnectivity string + +const ( + GroupConnectivityDirectlyConnected GroupConnectivity = "DirectlyConnected" + GroupConnectivityNone GroupConnectivity = "None" +) + +// PossibleGroupConnectivityValues returns the possible values for the GroupConnectivity const type. +func PossibleGroupConnectivityValues() []GroupConnectivity { + return []GroupConnectivity{ + GroupConnectivityDirectlyConnected, + GroupConnectivityNone, + } +} + +// HTTPConfigurationMethod - The HTTP method to use. +type HTTPConfigurationMethod string + +const ( + HTTPConfigurationMethodGet HTTPConfigurationMethod = "Get" + HTTPConfigurationMethodPost HTTPConfigurationMethod = "Post" +) + +// PossibleHTTPConfigurationMethodValues returns the possible values for the HTTPConfigurationMethod const type. +func PossibleHTTPConfigurationMethodValues() []HTTPConfigurationMethod { + return []HTTPConfigurationMethod{ + HTTPConfigurationMethodGet, + HTTPConfigurationMethodPost, + } +} + +// HTTPMethod - HTTP method. +type HTTPMethod string + +const ( + HTTPMethodGet HTTPMethod = "Get" +) + +// PossibleHTTPMethodValues returns the possible values for the HTTPMethod const type. +func PossibleHTTPMethodValues() []HTTPMethod { + return []HTTPMethod{ + HTTPMethodGet, + } +} + +// HubBgpConnectionStatus - The current state of the VirtualHub to Peer. +type HubBgpConnectionStatus string + +const ( + HubBgpConnectionStatusConnected HubBgpConnectionStatus = "Connected" + HubBgpConnectionStatusConnecting HubBgpConnectionStatus = "Connecting" + HubBgpConnectionStatusNotConnected HubBgpConnectionStatus = "NotConnected" + HubBgpConnectionStatusUnknown HubBgpConnectionStatus = "Unknown" +) + +// PossibleHubBgpConnectionStatusValues returns the possible values for the HubBgpConnectionStatus const type. +func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { + return []HubBgpConnectionStatus{ + HubBgpConnectionStatusConnected, + HubBgpConnectionStatusConnecting, + HubBgpConnectionStatusNotConnected, + HubBgpConnectionStatusUnknown, + } +} + +// HubRoutingPreference - The hub routing preference gateway types +type HubRoutingPreference string + +const ( + HubRoutingPreferenceASPath HubRoutingPreference = "ASPath" + HubRoutingPreferenceExpressRoute HubRoutingPreference = "ExpressRoute" + HubRoutingPreferenceVPNGateway HubRoutingPreference = "VpnGateway" +) + +// PossibleHubRoutingPreferenceValues returns the possible values for the HubRoutingPreference const type. +func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { + return []HubRoutingPreference{ + HubRoutingPreferenceASPath, + HubRoutingPreferenceExpressRoute, + HubRoutingPreferenceVPNGateway, + } +} + +// HubVirtualNetworkConnectionStatus - The current state of the VirtualHub to vnet connection. +type HubVirtualNetworkConnectionStatus string + +const ( + HubVirtualNetworkConnectionStatusConnected HubVirtualNetworkConnectionStatus = "Connected" + HubVirtualNetworkConnectionStatusConnecting HubVirtualNetworkConnectionStatus = "Connecting" + HubVirtualNetworkConnectionStatusNotConnected HubVirtualNetworkConnectionStatus = "NotConnected" + HubVirtualNetworkConnectionStatusUnknown HubVirtualNetworkConnectionStatus = "Unknown" +) + +// PossibleHubVirtualNetworkConnectionStatusValues returns the possible values for the HubVirtualNetworkConnectionStatus const type. +func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { + return []HubVirtualNetworkConnectionStatus{ + HubVirtualNetworkConnectionStatusConnected, + HubVirtualNetworkConnectionStatusConnecting, + HubVirtualNetworkConnectionStatusNotConnected, + HubVirtualNetworkConnectionStatusUnknown, + } +} + +// IPAllocationMethod - IP address allocation method. +type IPAllocationMethod string + +const ( + IPAllocationMethodDynamic IPAllocationMethod = "Dynamic" + IPAllocationMethodStatic IPAllocationMethod = "Static" +) + +// PossibleIPAllocationMethodValues returns the possible values for the IPAllocationMethod const type. +func PossibleIPAllocationMethodValues() []IPAllocationMethod { + return []IPAllocationMethod{ + IPAllocationMethodDynamic, + IPAllocationMethodStatic, + } +} + +// IPAllocationType - IpAllocation type. +type IPAllocationType string + +const ( + IPAllocationTypeHypernet IPAllocationType = "Hypernet" + IPAllocationTypeUndefined IPAllocationType = "Undefined" +) + +// PossibleIPAllocationTypeValues returns the possible values for the IPAllocationType const type. +func PossibleIPAllocationTypeValues() []IPAllocationType { + return []IPAllocationType{ + IPAllocationTypeHypernet, + IPAllocationTypeUndefined, + } +} + +// IPFlowProtocol - Protocol to be verified on. +type IPFlowProtocol string + +const ( + IPFlowProtocolTCP IPFlowProtocol = "TCP" + IPFlowProtocolUDP IPFlowProtocol = "UDP" +) + +// PossibleIPFlowProtocolValues returns the possible values for the IPFlowProtocol const type. +func PossibleIPFlowProtocolValues() []IPFlowProtocol { + return []IPFlowProtocol{ + IPFlowProtocolTCP, + IPFlowProtocolUDP, + } +} + +// IPSecEncryption - The IPSec encryption algorithm (IKE phase 1). +type IPSecEncryption string + +const ( + IPSecEncryptionAES128 IPSecEncryption = "AES128" + IPSecEncryptionAES192 IPSecEncryption = "AES192" + IPSecEncryptionAES256 IPSecEncryption = "AES256" + IPSecEncryptionDES IPSecEncryption = "DES" + IPSecEncryptionDES3 IPSecEncryption = "DES3" + IPSecEncryptionGCMAES128 IPSecEncryption = "GCMAES128" + IPSecEncryptionGCMAES192 IPSecEncryption = "GCMAES192" + IPSecEncryptionGCMAES256 IPSecEncryption = "GCMAES256" + IPSecEncryptionNone IPSecEncryption = "None" +) + +// PossibleIPSecEncryptionValues returns the possible values for the IPSecEncryption const type. +func PossibleIPSecEncryptionValues() []IPSecEncryption { + return []IPSecEncryption{ + IPSecEncryptionAES128, + IPSecEncryptionAES192, + IPSecEncryptionAES256, + IPSecEncryptionDES, + IPSecEncryptionDES3, + IPSecEncryptionGCMAES128, + IPSecEncryptionGCMAES192, + IPSecEncryptionGCMAES256, + IPSecEncryptionNone, + } +} + +// IPSecIntegrity - The IPSec integrity algorithm (IKE phase 1). +type IPSecIntegrity string + +const ( + IPSecIntegrityGCMAES128 IPSecIntegrity = "GCMAES128" + IPSecIntegrityGCMAES192 IPSecIntegrity = "GCMAES192" + IPSecIntegrityGCMAES256 IPSecIntegrity = "GCMAES256" + IPSecIntegrityMD5 IPSecIntegrity = "MD5" + IPSecIntegritySHA1 IPSecIntegrity = "SHA1" + IPSecIntegritySHA256 IPSecIntegrity = "SHA256" +) + +// PossibleIPSecIntegrityValues returns the possible values for the IPSecIntegrity const type. +func PossibleIPSecIntegrityValues() []IPSecIntegrity { + return []IPSecIntegrity{ + IPSecIntegrityGCMAES128, + IPSecIntegrityGCMAES192, + IPSecIntegrityGCMAES256, + IPSecIntegrityMD5, + IPSecIntegritySHA1, + IPSecIntegritySHA256, + } +} + +// IPVersion - IP address version. +type IPVersion string + +const ( + IPVersionIPv4 IPVersion = "IPv4" + IPVersionIPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns the possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{ + IPVersionIPv4, + IPVersionIPv6, + } +} + +// IkeEncryption - The IKE encryption algorithm (IKE phase 2). +type IkeEncryption string + +const ( + IkeEncryptionAES128 IkeEncryption = "AES128" + IkeEncryptionAES192 IkeEncryption = "AES192" + IkeEncryptionAES256 IkeEncryption = "AES256" + IkeEncryptionDES IkeEncryption = "DES" + IkeEncryptionDES3 IkeEncryption = "DES3" + IkeEncryptionGCMAES128 IkeEncryption = "GCMAES128" + IkeEncryptionGCMAES256 IkeEncryption = "GCMAES256" +) + +// PossibleIkeEncryptionValues returns the possible values for the IkeEncryption const type. +func PossibleIkeEncryptionValues() []IkeEncryption { + return []IkeEncryption{ + IkeEncryptionAES128, + IkeEncryptionAES192, + IkeEncryptionAES256, + IkeEncryptionDES, + IkeEncryptionDES3, + IkeEncryptionGCMAES128, + IkeEncryptionGCMAES256, + } +} + +// IkeIntegrity - The IKE integrity algorithm (IKE phase 2). +type IkeIntegrity string + +const ( + IkeIntegrityGCMAES128 IkeIntegrity = "GCMAES128" + IkeIntegrityGCMAES256 IkeIntegrity = "GCMAES256" + IkeIntegrityMD5 IkeIntegrity = "MD5" + IkeIntegritySHA1 IkeIntegrity = "SHA1" + IkeIntegritySHA256 IkeIntegrity = "SHA256" + IkeIntegritySHA384 IkeIntegrity = "SHA384" +) + +// PossibleIkeIntegrityValues returns the possible values for the IkeIntegrity const type. +func PossibleIkeIntegrityValues() []IkeIntegrity { + return []IkeIntegrity{ + IkeIntegrityGCMAES128, + IkeIntegrityGCMAES256, + IkeIntegrityMD5, + IkeIntegritySHA1, + IkeIntegritySHA256, + IkeIntegritySHA384, + } +} + +// InboundSecurityRulesProtocol - Protocol. This should be either TCP or UDP. +type InboundSecurityRulesProtocol string + +const ( + InboundSecurityRulesProtocolTCP InboundSecurityRulesProtocol = "TCP" + InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = "UDP" +) + +// PossibleInboundSecurityRulesProtocolValues returns the possible values for the InboundSecurityRulesProtocol const type. +func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { + return []InboundSecurityRulesProtocol{ + InboundSecurityRulesProtocolTCP, + InboundSecurityRulesProtocolUDP, + } +} + +// IsGlobal - Flag if global mesh is supported. +type IsGlobal string + +const ( + IsGlobalFalse IsGlobal = "False" + IsGlobalTrue IsGlobal = "True" +) + +// PossibleIsGlobalValues returns the possible values for the IsGlobal const type. +func PossibleIsGlobalValues() []IsGlobal { + return []IsGlobal{ + IsGlobalFalse, + IsGlobalTrue, + } +} + +// IsWorkloadProtected - Value indicating whether the IP address is DDoS workload protected or not. +type IsWorkloadProtected string + +const ( + IsWorkloadProtectedFalse IsWorkloadProtected = "False" + IsWorkloadProtectedTrue IsWorkloadProtected = "True" +) + +// PossibleIsWorkloadProtectedValues returns the possible values for the IsWorkloadProtected const type. +func PossibleIsWorkloadProtectedValues() []IsWorkloadProtected { + return []IsWorkloadProtected{ + IsWorkloadProtectedFalse, + IsWorkloadProtectedTrue, + } +} + +// IssueType - The type of issue. +type IssueType string + +const ( + IssueTypeAgentStopped IssueType = "AgentStopped" + IssueTypeDNSResolution IssueType = "DnsResolution" + IssueTypeGuestFirewall IssueType = "GuestFirewall" + IssueTypeNetworkSecurityRule IssueType = "NetworkSecurityRule" + IssueTypePlatform IssueType = "Platform" + IssueTypePortThrottled IssueType = "PortThrottled" + IssueTypeSocketBind IssueType = "SocketBind" + IssueTypeUnknown IssueType = "Unknown" + IssueTypeUserDefinedRoute IssueType = "UserDefinedRoute" +) + +// PossibleIssueTypeValues returns the possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{ + IssueTypeAgentStopped, + IssueTypeDNSResolution, + IssueTypeGuestFirewall, + IssueTypeNetworkSecurityRule, + IssueTypePlatform, + IssueTypePortThrottled, + IssueTypeSocketBind, + IssueTypeUnknown, + IssueTypeUserDefinedRoute, + } +} + +// LoadBalancerBackendAddressAdminState - A list of administrative states which once set can override health probe so that +// Load Balancer will always forward new connections to backend, or deny new connections and reset existing connections. +type LoadBalancerBackendAddressAdminState string + +const ( + LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = "Down" + LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = "Drain" + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = "None" + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = "Up" +) + +// PossibleLoadBalancerBackendAddressAdminStateValues returns the possible values for the LoadBalancerBackendAddressAdminState const type. +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return []LoadBalancerBackendAddressAdminState{ + LoadBalancerBackendAddressAdminStateDown, + LoadBalancerBackendAddressAdminStateDrain, + LoadBalancerBackendAddressAdminStateNone, + LoadBalancerBackendAddressAdminStateUp, + } +} + +// LoadBalancerOutboundRuleProtocol - The protocol for the outbound rule in load balancer. +type LoadBalancerOutboundRuleProtocol string + +const ( + LoadBalancerOutboundRuleProtocolAll LoadBalancerOutboundRuleProtocol = "All" + LoadBalancerOutboundRuleProtocolTCP LoadBalancerOutboundRuleProtocol = "Tcp" + LoadBalancerOutboundRuleProtocolUDP LoadBalancerOutboundRuleProtocol = "Udp" +) + +// PossibleLoadBalancerOutboundRuleProtocolValues returns the possible values for the LoadBalancerOutboundRuleProtocol const type. +func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { + return []LoadBalancerOutboundRuleProtocol{ + LoadBalancerOutboundRuleProtocolAll, + LoadBalancerOutboundRuleProtocolTCP, + LoadBalancerOutboundRuleProtocolUDP, + } +} + +// LoadBalancerSKUName - Name of a load balancer SKU. +type LoadBalancerSKUName string + +const ( + LoadBalancerSKUNameBasic LoadBalancerSKUName = "Basic" + LoadBalancerSKUNameGateway LoadBalancerSKUName = "Gateway" + LoadBalancerSKUNameStandard LoadBalancerSKUName = "Standard" +) + +// PossibleLoadBalancerSKUNameValues returns the possible values for the LoadBalancerSKUName const type. +func PossibleLoadBalancerSKUNameValues() []LoadBalancerSKUName { + return []LoadBalancerSKUName{ + LoadBalancerSKUNameBasic, + LoadBalancerSKUNameGateway, + LoadBalancerSKUNameStandard, + } +} + +// LoadBalancerSKUTier - Tier of a load balancer SKU. +type LoadBalancerSKUTier string + +const ( + LoadBalancerSKUTierGlobal LoadBalancerSKUTier = "Global" + LoadBalancerSKUTierRegional LoadBalancerSKUTier = "Regional" +) + +// PossibleLoadBalancerSKUTierValues returns the possible values for the LoadBalancerSKUTier const type. +func PossibleLoadBalancerSKUTierValues() []LoadBalancerSKUTier { + return []LoadBalancerSKUTier{ + LoadBalancerSKUTierGlobal, + LoadBalancerSKUTierRegional, + } +} + +// LoadDistribution - The load distribution policy for this rule. +type LoadDistribution string + +const ( + LoadDistributionDefault LoadDistribution = "Default" + LoadDistributionSourceIP LoadDistribution = "SourceIP" + LoadDistributionSourceIPProtocol LoadDistribution = "SourceIPProtocol" +) + +// PossibleLoadDistributionValues returns the possible values for the LoadDistribution const type. +func PossibleLoadDistributionValues() []LoadDistribution { + return []LoadDistribution{ + LoadDistributionDefault, + LoadDistributionSourceIP, + LoadDistributionSourceIPProtocol, + } +} + +// ManagedRuleEnabledState - The state of the managed rule. Defaults to Disabled if not specified. +type ManagedRuleEnabledState string + +const ( + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +// PossibleManagedRuleEnabledStateValues returns the possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ + ManagedRuleEnabledStateDisabled, + ManagedRuleEnabledStateEnabled, + } +} + +// NatGatewaySKUName - Name of Nat Gateway SKU. +type NatGatewaySKUName string + +const ( + NatGatewaySKUNameStandard NatGatewaySKUName = "Standard" +) + +// PossibleNatGatewaySKUNameValues returns the possible values for the NatGatewaySKUName const type. +func PossibleNatGatewaySKUNameValues() []NatGatewaySKUName { + return []NatGatewaySKUName{ + NatGatewaySKUNameStandard, + } +} + +// NetworkIntentPolicyBasedService - Network intent policy based services. +type NetworkIntentPolicyBasedService string + +const ( + NetworkIntentPolicyBasedServiceAll NetworkIntentPolicyBasedService = "All" + NetworkIntentPolicyBasedServiceAllowRulesOnly NetworkIntentPolicyBasedService = "AllowRulesOnly" + NetworkIntentPolicyBasedServiceNone NetworkIntentPolicyBasedService = "None" +) + +// PossibleNetworkIntentPolicyBasedServiceValues returns the possible values for the NetworkIntentPolicyBasedService const type. +func PossibleNetworkIntentPolicyBasedServiceValues() []NetworkIntentPolicyBasedService { + return []NetworkIntentPolicyBasedService{ + NetworkIntentPolicyBasedServiceAll, + NetworkIntentPolicyBasedServiceAllowRulesOnly, + NetworkIntentPolicyBasedServiceNone, + } +} + +// NetworkInterfaceAuxiliaryMode - Auxiliary mode of Network Interface resource. +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeMaxConnections NetworkInterfaceAuxiliaryMode = "MaxConnections" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +// PossibleNetworkInterfaceAuxiliaryModeValues returns the possible values for the NetworkInterfaceAuxiliaryMode const type. +func PossibleNetworkInterfaceAuxiliaryModeValues() []NetworkInterfaceAuxiliaryMode { + return []NetworkInterfaceAuxiliaryMode{ + NetworkInterfaceAuxiliaryModeFloating, + NetworkInterfaceAuxiliaryModeMaxConnections, + NetworkInterfaceAuxiliaryModeNone, + } +} + +// NetworkInterfaceMigrationPhase - Migration phase of Network Interface resource. +type NetworkInterfaceMigrationPhase string + +const ( + NetworkInterfaceMigrationPhaseAbort NetworkInterfaceMigrationPhase = "Abort" + NetworkInterfaceMigrationPhaseCommit NetworkInterfaceMigrationPhase = "Commit" + NetworkInterfaceMigrationPhaseCommitted NetworkInterfaceMigrationPhase = "Committed" + NetworkInterfaceMigrationPhaseNone NetworkInterfaceMigrationPhase = "None" + NetworkInterfaceMigrationPhasePrepare NetworkInterfaceMigrationPhase = "Prepare" +) + +// PossibleNetworkInterfaceMigrationPhaseValues returns the possible values for the NetworkInterfaceMigrationPhase const type. +func PossibleNetworkInterfaceMigrationPhaseValues() []NetworkInterfaceMigrationPhase { + return []NetworkInterfaceMigrationPhase{ + NetworkInterfaceMigrationPhaseAbort, + NetworkInterfaceMigrationPhaseCommit, + NetworkInterfaceMigrationPhaseCommitted, + NetworkInterfaceMigrationPhaseNone, + NetworkInterfaceMigrationPhasePrepare, + } +} + +// NetworkInterfaceNicType - Type of Network Interface resource. +type NetworkInterfaceNicType string + +const ( + NetworkInterfaceNicTypeElastic NetworkInterfaceNicType = "Elastic" + NetworkInterfaceNicTypeStandard NetworkInterfaceNicType = "Standard" +) + +// PossibleNetworkInterfaceNicTypeValues returns the possible values for the NetworkInterfaceNicType const type. +func PossibleNetworkInterfaceNicTypeValues() []NetworkInterfaceNicType { + return []NetworkInterfaceNicType{ + NetworkInterfaceNicTypeElastic, + NetworkInterfaceNicTypeStandard, + } +} + +// NetworkOperationStatus - Status of the Azure async operation. +type NetworkOperationStatus string + +const ( + NetworkOperationStatusFailed NetworkOperationStatus = "Failed" + NetworkOperationStatusInProgress NetworkOperationStatus = "InProgress" + NetworkOperationStatusSucceeded NetworkOperationStatus = "Succeeded" +) + +// PossibleNetworkOperationStatusValues returns the possible values for the NetworkOperationStatus const type. +func PossibleNetworkOperationStatusValues() []NetworkOperationStatus { + return []NetworkOperationStatus{ + NetworkOperationStatusFailed, + NetworkOperationStatusInProgress, + NetworkOperationStatusSucceeded, + } +} + +// NextHopType - Next hop type. +type NextHopType string + +const ( + NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" + NextHopTypeInternet NextHopType = "Internet" + NextHopTypeNone NextHopType = "None" + NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" + NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" + NextHopTypeVnetLocal NextHopType = "VnetLocal" +) + +// PossibleNextHopTypeValues returns the possible values for the NextHopType const type. +func PossibleNextHopTypeValues() []NextHopType { + return []NextHopType{ + NextHopTypeHyperNetGateway, + NextHopTypeInternet, + NextHopTypeNone, + NextHopTypeVirtualAppliance, + NextHopTypeVirtualNetworkGateway, + NextHopTypeVnetLocal, + } +} + +// NextStep - Supported next step behaviors after a rule is applied to a matched route +type NextStep string + +const ( + NextStepContinue NextStep = "Continue" + NextStepTerminate NextStep = "Terminate" + NextStepUnknown NextStep = "Unknown" +) + +// PossibleNextStepValues returns the possible values for the NextStep const type. +func PossibleNextStepValues() []NextStep { + return []NextStep{ + NextStepContinue, + NextStepTerminate, + NextStepUnknown, + } +} + +// OfficeTrafficCategory - The office traffic category. +type OfficeTrafficCategory string + +const ( + OfficeTrafficCategoryAll OfficeTrafficCategory = "All" + OfficeTrafficCategoryNone OfficeTrafficCategory = "None" + OfficeTrafficCategoryOptimize OfficeTrafficCategory = "Optimize" + OfficeTrafficCategoryOptimizeAndAllow OfficeTrafficCategory = "OptimizeAndAllow" +) + +// PossibleOfficeTrafficCategoryValues returns the possible values for the OfficeTrafficCategory const type. +func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { + return []OfficeTrafficCategory{ + OfficeTrafficCategoryAll, + OfficeTrafficCategoryNone, + OfficeTrafficCategoryOptimize, + OfficeTrafficCategoryOptimizeAndAllow, + } +} + +// Origin - The origin of the issue. +type Origin string + +const ( + OriginInbound Origin = "Inbound" + OriginLocal Origin = "Local" + OriginOutbound Origin = "Outbound" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginInbound, + OriginLocal, + OriginOutbound, + } +} + +// OutputType - Connection monitor output destination type. Currently, only "Workspace" is supported. +type OutputType string + +const ( + OutputTypeWorkspace OutputType = "Workspace" +) + +// PossibleOutputTypeValues returns the possible values for the OutputType const type. +func PossibleOutputTypeValues() []OutputType { + return []OutputType{ + OutputTypeWorkspace, + } +} + +// OwaspCrsExclusionEntryMatchVariable - The variable to be excluded. +type OwaspCrsExclusionEntryMatchVariable string + +const ( + OwaspCrsExclusionEntryMatchVariableRequestArgKeys OwaspCrsExclusionEntryMatchVariable = "RequestArgKeys" + OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" + OwaspCrsExclusionEntryMatchVariableRequestArgValues OwaspCrsExclusionEntryMatchVariable = "RequestArgValues" + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys OwaspCrsExclusionEntryMatchVariable = "RequestCookieKeys" + OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" + OwaspCrsExclusionEntryMatchVariableRequestCookieValues OwaspCrsExclusionEntryMatchVariable = "RequestCookieValues" + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys OwaspCrsExclusionEntryMatchVariable = "RequestHeaderKeys" + OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues OwaspCrsExclusionEntryMatchVariable = "RequestHeaderValues" +) + +// PossibleOwaspCrsExclusionEntryMatchVariableValues returns the possible values for the OwaspCrsExclusionEntryMatchVariable const type. +func PossibleOwaspCrsExclusionEntryMatchVariableValues() []OwaspCrsExclusionEntryMatchVariable { + return []OwaspCrsExclusionEntryMatchVariable{ + OwaspCrsExclusionEntryMatchVariableRequestArgKeys, + OwaspCrsExclusionEntryMatchVariableRequestArgNames, + OwaspCrsExclusionEntryMatchVariableRequestArgValues, + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys, + OwaspCrsExclusionEntryMatchVariableRequestCookieNames, + OwaspCrsExclusionEntryMatchVariableRequestCookieValues, + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys, + OwaspCrsExclusionEntryMatchVariableRequestHeaderNames, + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues, + } +} + +// OwaspCrsExclusionEntrySelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which +// elements in the collection this exclusion applies to. +type OwaspCrsExclusionEntrySelectorMatchOperator string + +const ( + OwaspCrsExclusionEntrySelectorMatchOperatorContains OwaspCrsExclusionEntrySelectorMatchOperator = "Contains" + OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith OwaspCrsExclusionEntrySelectorMatchOperator = "EndsWith" + OwaspCrsExclusionEntrySelectorMatchOperatorEquals OwaspCrsExclusionEntrySelectorMatchOperator = "Equals" + OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny OwaspCrsExclusionEntrySelectorMatchOperator = "EqualsAny" + OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith OwaspCrsExclusionEntrySelectorMatchOperator = "StartsWith" +) + +// PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues returns the possible values for the OwaspCrsExclusionEntrySelectorMatchOperator const type. +func PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues() []OwaspCrsExclusionEntrySelectorMatchOperator { + return []OwaspCrsExclusionEntrySelectorMatchOperator{ + OwaspCrsExclusionEntrySelectorMatchOperatorContains, + OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith, + OwaspCrsExclusionEntrySelectorMatchOperatorEquals, + OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny, + OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith, + } +} + +// PacketCaptureTargetType - Target type of the resource provided. +type PacketCaptureTargetType string + +const ( + PacketCaptureTargetTypeAzureVM PacketCaptureTargetType = "AzureVM" + PacketCaptureTargetTypeAzureVMSS PacketCaptureTargetType = "AzureVMSS" +) + +// PossiblePacketCaptureTargetTypeValues returns the possible values for the PacketCaptureTargetType const type. +func PossiblePacketCaptureTargetTypeValues() []PacketCaptureTargetType { + return []PacketCaptureTargetType{ + PacketCaptureTargetTypeAzureVM, + PacketCaptureTargetTypeAzureVMSS, + } +} + +type PcError string + +const ( + PcErrorAgentStopped PcError = "AgentStopped" + PcErrorCaptureFailed PcError = "CaptureFailed" + PcErrorInternalError PcError = "InternalError" + PcErrorLocalFileFailed PcError = "LocalFileFailed" + PcErrorStorageFailed PcError = "StorageFailed" +) + +// PossiblePcErrorValues returns the possible values for the PcError const type. +func PossiblePcErrorValues() []PcError { + return []PcError{ + PcErrorAgentStopped, + PcErrorCaptureFailed, + PcErrorInternalError, + PcErrorLocalFileFailed, + PcErrorStorageFailed, + } +} + +// PcProtocol - Protocol to be filtered on. +type PcProtocol string + +const ( + PcProtocolAny PcProtocol = "Any" + PcProtocolTCP PcProtocol = "TCP" + PcProtocolUDP PcProtocol = "UDP" +) + +// PossiblePcProtocolValues returns the possible values for the PcProtocol const type. +func PossiblePcProtocolValues() []PcProtocol { + return []PcProtocol{ + PcProtocolAny, + PcProtocolTCP, + PcProtocolUDP, + } +} + +// PcStatus - The status of the packet capture session. +type PcStatus string + +const ( + PcStatusError PcStatus = "Error" + PcStatusNotStarted PcStatus = "NotStarted" + PcStatusRunning PcStatus = "Running" + PcStatusStopped PcStatus = "Stopped" + PcStatusUnknown PcStatus = "Unknown" +) + +// PossiblePcStatusValues returns the possible values for the PcStatus const type. +func PossiblePcStatusValues() []PcStatus { + return []PcStatus{ + PcStatusError, + PcStatusNotStarted, + PcStatusRunning, + PcStatusStopped, + PcStatusUnknown, + } +} + +// PfsGroup - The Pfs Groups used in IKE Phase 2 for new child SA. +type PfsGroup string + +const ( + PfsGroupECP256 PfsGroup = "ECP256" + PfsGroupECP384 PfsGroup = "ECP384" + PfsGroupNone PfsGroup = "None" + PfsGroupPFS1 PfsGroup = "PFS1" + PfsGroupPFS14 PfsGroup = "PFS14" + PfsGroupPFS2 PfsGroup = "PFS2" + PfsGroupPFS2048 PfsGroup = "PFS2048" + PfsGroupPFS24 PfsGroup = "PFS24" + PfsGroupPFSMM PfsGroup = "PFSMM" +) + +// PossiblePfsGroupValues returns the possible values for the PfsGroup const type. +func PossiblePfsGroupValues() []PfsGroup { + return []PfsGroup{ + PfsGroupECP256, + PfsGroupECP384, + PfsGroupNone, + PfsGroupPFS1, + PfsGroupPFS14, + PfsGroupPFS2, + PfsGroupPFS2048, + PfsGroupPFS24, + PfsGroupPFSMM, + } +} + +// PreferredIPVersion - The preferred IP version to use in test evaluation. The connection monitor may choose to use a different +// version depending on other parameters. +type PreferredIPVersion string + +const ( + PreferredIPVersionIPv4 PreferredIPVersion = "IPv4" + PreferredIPVersionIPv6 PreferredIPVersion = "IPv6" +) + +// PossiblePreferredIPVersionValues returns the possible values for the PreferredIPVersion const type. +func PossiblePreferredIPVersionValues() []PreferredIPVersion { + return []PreferredIPVersion{ + PreferredIPVersionIPv4, + PreferredIPVersionIPv6, + } +} + +// PreferredRoutingGateway - The preferred routing gateway types +type PreferredRoutingGateway string + +const ( + PreferredRoutingGatewayExpressRoute PreferredRoutingGateway = "ExpressRoute" + PreferredRoutingGatewayNone PreferredRoutingGateway = "None" + PreferredRoutingGatewayVPNGateway PreferredRoutingGateway = "VpnGateway" +) + +// PossiblePreferredRoutingGatewayValues returns the possible values for the PreferredRoutingGateway const type. +func PossiblePreferredRoutingGatewayValues() []PreferredRoutingGateway { + return []PreferredRoutingGateway{ + PreferredRoutingGatewayExpressRoute, + PreferredRoutingGatewayNone, + PreferredRoutingGatewayVPNGateway, + } +} + +// ProbeProtocol - The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. +// If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required +// for the probe to be successful. +type ProbeProtocol string + +const ( + ProbeProtocolHTTP ProbeProtocol = "Http" + ProbeProtocolHTTPS ProbeProtocol = "Https" + ProbeProtocolTCP ProbeProtocol = "Tcp" +) + +// PossibleProbeProtocolValues returns the possible values for the ProbeProtocol const type. +func PossibleProbeProtocolValues() []ProbeProtocol { + return []ProbeProtocol{ + ProbeProtocolHTTP, + ProbeProtocolHTTPS, + ProbeProtocolTCP, + } +} + +// ProcessorArchitecture - VPN client Processor Architecture. +type ProcessorArchitecture string + +const ( + ProcessorArchitectureAmd64 ProcessorArchitecture = "Amd64" + ProcessorArchitectureX86 ProcessorArchitecture = "X86" +) + +// PossibleProcessorArchitectureValues returns the possible values for the ProcessorArchitecture const type. +func PossibleProcessorArchitectureValues() []ProcessorArchitecture { + return []ProcessorArchitecture{ + ProcessorArchitectureAmd64, + ProcessorArchitectureX86, + } +} + +// Protocol - Network protocol. +type Protocol string + +const ( + ProtocolHTTP Protocol = "Http" + ProtocolHTTPS Protocol = "Https" + ProtocolIcmp Protocol = "Icmp" + ProtocolTCP Protocol = "Tcp" +) + +// PossibleProtocolValues returns the possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ + ProtocolHTTP, + ProtocolHTTPS, + ProtocolIcmp, + ProtocolTCP, + } +} + +// ProtocolType - RNM supported protocol types. +type ProtocolType string + +const ( + ProtocolTypeAh ProtocolType = "Ah" + ProtocolTypeAll ProtocolType = "All" + ProtocolTypeDoNotUse ProtocolType = "DoNotUse" + ProtocolTypeEsp ProtocolType = "Esp" + ProtocolTypeGre ProtocolType = "Gre" + ProtocolTypeIcmp ProtocolType = "Icmp" + ProtocolTypeTCP ProtocolType = "Tcp" + ProtocolTypeUDP ProtocolType = "Udp" + ProtocolTypeVxlan ProtocolType = "Vxlan" +) + +// PossibleProtocolTypeValues returns the possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ + ProtocolTypeAh, + ProtocolTypeAll, + ProtocolTypeDoNotUse, + ProtocolTypeEsp, + ProtocolTypeGre, + ProtocolTypeIcmp, + ProtocolTypeTCP, + ProtocolTypeUDP, + ProtocolTypeVxlan, + } +} + +// ProvisioningState - The current provisioning state. +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// PublicIPAddressMigrationPhase - Migration phase of Public IP Address. +type PublicIPAddressMigrationPhase string + +const ( + PublicIPAddressMigrationPhaseAbort PublicIPAddressMigrationPhase = "Abort" + PublicIPAddressMigrationPhaseCommit PublicIPAddressMigrationPhase = "Commit" + PublicIPAddressMigrationPhaseCommitted PublicIPAddressMigrationPhase = "Committed" + PublicIPAddressMigrationPhaseNone PublicIPAddressMigrationPhase = "None" + PublicIPAddressMigrationPhasePrepare PublicIPAddressMigrationPhase = "Prepare" +) + +// PossiblePublicIPAddressMigrationPhaseValues returns the possible values for the PublicIPAddressMigrationPhase const type. +func PossiblePublicIPAddressMigrationPhaseValues() []PublicIPAddressMigrationPhase { + return []PublicIPAddressMigrationPhase{ + PublicIPAddressMigrationPhaseAbort, + PublicIPAddressMigrationPhaseCommit, + PublicIPAddressMigrationPhaseCommitted, + PublicIPAddressMigrationPhaseNone, + PublicIPAddressMigrationPhasePrepare, + } +} + +// PublicIPAddressSKUName - Name of a public IP address SKU. +type PublicIPAddressSKUName string + +const ( + PublicIPAddressSKUNameBasic PublicIPAddressSKUName = "Basic" + PublicIPAddressSKUNameStandard PublicIPAddressSKUName = "Standard" +) + +// PossiblePublicIPAddressSKUNameValues returns the possible values for the PublicIPAddressSKUName const type. +func PossiblePublicIPAddressSKUNameValues() []PublicIPAddressSKUName { + return []PublicIPAddressSKUName{ + PublicIPAddressSKUNameBasic, + PublicIPAddressSKUNameStandard, + } +} + +// PublicIPAddressSKUTier - Tier of a public IP address SKU. +type PublicIPAddressSKUTier string + +const ( + PublicIPAddressSKUTierGlobal PublicIPAddressSKUTier = "Global" + PublicIPAddressSKUTierRegional PublicIPAddressSKUTier = "Regional" +) + +// PossiblePublicIPAddressSKUTierValues returns the possible values for the PublicIPAddressSKUTier const type. +func PossiblePublicIPAddressSKUTierValues() []PublicIPAddressSKUTier { + return []PublicIPAddressSKUTier{ + PublicIPAddressSKUTierGlobal, + PublicIPAddressSKUTierRegional, + } +} + +// PublicIPPrefixSKUName - Name of a public IP prefix SKU. +type PublicIPPrefixSKUName string + +const ( + PublicIPPrefixSKUNameStandard PublicIPPrefixSKUName = "Standard" +) + +// PossiblePublicIPPrefixSKUNameValues returns the possible values for the PublicIPPrefixSKUName const type. +func PossiblePublicIPPrefixSKUNameValues() []PublicIPPrefixSKUName { + return []PublicIPPrefixSKUName{ + PublicIPPrefixSKUNameStandard, + } +} + +// PublicIPPrefixSKUTier - Tier of a public IP prefix SKU. +type PublicIPPrefixSKUTier string + +const ( + PublicIPPrefixSKUTierGlobal PublicIPPrefixSKUTier = "Global" + PublicIPPrefixSKUTierRegional PublicIPPrefixSKUTier = "Regional" +) + +// PossiblePublicIPPrefixSKUTierValues returns the possible values for the PublicIPPrefixSKUTier const type. +func PossiblePublicIPPrefixSKUTierValues() []PublicIPPrefixSKUTier { + return []PublicIPPrefixSKUTier{ + PublicIPPrefixSKUTierGlobal, + PublicIPPrefixSKUTierRegional, + } +} + +// ResourceIdentityType - The type of identity used for the resource. 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 virtual machine. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeNone ResourceIdentityType = "None" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeNone, + } +} + +// RouteFilterRuleType - The rule type of the rule. +type RouteFilterRuleType string + +const ( + RouteFilterRuleTypeCommunity RouteFilterRuleType = "Community" +) + +// PossibleRouteFilterRuleTypeValues returns the possible values for the RouteFilterRuleType const type. +func PossibleRouteFilterRuleTypeValues() []RouteFilterRuleType { + return []RouteFilterRuleType{ + RouteFilterRuleTypeCommunity, + } +} + +// RouteMapActionType - Kind of actions which can be taken on a matched route. Add, Replace, Remove refer to parameters on +// the route, like community or prefix +type RouteMapActionType string + +const ( + RouteMapActionTypeAdd RouteMapActionType = "Add" + RouteMapActionTypeDrop RouteMapActionType = "Drop" + RouteMapActionTypeRemove RouteMapActionType = "Remove" + RouteMapActionTypeReplace RouteMapActionType = "Replace" + RouteMapActionTypeUnknown RouteMapActionType = "Unknown" +) + +// PossibleRouteMapActionTypeValues returns the possible values for the RouteMapActionType const type. +func PossibleRouteMapActionTypeValues() []RouteMapActionType { + return []RouteMapActionType{ + RouteMapActionTypeAdd, + RouteMapActionTypeDrop, + RouteMapActionTypeRemove, + RouteMapActionTypeReplace, + RouteMapActionTypeUnknown, + } +} + +// RouteMapMatchCondition - Match condition to apply RouteMap rules. +type RouteMapMatchCondition string + +const ( + RouteMapMatchConditionContains RouteMapMatchCondition = "Contains" + RouteMapMatchConditionEquals RouteMapMatchCondition = "Equals" + RouteMapMatchConditionNotContains RouteMapMatchCondition = "NotContains" + RouteMapMatchConditionNotEquals RouteMapMatchCondition = "NotEquals" + RouteMapMatchConditionUnknown RouteMapMatchCondition = "Unknown" +) + +// PossibleRouteMapMatchConditionValues returns the possible values for the RouteMapMatchCondition const type. +func PossibleRouteMapMatchConditionValues() []RouteMapMatchCondition { + return []RouteMapMatchCondition{ + RouteMapMatchConditionContains, + RouteMapMatchConditionEquals, + RouteMapMatchConditionNotContains, + RouteMapMatchConditionNotEquals, + RouteMapMatchConditionUnknown, + } +} + +// RouteNextHopType - The type of Azure hop the packet should be sent to. +type RouteNextHopType string + +const ( + RouteNextHopTypeInternet RouteNextHopType = "Internet" + RouteNextHopTypeNone RouteNextHopType = "None" + RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" + RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" + RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" +) + +// PossibleRouteNextHopTypeValues returns the possible values for the RouteNextHopType const type. +func PossibleRouteNextHopTypeValues() []RouteNextHopType { + return []RouteNextHopType{ + RouteNextHopTypeInternet, + RouteNextHopTypeNone, + RouteNextHopTypeVirtualAppliance, + RouteNextHopTypeVirtualNetworkGateway, + RouteNextHopTypeVnetLocal, + } +} + +// RoutingState - The current routing state of the VirtualHub. +type RoutingState string + +const ( + RoutingStateFailed RoutingState = "Failed" + RoutingStateNone RoutingState = "None" + RoutingStateProvisioned RoutingState = "Provisioned" + RoutingStateProvisioning RoutingState = "Provisioning" +) + +// PossibleRoutingStateValues returns the possible values for the RoutingState const type. +func PossibleRoutingStateValues() []RoutingState { + return []RoutingState{ + RoutingStateFailed, + RoutingStateNone, + RoutingStateProvisioned, + RoutingStateProvisioning, + } +} + +// ScopeConnectionState - The current scope connection state. +type ScopeConnectionState string + +const ( + ScopeConnectionStateConflict ScopeConnectionState = "Conflict" + ScopeConnectionStateConnected ScopeConnectionState = "Connected" + ScopeConnectionStatePending ScopeConnectionState = "Pending" + ScopeConnectionStateRejected ScopeConnectionState = "Rejected" + ScopeConnectionStateRevoked ScopeConnectionState = "Revoked" +) + +// PossibleScopeConnectionStateValues returns the possible values for the ScopeConnectionState const type. +func PossibleScopeConnectionStateValues() []ScopeConnectionState { + return []ScopeConnectionState{ + ScopeConnectionStateConflict, + ScopeConnectionStateConnected, + ScopeConnectionStatePending, + ScopeConnectionStateRejected, + ScopeConnectionStateRevoked, + } +} + +// SecurityConfigurationRuleAccess - Whether network traffic is allowed or denied. +type SecurityConfigurationRuleAccess string + +const ( + SecurityConfigurationRuleAccessAllow SecurityConfigurationRuleAccess = "Allow" + SecurityConfigurationRuleAccessAlwaysAllow SecurityConfigurationRuleAccess = "AlwaysAllow" + SecurityConfigurationRuleAccessDeny SecurityConfigurationRuleAccess = "Deny" +) + +// PossibleSecurityConfigurationRuleAccessValues returns the possible values for the SecurityConfigurationRuleAccess const type. +func PossibleSecurityConfigurationRuleAccessValues() []SecurityConfigurationRuleAccess { + return []SecurityConfigurationRuleAccess{ + SecurityConfigurationRuleAccessAllow, + SecurityConfigurationRuleAccessAlwaysAllow, + SecurityConfigurationRuleAccessDeny, + } +} + +// SecurityConfigurationRuleDirection - The direction of the rule. The direction specifies if the rule will be evaluated on +// incoming or outgoing traffic. +type SecurityConfigurationRuleDirection string + +const ( + SecurityConfigurationRuleDirectionInbound SecurityConfigurationRuleDirection = "Inbound" + SecurityConfigurationRuleDirectionOutbound SecurityConfigurationRuleDirection = "Outbound" +) + +// PossibleSecurityConfigurationRuleDirectionValues returns the possible values for the SecurityConfigurationRuleDirection const type. +func PossibleSecurityConfigurationRuleDirectionValues() []SecurityConfigurationRuleDirection { + return []SecurityConfigurationRuleDirection{ + SecurityConfigurationRuleDirectionInbound, + SecurityConfigurationRuleDirectionOutbound, + } +} + +// SecurityConfigurationRuleProtocol - Network protocol this rule applies to. +type SecurityConfigurationRuleProtocol string + +const ( + SecurityConfigurationRuleProtocolAh SecurityConfigurationRuleProtocol = "Ah" + SecurityConfigurationRuleProtocolAny SecurityConfigurationRuleProtocol = "Any" + SecurityConfigurationRuleProtocolEsp SecurityConfigurationRuleProtocol = "Esp" + SecurityConfigurationRuleProtocolIcmp SecurityConfigurationRuleProtocol = "Icmp" + SecurityConfigurationRuleProtocolTCP SecurityConfigurationRuleProtocol = "Tcp" + SecurityConfigurationRuleProtocolUDP SecurityConfigurationRuleProtocol = "Udp" +) + +// PossibleSecurityConfigurationRuleProtocolValues returns the possible values for the SecurityConfigurationRuleProtocol const type. +func PossibleSecurityConfigurationRuleProtocolValues() []SecurityConfigurationRuleProtocol { + return []SecurityConfigurationRuleProtocol{ + SecurityConfigurationRuleProtocolAh, + SecurityConfigurationRuleProtocolAny, + SecurityConfigurationRuleProtocolEsp, + SecurityConfigurationRuleProtocolIcmp, + SecurityConfigurationRuleProtocolTCP, + SecurityConfigurationRuleProtocolUDP, + } +} + +// SecurityPartnerProviderConnectionStatus - The current state of the connection with Security Partner Provider. +type SecurityPartnerProviderConnectionStatus string + +const ( + SecurityPartnerProviderConnectionStatusConnected SecurityPartnerProviderConnectionStatus = "Connected" + SecurityPartnerProviderConnectionStatusNotConnected SecurityPartnerProviderConnectionStatus = "NotConnected" + SecurityPartnerProviderConnectionStatusPartiallyConnected SecurityPartnerProviderConnectionStatus = "PartiallyConnected" + SecurityPartnerProviderConnectionStatusUnknown SecurityPartnerProviderConnectionStatus = "Unknown" +) + +// PossibleSecurityPartnerProviderConnectionStatusValues returns the possible values for the SecurityPartnerProviderConnectionStatus const type. +func PossibleSecurityPartnerProviderConnectionStatusValues() []SecurityPartnerProviderConnectionStatus { + return []SecurityPartnerProviderConnectionStatus{ + SecurityPartnerProviderConnectionStatusConnected, + SecurityPartnerProviderConnectionStatusNotConnected, + SecurityPartnerProviderConnectionStatusPartiallyConnected, + SecurityPartnerProviderConnectionStatusUnknown, + } +} + +// SecurityProviderName - The Security Providers. +type SecurityProviderName string + +const ( + SecurityProviderNameCheckpoint SecurityProviderName = "Checkpoint" + SecurityProviderNameIBoss SecurityProviderName = "IBoss" + SecurityProviderNameZScaler SecurityProviderName = "ZScaler" +) + +// PossibleSecurityProviderNameValues returns the possible values for the SecurityProviderName const type. +func PossibleSecurityProviderNameValues() []SecurityProviderName { + return []SecurityProviderName{ + SecurityProviderNameCheckpoint, + SecurityProviderNameIBoss, + SecurityProviderNameZScaler, + } +} + +// SecurityRuleAccess - Whether network traffic is allowed or denied. +type SecurityRuleAccess string + +const ( + SecurityRuleAccessAllow SecurityRuleAccess = "Allow" + SecurityRuleAccessDeny SecurityRuleAccess = "Deny" +) + +// PossibleSecurityRuleAccessValues returns the possible values for the SecurityRuleAccess const type. +func PossibleSecurityRuleAccessValues() []SecurityRuleAccess { + return []SecurityRuleAccess{ + SecurityRuleAccessAllow, + SecurityRuleAccessDeny, + } +} + +// SecurityRuleDirection - The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing +// traffic. +type SecurityRuleDirection string + +const ( + SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" + SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" +) + +// PossibleSecurityRuleDirectionValues returns the possible values for the SecurityRuleDirection const type. +func PossibleSecurityRuleDirectionValues() []SecurityRuleDirection { + return []SecurityRuleDirection{ + SecurityRuleDirectionInbound, + SecurityRuleDirectionOutbound, + } +} + +// SecurityRuleProtocol - Network protocol this rule applies to. +type SecurityRuleProtocol string + +const ( + SecurityRuleProtocolAh SecurityRuleProtocol = "Ah" + SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" + SecurityRuleProtocolEsp SecurityRuleProtocol = "Esp" + SecurityRuleProtocolIcmp SecurityRuleProtocol = "Icmp" + SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" + SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" +) + +// PossibleSecurityRuleProtocolValues returns the possible values for the SecurityRuleProtocol const type. +func PossibleSecurityRuleProtocolValues() []SecurityRuleProtocol { + return []SecurityRuleProtocol{ + SecurityRuleProtocolAh, + SecurityRuleProtocolAsterisk, + SecurityRuleProtocolEsp, + SecurityRuleProtocolIcmp, + SecurityRuleProtocolTCP, + SecurityRuleProtocolUDP, + } +} + +// ServiceProviderProvisioningState - The ServiceProviderProvisioningState state of the resource. +type ServiceProviderProvisioningState string + +const ( + ServiceProviderProvisioningStateDeprovisioning ServiceProviderProvisioningState = "Deprovisioning" + ServiceProviderProvisioningStateNotProvisioned ServiceProviderProvisioningState = "NotProvisioned" + ServiceProviderProvisioningStateProvisioned ServiceProviderProvisioningState = "Provisioned" + ServiceProviderProvisioningStateProvisioning ServiceProviderProvisioningState = "Provisioning" +) + +// PossibleServiceProviderProvisioningStateValues returns the possible values for the ServiceProviderProvisioningState const type. +func PossibleServiceProviderProvisioningStateValues() []ServiceProviderProvisioningState { + return []ServiceProviderProvisioningState{ + ServiceProviderProvisioningStateDeprovisioning, + ServiceProviderProvisioningStateNotProvisioned, + ServiceProviderProvisioningStateProvisioned, + ServiceProviderProvisioningStateProvisioning, + } +} + +// Severity - The severity of the issue. +type Severity string + +const ( + SeverityError Severity = "Error" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityError, + SeverityWarning, + } +} + +// SlotType - Specifies slot info on a cloud service +type SlotType string + +const ( + SlotTypeProduction SlotType = "Production" + SlotTypeStaging SlotType = "Staging" +) + +// PossibleSlotTypeValues returns the possible values for the SlotType const type. +func PossibleSlotTypeValues() []SlotType { + return []SlotType{ + SlotTypeProduction, + SlotTypeStaging, + } +} + +type SyncRemoteAddressSpace string + +const ( + SyncRemoteAddressSpaceTrue SyncRemoteAddressSpace = "true" +) + +// PossibleSyncRemoteAddressSpaceValues returns the possible values for the SyncRemoteAddressSpace const type. +func PossibleSyncRemoteAddressSpaceValues() []SyncRemoteAddressSpace { + return []SyncRemoteAddressSpace{ + SyncRemoteAddressSpaceTrue, + } +} + +// TransportProtocol - The transport protocol for the endpoint. +type TransportProtocol string + +const ( + TransportProtocolAll TransportProtocol = "All" + TransportProtocolTCP TransportProtocol = "Tcp" + TransportProtocolUDP TransportProtocol = "Udp" +) + +// PossibleTransportProtocolValues returns the possible values for the TransportProtocol const type. +func PossibleTransportProtocolValues() []TransportProtocol { + return []TransportProtocol{ + TransportProtocolAll, + TransportProtocolTCP, + TransportProtocolUDP, + } +} + +// TunnelConnectionStatus - The current state of the tunnel. +type TunnelConnectionStatus string + +const ( + TunnelConnectionStatusConnected TunnelConnectionStatus = "Connected" + TunnelConnectionStatusConnecting TunnelConnectionStatus = "Connecting" + TunnelConnectionStatusNotConnected TunnelConnectionStatus = "NotConnected" + TunnelConnectionStatusUnknown TunnelConnectionStatus = "Unknown" +) + +// PossibleTunnelConnectionStatusValues returns the possible values for the TunnelConnectionStatus const type. +func PossibleTunnelConnectionStatusValues() []TunnelConnectionStatus { + return []TunnelConnectionStatus{ + TunnelConnectionStatusConnected, + TunnelConnectionStatusConnecting, + TunnelConnectionStatusNotConnected, + TunnelConnectionStatusUnknown, + } +} + +// UsageUnit - An enum describing the unit of measurement. +type UsageUnit string + +const ( + UsageUnitCount UsageUnit = "Count" +) + +// PossibleUsageUnitValues returns the possible values for the UsageUnit const type. +func PossibleUsageUnitValues() []UsageUnit { + return []UsageUnit{ + UsageUnitCount, + } +} + +// UseHubGateway - Flag if need to use hub gateway. +type UseHubGateway string + +const ( + UseHubGatewayFalse UseHubGateway = "False" + UseHubGatewayTrue UseHubGateway = "True" +) + +// PossibleUseHubGatewayValues returns the possible values for the UseHubGateway const type. +func PossibleUseHubGatewayValues() []UseHubGateway { + return []UseHubGateway{ + UseHubGatewayFalse, + UseHubGatewayTrue, + } +} + +// VPNAuthenticationType - VPN authentication types enabled for the virtual network gateway. +type VPNAuthenticationType string + +const ( + VPNAuthenticationTypeAAD VPNAuthenticationType = "AAD" + VPNAuthenticationTypeCertificate VPNAuthenticationType = "Certificate" + VPNAuthenticationTypeRadius VPNAuthenticationType = "Radius" +) + +// PossibleVPNAuthenticationTypeValues returns the possible values for the VPNAuthenticationType const type. +func PossibleVPNAuthenticationTypeValues() []VPNAuthenticationType { + return []VPNAuthenticationType{ + VPNAuthenticationTypeAAD, + VPNAuthenticationTypeCertificate, + VPNAuthenticationTypeRadius, + } +} + +// VPNClientProtocol - VPN client protocol enabled for the virtual network gateway. +type VPNClientProtocol string + +const ( + VPNClientProtocolIkeV2 VPNClientProtocol = "IkeV2" + VPNClientProtocolOpenVPN VPNClientProtocol = "OpenVPN" + VPNClientProtocolSSTP VPNClientProtocol = "SSTP" +) + +// PossibleVPNClientProtocolValues returns the possible values for the VPNClientProtocol const type. +func PossibleVPNClientProtocolValues() []VPNClientProtocol { + return []VPNClientProtocol{ + VPNClientProtocolIkeV2, + VPNClientProtocolOpenVPN, + VPNClientProtocolSSTP, + } +} + +// VPNConnectionStatus - The current state of the vpn connection. +type VPNConnectionStatus string + +const ( + VPNConnectionStatusConnected VPNConnectionStatus = "Connected" + VPNConnectionStatusConnecting VPNConnectionStatus = "Connecting" + VPNConnectionStatusNotConnected VPNConnectionStatus = "NotConnected" + VPNConnectionStatusUnknown VPNConnectionStatus = "Unknown" +) + +// PossibleVPNConnectionStatusValues returns the possible values for the VPNConnectionStatus const type. +func PossibleVPNConnectionStatusValues() []VPNConnectionStatus { + return []VPNConnectionStatus{ + VPNConnectionStatusConnected, + VPNConnectionStatusConnecting, + VPNConnectionStatusNotConnected, + VPNConnectionStatusUnknown, + } +} + +// VPNGatewayGeneration - The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. +type VPNGatewayGeneration string + +const ( + VPNGatewayGenerationGeneration1 VPNGatewayGeneration = "Generation1" + VPNGatewayGenerationGeneration2 VPNGatewayGeneration = "Generation2" + VPNGatewayGenerationNone VPNGatewayGeneration = "None" +) + +// PossibleVPNGatewayGenerationValues returns the possible values for the VPNGatewayGeneration const type. +func PossibleVPNGatewayGenerationValues() []VPNGatewayGeneration { + return []VPNGatewayGeneration{ + VPNGatewayGenerationGeneration1, + VPNGatewayGenerationGeneration2, + VPNGatewayGenerationNone, + } +} + +// VPNGatewayTunnelingProtocol - VPN protocol enabled for the VpnServerConfiguration. +type VPNGatewayTunnelingProtocol string + +const ( + VPNGatewayTunnelingProtocolIkeV2 VPNGatewayTunnelingProtocol = "IkeV2" + VPNGatewayTunnelingProtocolOpenVPN VPNGatewayTunnelingProtocol = "OpenVPN" +) + +// PossibleVPNGatewayTunnelingProtocolValues returns the possible values for the VPNGatewayTunnelingProtocol const type. +func PossibleVPNGatewayTunnelingProtocolValues() []VPNGatewayTunnelingProtocol { + return []VPNGatewayTunnelingProtocol{ + VPNGatewayTunnelingProtocolIkeV2, + VPNGatewayTunnelingProtocolOpenVPN, + } +} + +// VPNLinkConnectionMode - Vpn link connection mode. +type VPNLinkConnectionMode string + +const ( + VPNLinkConnectionModeDefault VPNLinkConnectionMode = "Default" + VPNLinkConnectionModeInitiatorOnly VPNLinkConnectionMode = "InitiatorOnly" + VPNLinkConnectionModeResponderOnly VPNLinkConnectionMode = "ResponderOnly" +) + +// PossibleVPNLinkConnectionModeValues returns the possible values for the VPNLinkConnectionMode const type. +func PossibleVPNLinkConnectionModeValues() []VPNLinkConnectionMode { + return []VPNLinkConnectionMode{ + VPNLinkConnectionModeDefault, + VPNLinkConnectionModeInitiatorOnly, + VPNLinkConnectionModeResponderOnly, + } +} + +// VPNNatRuleMode - The Source NAT direction of a VPN NAT. +type VPNNatRuleMode string + +const ( + VPNNatRuleModeEgressSnat VPNNatRuleMode = "EgressSnat" + VPNNatRuleModeIngressSnat VPNNatRuleMode = "IngressSnat" +) + +// PossibleVPNNatRuleModeValues returns the possible values for the VPNNatRuleMode const type. +func PossibleVPNNatRuleModeValues() []VPNNatRuleMode { + return []VPNNatRuleMode{ + VPNNatRuleModeEgressSnat, + VPNNatRuleModeIngressSnat, + } +} + +// VPNNatRuleType - The type of NAT rule for VPN NAT. +type VPNNatRuleType string + +const ( + VPNNatRuleTypeDynamic VPNNatRuleType = "Dynamic" + VPNNatRuleTypeStatic VPNNatRuleType = "Static" +) + +// PossibleVPNNatRuleTypeValues returns the possible values for the VPNNatRuleType const type. +func PossibleVPNNatRuleTypeValues() []VPNNatRuleType { + return []VPNNatRuleType{ + VPNNatRuleTypeDynamic, + VPNNatRuleTypeStatic, + } +} + +// VPNPolicyMemberAttributeType - The Vpn Policy member attribute type. +type VPNPolicyMemberAttributeType string + +const ( + VPNPolicyMemberAttributeTypeAADGroupID VPNPolicyMemberAttributeType = "AADGroupId" + VPNPolicyMemberAttributeTypeCertificateGroupID VPNPolicyMemberAttributeType = "CertificateGroupId" + VPNPolicyMemberAttributeTypeRadiusAzureGroupID VPNPolicyMemberAttributeType = "RadiusAzureGroupId" +) + +// PossibleVPNPolicyMemberAttributeTypeValues returns the possible values for the VPNPolicyMemberAttributeType const type. +func PossibleVPNPolicyMemberAttributeTypeValues() []VPNPolicyMemberAttributeType { + return []VPNPolicyMemberAttributeType{ + VPNPolicyMemberAttributeTypeAADGroupID, + VPNPolicyMemberAttributeTypeCertificateGroupID, + VPNPolicyMemberAttributeTypeRadiusAzureGroupID, + } +} + +// VPNType - The type of this virtual network gateway. +type VPNType string + +const ( + VPNTypePolicyBased VPNType = "PolicyBased" + VPNTypeRouteBased VPNType = "RouteBased" +) + +// PossibleVPNTypeValues returns the possible values for the VPNType const type. +func PossibleVPNTypeValues() []VPNType { + return []VPNType{ + VPNTypePolicyBased, + VPNTypeRouteBased, + } +} + +// VerbosityLevel - Verbosity level. +type VerbosityLevel string + +const ( + VerbosityLevelFull VerbosityLevel = "Full" + VerbosityLevelMinimum VerbosityLevel = "Minimum" + VerbosityLevelNormal VerbosityLevel = "Normal" +) + +// PossibleVerbosityLevelValues returns the possible values for the VerbosityLevel const type. +func PossibleVerbosityLevelValues() []VerbosityLevel { + return []VerbosityLevel{ + VerbosityLevelFull, + VerbosityLevelMinimum, + VerbosityLevelNormal, + } +} + +// VirtualNetworkEncryptionEnforcement - If the encrypted VNet allows VM that does not support encryption +type VirtualNetworkEncryptionEnforcement string + +const ( + VirtualNetworkEncryptionEnforcementAllowUnencrypted VirtualNetworkEncryptionEnforcement = "AllowUnencrypted" + VirtualNetworkEncryptionEnforcementDropUnencrypted VirtualNetworkEncryptionEnforcement = "DropUnencrypted" +) + +// PossibleVirtualNetworkEncryptionEnforcementValues returns the possible values for the VirtualNetworkEncryptionEnforcement const type. +func PossibleVirtualNetworkEncryptionEnforcementValues() []VirtualNetworkEncryptionEnforcement { + return []VirtualNetworkEncryptionEnforcement{ + VirtualNetworkEncryptionEnforcementAllowUnencrypted, + VirtualNetworkEncryptionEnforcementDropUnencrypted, + } +} + +// VirtualNetworkGatewayConnectionMode - Gateway connection type. +type VirtualNetworkGatewayConnectionMode string + +const ( + VirtualNetworkGatewayConnectionModeDefault VirtualNetworkGatewayConnectionMode = "Default" + VirtualNetworkGatewayConnectionModeInitiatorOnly VirtualNetworkGatewayConnectionMode = "InitiatorOnly" + VirtualNetworkGatewayConnectionModeResponderOnly VirtualNetworkGatewayConnectionMode = "ResponderOnly" +) + +// PossibleVirtualNetworkGatewayConnectionModeValues returns the possible values for the VirtualNetworkGatewayConnectionMode const type. +func PossibleVirtualNetworkGatewayConnectionModeValues() []VirtualNetworkGatewayConnectionMode { + return []VirtualNetworkGatewayConnectionMode{ + VirtualNetworkGatewayConnectionModeDefault, + VirtualNetworkGatewayConnectionModeInitiatorOnly, + VirtualNetworkGatewayConnectionModeResponderOnly, + } +} + +// VirtualNetworkGatewayConnectionProtocol - Gateway connection protocol. +type VirtualNetworkGatewayConnectionProtocol string + +const ( + VirtualNetworkGatewayConnectionProtocolIKEv1 VirtualNetworkGatewayConnectionProtocol = "IKEv1" + VirtualNetworkGatewayConnectionProtocolIKEv2 VirtualNetworkGatewayConnectionProtocol = "IKEv2" +) + +// PossibleVirtualNetworkGatewayConnectionProtocolValues returns the possible values for the VirtualNetworkGatewayConnectionProtocol const type. +func PossibleVirtualNetworkGatewayConnectionProtocolValues() []VirtualNetworkGatewayConnectionProtocol { + return []VirtualNetworkGatewayConnectionProtocol{ + VirtualNetworkGatewayConnectionProtocolIKEv1, + VirtualNetworkGatewayConnectionProtocolIKEv2, + } +} + +// VirtualNetworkGatewayConnectionStatus - Virtual Network Gateway connection status. +type VirtualNetworkGatewayConnectionStatus string + +const ( + VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" + VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" + VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" + VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" +) + +// PossibleVirtualNetworkGatewayConnectionStatusValues returns the possible values for the VirtualNetworkGatewayConnectionStatus const type. +func PossibleVirtualNetworkGatewayConnectionStatusValues() []VirtualNetworkGatewayConnectionStatus { + return []VirtualNetworkGatewayConnectionStatus{ + VirtualNetworkGatewayConnectionStatusConnected, + VirtualNetworkGatewayConnectionStatusConnecting, + VirtualNetworkGatewayConnectionStatusNotConnected, + VirtualNetworkGatewayConnectionStatusUnknown, + } +} + +// VirtualNetworkGatewayConnectionType - Gateway connection type. +type VirtualNetworkGatewayConnectionType string + +const ( + VirtualNetworkGatewayConnectionTypeExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" + VirtualNetworkGatewayConnectionTypeIPsec VirtualNetworkGatewayConnectionType = "IPsec" + VirtualNetworkGatewayConnectionTypeVPNClient VirtualNetworkGatewayConnectionType = "VPNClient" + VirtualNetworkGatewayConnectionTypeVnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" +) + +// PossibleVirtualNetworkGatewayConnectionTypeValues returns the possible values for the VirtualNetworkGatewayConnectionType const type. +func PossibleVirtualNetworkGatewayConnectionTypeValues() []VirtualNetworkGatewayConnectionType { + return []VirtualNetworkGatewayConnectionType{ + VirtualNetworkGatewayConnectionTypeExpressRoute, + VirtualNetworkGatewayConnectionTypeIPsec, + VirtualNetworkGatewayConnectionTypeVPNClient, + VirtualNetworkGatewayConnectionTypeVnet2Vnet, + } +} + +// VirtualNetworkGatewaySKUName - Gateway SKU name. +type VirtualNetworkGatewaySKUName string + +const ( + VirtualNetworkGatewaySKUNameBasic VirtualNetworkGatewaySKUName = "Basic" + VirtualNetworkGatewaySKUNameErGw1AZ VirtualNetworkGatewaySKUName = "ErGw1AZ" + VirtualNetworkGatewaySKUNameErGw2AZ VirtualNetworkGatewaySKUName = "ErGw2AZ" + VirtualNetworkGatewaySKUNameErGw3AZ VirtualNetworkGatewaySKUName = "ErGw3AZ" + VirtualNetworkGatewaySKUNameHighPerformance VirtualNetworkGatewaySKUName = "HighPerformance" + VirtualNetworkGatewaySKUNameStandard VirtualNetworkGatewaySKUName = "Standard" + VirtualNetworkGatewaySKUNameUltraPerformance VirtualNetworkGatewaySKUName = "UltraPerformance" + VirtualNetworkGatewaySKUNameVPNGw1 VirtualNetworkGatewaySKUName = "VpnGw1" + VirtualNetworkGatewaySKUNameVPNGw1AZ VirtualNetworkGatewaySKUName = "VpnGw1AZ" + VirtualNetworkGatewaySKUNameVPNGw2 VirtualNetworkGatewaySKUName = "VpnGw2" + VirtualNetworkGatewaySKUNameVPNGw2AZ VirtualNetworkGatewaySKUName = "VpnGw2AZ" + VirtualNetworkGatewaySKUNameVPNGw3 VirtualNetworkGatewaySKUName = "VpnGw3" + VirtualNetworkGatewaySKUNameVPNGw3AZ VirtualNetworkGatewaySKUName = "VpnGw3AZ" + VirtualNetworkGatewaySKUNameVPNGw4 VirtualNetworkGatewaySKUName = "VpnGw4" + VirtualNetworkGatewaySKUNameVPNGw4AZ VirtualNetworkGatewaySKUName = "VpnGw4AZ" + VirtualNetworkGatewaySKUNameVPNGw5 VirtualNetworkGatewaySKUName = "VpnGw5" + VirtualNetworkGatewaySKUNameVPNGw5AZ VirtualNetworkGatewaySKUName = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySKUNameValues returns the possible values for the VirtualNetworkGatewaySKUName const type. +func PossibleVirtualNetworkGatewaySKUNameValues() []VirtualNetworkGatewaySKUName { + return []VirtualNetworkGatewaySKUName{ + VirtualNetworkGatewaySKUNameBasic, + VirtualNetworkGatewaySKUNameErGw1AZ, + VirtualNetworkGatewaySKUNameErGw2AZ, + VirtualNetworkGatewaySKUNameErGw3AZ, + VirtualNetworkGatewaySKUNameHighPerformance, + VirtualNetworkGatewaySKUNameStandard, + VirtualNetworkGatewaySKUNameUltraPerformance, + VirtualNetworkGatewaySKUNameVPNGw1, + VirtualNetworkGatewaySKUNameVPNGw1AZ, + VirtualNetworkGatewaySKUNameVPNGw2, + VirtualNetworkGatewaySKUNameVPNGw2AZ, + VirtualNetworkGatewaySKUNameVPNGw3, + VirtualNetworkGatewaySKUNameVPNGw3AZ, + VirtualNetworkGatewaySKUNameVPNGw4, + VirtualNetworkGatewaySKUNameVPNGw4AZ, + VirtualNetworkGatewaySKUNameVPNGw5, + VirtualNetworkGatewaySKUNameVPNGw5AZ, + } +} + +// VirtualNetworkGatewaySKUTier - Gateway SKU tier. +type VirtualNetworkGatewaySKUTier string + +const ( + VirtualNetworkGatewaySKUTierBasic VirtualNetworkGatewaySKUTier = "Basic" + VirtualNetworkGatewaySKUTierErGw1AZ VirtualNetworkGatewaySKUTier = "ErGw1AZ" + VirtualNetworkGatewaySKUTierErGw2AZ VirtualNetworkGatewaySKUTier = "ErGw2AZ" + VirtualNetworkGatewaySKUTierErGw3AZ VirtualNetworkGatewaySKUTier = "ErGw3AZ" + VirtualNetworkGatewaySKUTierHighPerformance VirtualNetworkGatewaySKUTier = "HighPerformance" + VirtualNetworkGatewaySKUTierStandard VirtualNetworkGatewaySKUTier = "Standard" + VirtualNetworkGatewaySKUTierUltraPerformance VirtualNetworkGatewaySKUTier = "UltraPerformance" + VirtualNetworkGatewaySKUTierVPNGw1 VirtualNetworkGatewaySKUTier = "VpnGw1" + VirtualNetworkGatewaySKUTierVPNGw1AZ VirtualNetworkGatewaySKUTier = "VpnGw1AZ" + VirtualNetworkGatewaySKUTierVPNGw2 VirtualNetworkGatewaySKUTier = "VpnGw2" + VirtualNetworkGatewaySKUTierVPNGw2AZ VirtualNetworkGatewaySKUTier = "VpnGw2AZ" + VirtualNetworkGatewaySKUTierVPNGw3 VirtualNetworkGatewaySKUTier = "VpnGw3" + VirtualNetworkGatewaySKUTierVPNGw3AZ VirtualNetworkGatewaySKUTier = "VpnGw3AZ" + VirtualNetworkGatewaySKUTierVPNGw4 VirtualNetworkGatewaySKUTier = "VpnGw4" + VirtualNetworkGatewaySKUTierVPNGw4AZ VirtualNetworkGatewaySKUTier = "VpnGw4AZ" + VirtualNetworkGatewaySKUTierVPNGw5 VirtualNetworkGatewaySKUTier = "VpnGw5" + VirtualNetworkGatewaySKUTierVPNGw5AZ VirtualNetworkGatewaySKUTier = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySKUTierValues returns the possible values for the VirtualNetworkGatewaySKUTier const type. +func PossibleVirtualNetworkGatewaySKUTierValues() []VirtualNetworkGatewaySKUTier { + return []VirtualNetworkGatewaySKUTier{ + VirtualNetworkGatewaySKUTierBasic, + VirtualNetworkGatewaySKUTierErGw1AZ, + VirtualNetworkGatewaySKUTierErGw2AZ, + VirtualNetworkGatewaySKUTierErGw3AZ, + VirtualNetworkGatewaySKUTierHighPerformance, + VirtualNetworkGatewaySKUTierStandard, + VirtualNetworkGatewaySKUTierUltraPerformance, + VirtualNetworkGatewaySKUTierVPNGw1, + VirtualNetworkGatewaySKUTierVPNGw1AZ, + VirtualNetworkGatewaySKUTierVPNGw2, + VirtualNetworkGatewaySKUTierVPNGw2AZ, + VirtualNetworkGatewaySKUTierVPNGw3, + VirtualNetworkGatewaySKUTierVPNGw3AZ, + VirtualNetworkGatewaySKUTierVPNGw4, + VirtualNetworkGatewaySKUTierVPNGw4AZ, + VirtualNetworkGatewaySKUTierVPNGw5, + VirtualNetworkGatewaySKUTierVPNGw5AZ, + } +} + +// VirtualNetworkGatewayType - The type of this virtual network gateway. +type VirtualNetworkGatewayType string + +const ( + VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" + VirtualNetworkGatewayTypeLocalGateway VirtualNetworkGatewayType = "LocalGateway" + VirtualNetworkGatewayTypeVPN VirtualNetworkGatewayType = "Vpn" +) + +// PossibleVirtualNetworkGatewayTypeValues returns the possible values for the VirtualNetworkGatewayType const type. +func PossibleVirtualNetworkGatewayTypeValues() []VirtualNetworkGatewayType { + return []VirtualNetworkGatewayType{ + VirtualNetworkGatewayTypeExpressRoute, + VirtualNetworkGatewayTypeLocalGateway, + VirtualNetworkGatewayTypeVPN, + } +} + +// VirtualNetworkPeeringLevel - The peering sync status of the virtual network peering. +type VirtualNetworkPeeringLevel string + +const ( + VirtualNetworkPeeringLevelFullyInSync VirtualNetworkPeeringLevel = "FullyInSync" + VirtualNetworkPeeringLevelLocalAndRemoteNotInSync VirtualNetworkPeeringLevel = "LocalAndRemoteNotInSync" + VirtualNetworkPeeringLevelLocalNotInSync VirtualNetworkPeeringLevel = "LocalNotInSync" + VirtualNetworkPeeringLevelRemoteNotInSync VirtualNetworkPeeringLevel = "RemoteNotInSync" +) + +// PossibleVirtualNetworkPeeringLevelValues returns the possible values for the VirtualNetworkPeeringLevel const type. +func PossibleVirtualNetworkPeeringLevelValues() []VirtualNetworkPeeringLevel { + return []VirtualNetworkPeeringLevel{ + VirtualNetworkPeeringLevelFullyInSync, + VirtualNetworkPeeringLevelLocalAndRemoteNotInSync, + VirtualNetworkPeeringLevelLocalNotInSync, + VirtualNetworkPeeringLevelRemoteNotInSync, + } +} + +// VirtualNetworkPeeringState - The status of the virtual network peering. +type VirtualNetworkPeeringState string + +const ( + VirtualNetworkPeeringStateConnected VirtualNetworkPeeringState = "Connected" + VirtualNetworkPeeringStateDisconnected VirtualNetworkPeeringState = "Disconnected" + VirtualNetworkPeeringStateInitiated VirtualNetworkPeeringState = "Initiated" +) + +// PossibleVirtualNetworkPeeringStateValues returns the possible values for the VirtualNetworkPeeringState const type. +func PossibleVirtualNetworkPeeringStateValues() []VirtualNetworkPeeringState { + return []VirtualNetworkPeeringState{ + VirtualNetworkPeeringStateConnected, + VirtualNetworkPeeringStateDisconnected, + VirtualNetworkPeeringStateInitiated, + } +} + +// VirtualNetworkPrivateEndpointNetworkPolicies - Enable or Disable apply network policies on private end point in the subnet. +type VirtualNetworkPrivateEndpointNetworkPolicies string + +const ( + VirtualNetworkPrivateEndpointNetworkPoliciesDisabled VirtualNetworkPrivateEndpointNetworkPolicies = "Disabled" + VirtualNetworkPrivateEndpointNetworkPoliciesEnabled VirtualNetworkPrivateEndpointNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues returns the possible values for the VirtualNetworkPrivateEndpointNetworkPolicies const type. +func PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues() []VirtualNetworkPrivateEndpointNetworkPolicies { + return []VirtualNetworkPrivateEndpointNetworkPolicies{ + VirtualNetworkPrivateEndpointNetworkPoliciesDisabled, + VirtualNetworkPrivateEndpointNetworkPoliciesEnabled, + } +} + +// VirtualNetworkPrivateLinkServiceNetworkPolicies - Enable or Disable apply network policies on private link service in the +// subnet. +type VirtualNetworkPrivateLinkServiceNetworkPolicies string + +const ( + VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Disabled" + VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues returns the possible values for the VirtualNetworkPrivateLinkServiceNetworkPolicies const type. +func PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues() []VirtualNetworkPrivateLinkServiceNetworkPolicies { + return []VirtualNetworkPrivateLinkServiceNetworkPolicies{ + VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled, + VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled, + } +} + +// VirtualWanSecurityProviderType - The virtual wan security provider type. +type VirtualWanSecurityProviderType string + +const ( + VirtualWanSecurityProviderTypeExternal VirtualWanSecurityProviderType = "External" + VirtualWanSecurityProviderTypeNative VirtualWanSecurityProviderType = "Native" +) + +// PossibleVirtualWanSecurityProviderTypeValues returns the possible values for the VirtualWanSecurityProviderType const type. +func PossibleVirtualWanSecurityProviderTypeValues() []VirtualWanSecurityProviderType { + return []VirtualWanSecurityProviderType{ + VirtualWanSecurityProviderTypeExternal, + VirtualWanSecurityProviderTypeNative, + } +} + +// VnetLocalRouteOverrideCriteria - Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination +// in spoke vnet. +type VnetLocalRouteOverrideCriteria string + +const ( + VnetLocalRouteOverrideCriteriaContains VnetLocalRouteOverrideCriteria = "Contains" + VnetLocalRouteOverrideCriteriaEqual VnetLocalRouteOverrideCriteria = "Equal" +) + +// PossibleVnetLocalRouteOverrideCriteriaValues returns the possible values for the VnetLocalRouteOverrideCriteria const type. +func PossibleVnetLocalRouteOverrideCriteriaValues() []VnetLocalRouteOverrideCriteria { + return []VnetLocalRouteOverrideCriteria{ + VnetLocalRouteOverrideCriteriaContains, + VnetLocalRouteOverrideCriteriaEqual, + } +} + +// WebApplicationFirewallAction - Type of Actions. +type WebApplicationFirewallAction string + +const ( + WebApplicationFirewallActionAllow WebApplicationFirewallAction = "Allow" + WebApplicationFirewallActionBlock WebApplicationFirewallAction = "Block" + WebApplicationFirewallActionLog WebApplicationFirewallAction = "Log" +) + +// PossibleWebApplicationFirewallActionValues returns the possible values for the WebApplicationFirewallAction const type. +func PossibleWebApplicationFirewallActionValues() []WebApplicationFirewallAction { + return []WebApplicationFirewallAction{ + WebApplicationFirewallActionAllow, + WebApplicationFirewallActionBlock, + WebApplicationFirewallActionLog, + } +} + +// WebApplicationFirewallEnabledState - The state of the policy. +type WebApplicationFirewallEnabledState string + +const ( + WebApplicationFirewallEnabledStateDisabled WebApplicationFirewallEnabledState = "Disabled" + WebApplicationFirewallEnabledStateEnabled WebApplicationFirewallEnabledState = "Enabled" +) + +// PossibleWebApplicationFirewallEnabledStateValues returns the possible values for the WebApplicationFirewallEnabledState const type. +func PossibleWebApplicationFirewallEnabledStateValues() []WebApplicationFirewallEnabledState { + return []WebApplicationFirewallEnabledState{ + WebApplicationFirewallEnabledStateDisabled, + WebApplicationFirewallEnabledStateEnabled, + } +} + +// WebApplicationFirewallMatchVariable - Match Variable. +type WebApplicationFirewallMatchVariable string + +const ( + WebApplicationFirewallMatchVariablePostArgs WebApplicationFirewallMatchVariable = "PostArgs" + WebApplicationFirewallMatchVariableQueryString WebApplicationFirewallMatchVariable = "QueryString" + WebApplicationFirewallMatchVariableRemoteAddr WebApplicationFirewallMatchVariable = "RemoteAddr" + WebApplicationFirewallMatchVariableRequestBody WebApplicationFirewallMatchVariable = "RequestBody" + WebApplicationFirewallMatchVariableRequestCookies WebApplicationFirewallMatchVariable = "RequestCookies" + WebApplicationFirewallMatchVariableRequestHeaders WebApplicationFirewallMatchVariable = "RequestHeaders" + WebApplicationFirewallMatchVariableRequestMethod WebApplicationFirewallMatchVariable = "RequestMethod" + WebApplicationFirewallMatchVariableRequestURI WebApplicationFirewallMatchVariable = "RequestUri" +) + +// PossibleWebApplicationFirewallMatchVariableValues returns the possible values for the WebApplicationFirewallMatchVariable const type. +func PossibleWebApplicationFirewallMatchVariableValues() []WebApplicationFirewallMatchVariable { + return []WebApplicationFirewallMatchVariable{ + WebApplicationFirewallMatchVariablePostArgs, + WebApplicationFirewallMatchVariableQueryString, + WebApplicationFirewallMatchVariableRemoteAddr, + WebApplicationFirewallMatchVariableRequestBody, + WebApplicationFirewallMatchVariableRequestCookies, + WebApplicationFirewallMatchVariableRequestHeaders, + WebApplicationFirewallMatchVariableRequestMethod, + WebApplicationFirewallMatchVariableRequestURI, + } +} + +// WebApplicationFirewallMode - The mode of the policy. +type WebApplicationFirewallMode string + +const ( + WebApplicationFirewallModeDetection WebApplicationFirewallMode = "Detection" + WebApplicationFirewallModePrevention WebApplicationFirewallMode = "Prevention" +) + +// PossibleWebApplicationFirewallModeValues returns the possible values for the WebApplicationFirewallMode const type. +func PossibleWebApplicationFirewallModeValues() []WebApplicationFirewallMode { + return []WebApplicationFirewallMode{ + WebApplicationFirewallModeDetection, + WebApplicationFirewallModePrevention, + } +} + +// WebApplicationFirewallOperator - The operator to be matched. +type WebApplicationFirewallOperator string + +const ( + WebApplicationFirewallOperatorAny WebApplicationFirewallOperator = "Any" + WebApplicationFirewallOperatorBeginsWith WebApplicationFirewallOperator = "BeginsWith" + WebApplicationFirewallOperatorContains WebApplicationFirewallOperator = "Contains" + WebApplicationFirewallOperatorEndsWith WebApplicationFirewallOperator = "EndsWith" + WebApplicationFirewallOperatorEqual WebApplicationFirewallOperator = "Equal" + WebApplicationFirewallOperatorGeoMatch WebApplicationFirewallOperator = "GeoMatch" + WebApplicationFirewallOperatorGreaterThan WebApplicationFirewallOperator = "GreaterThan" + WebApplicationFirewallOperatorGreaterThanOrEqual WebApplicationFirewallOperator = "GreaterThanOrEqual" + WebApplicationFirewallOperatorIPMatch WebApplicationFirewallOperator = "IPMatch" + WebApplicationFirewallOperatorLessThan WebApplicationFirewallOperator = "LessThan" + WebApplicationFirewallOperatorLessThanOrEqual WebApplicationFirewallOperator = "LessThanOrEqual" + WebApplicationFirewallOperatorRegex WebApplicationFirewallOperator = "Regex" +) + +// PossibleWebApplicationFirewallOperatorValues returns the possible values for the WebApplicationFirewallOperator const type. +func PossibleWebApplicationFirewallOperatorValues() []WebApplicationFirewallOperator { + return []WebApplicationFirewallOperator{ + WebApplicationFirewallOperatorAny, + WebApplicationFirewallOperatorBeginsWith, + WebApplicationFirewallOperatorContains, + WebApplicationFirewallOperatorEndsWith, + WebApplicationFirewallOperatorEqual, + WebApplicationFirewallOperatorGeoMatch, + WebApplicationFirewallOperatorGreaterThan, + WebApplicationFirewallOperatorGreaterThanOrEqual, + WebApplicationFirewallOperatorIPMatch, + WebApplicationFirewallOperatorLessThan, + WebApplicationFirewallOperatorLessThanOrEqual, + WebApplicationFirewallOperatorRegex, + } +} + +// WebApplicationFirewallPolicyResourceState - Resource status of the policy. +type WebApplicationFirewallPolicyResourceState string + +const ( + WebApplicationFirewallPolicyResourceStateCreating WebApplicationFirewallPolicyResourceState = "Creating" + WebApplicationFirewallPolicyResourceStateDeleting WebApplicationFirewallPolicyResourceState = "Deleting" + WebApplicationFirewallPolicyResourceStateDisabled WebApplicationFirewallPolicyResourceState = "Disabled" + WebApplicationFirewallPolicyResourceStateDisabling WebApplicationFirewallPolicyResourceState = "Disabling" + WebApplicationFirewallPolicyResourceStateEnabled WebApplicationFirewallPolicyResourceState = "Enabled" + WebApplicationFirewallPolicyResourceStateEnabling WebApplicationFirewallPolicyResourceState = "Enabling" +) + +// PossibleWebApplicationFirewallPolicyResourceStateValues returns the possible values for the WebApplicationFirewallPolicyResourceState const type. +func PossibleWebApplicationFirewallPolicyResourceStateValues() []WebApplicationFirewallPolicyResourceState { + return []WebApplicationFirewallPolicyResourceState{ + WebApplicationFirewallPolicyResourceStateCreating, + WebApplicationFirewallPolicyResourceStateDeleting, + WebApplicationFirewallPolicyResourceStateDisabled, + WebApplicationFirewallPolicyResourceStateDisabling, + WebApplicationFirewallPolicyResourceStateEnabled, + WebApplicationFirewallPolicyResourceStateEnabling, + } +} + +// WebApplicationFirewallRuleType - The rule type. +type WebApplicationFirewallRuleType string + +const ( + WebApplicationFirewallRuleTypeInvalid WebApplicationFirewallRuleType = "Invalid" + WebApplicationFirewallRuleTypeMatchRule WebApplicationFirewallRuleType = "MatchRule" +) + +// PossibleWebApplicationFirewallRuleTypeValues returns the possible values for the WebApplicationFirewallRuleType const type. +func PossibleWebApplicationFirewallRuleTypeValues() []WebApplicationFirewallRuleType { + return []WebApplicationFirewallRuleType{ + WebApplicationFirewallRuleTypeInvalid, + WebApplicationFirewallRuleTypeMatchRule, + } +} + +// WebApplicationFirewallTransform - Transforms applied before matching. +type WebApplicationFirewallTransform string + +const ( + WebApplicationFirewallTransformHTMLEntityDecode WebApplicationFirewallTransform = "HtmlEntityDecode" + WebApplicationFirewallTransformLowercase WebApplicationFirewallTransform = "Lowercase" + WebApplicationFirewallTransformRemoveNulls WebApplicationFirewallTransform = "RemoveNulls" + WebApplicationFirewallTransformTrim WebApplicationFirewallTransform = "Trim" + WebApplicationFirewallTransformURLDecode WebApplicationFirewallTransform = "UrlDecode" + WebApplicationFirewallTransformURLEncode WebApplicationFirewallTransform = "UrlEncode" + WebApplicationFirewallTransformUppercase WebApplicationFirewallTransform = "Uppercase" +) + +// PossibleWebApplicationFirewallTransformValues returns the possible values for the WebApplicationFirewallTransform const type. +func PossibleWebApplicationFirewallTransformValues() []WebApplicationFirewallTransform { + return []WebApplicationFirewallTransform{ + WebApplicationFirewallTransformHTMLEntityDecode, + WebApplicationFirewallTransformLowercase, + WebApplicationFirewallTransformRemoveNulls, + WebApplicationFirewallTransformTrim, + WebApplicationFirewallTransformURLDecode, + WebApplicationFirewallTransformURLEncode, + WebApplicationFirewallTransformUppercase, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/customipprefixes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/customipprefixes_client.go new file mode 100644 index 000000000..af348c687 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/customipprefixes_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CustomIPPrefixesClient contains the methods for the CustomIPPrefixes group. +// Don't use this type directly, use NewCustomIPPrefixesClient() instead. +type CustomIPPrefixesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCustomIPPrefixesClient creates a new instance of CustomIPPrefixesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCustomIPPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomIPPrefixesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CustomIPPrefixesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// customIPPrefixName - The name of the custom IP prefix. +// parameters - Parameters supplied to the create or update custom IP prefix operation. +// options - CustomIPPrefixesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomIPPrefixesClient.BeginCreateOrUpdate +// method. +func (client *CustomIPPrefixesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix, options *CustomIPPrefixesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CustomIPPrefixesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, customIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CustomIPPrefixesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[CustomIPPrefixesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *CustomIPPrefixesClient) createOrUpdate(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix, options *CustomIPPrefixesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, customIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CustomIPPrefixesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix, options *CustomIPPrefixesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if customIPPrefixName == "" { + return nil, errors.New("parameter customIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customIpPrefixName}", url.PathEscape(customIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// customIPPrefixName - The name of the CustomIpPrefix. +// options - CustomIPPrefixesClientBeginDeleteOptions contains the optional parameters for the CustomIPPrefixesClient.BeginDelete +// method. +func (client *CustomIPPrefixesClient) BeginDelete(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientBeginDeleteOptions) (*runtime.Poller[CustomIPPrefixesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, customIPPrefixName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CustomIPPrefixesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[CustomIPPrefixesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified custom IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *CustomIPPrefixesClient) deleteOperation(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, customIPPrefixName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CustomIPPrefixesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if customIPPrefixName == "" { + return nil, errors.New("parameter customIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customIpPrefixName}", url.PathEscape(customIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified custom IP prefix in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// customIPPrefixName - The name of the custom IP prefix. +// options - CustomIPPrefixesClientGetOptions contains the optional parameters for the CustomIPPrefixesClient.Get method. +func (client *CustomIPPrefixesClient) Get(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientGetOptions) (CustomIPPrefixesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, customIPPrefixName, options) + if err != nil { + return CustomIPPrefixesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomIPPrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomIPPrefixesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CustomIPPrefixesClient) getCreateRequest(ctx context.Context, resourceGroupName string, customIPPrefixName string, options *CustomIPPrefixesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if customIPPrefixName == "" { + return nil, errors.New("parameter customIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customIpPrefixName}", url.PathEscape(customIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CustomIPPrefixesClient) getHandleResponse(resp *http.Response) (CustomIPPrefixesClientGetResponse, error) { + result := CustomIPPrefixesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefix); err != nil { + return CustomIPPrefixesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all custom IP prefixes in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - CustomIPPrefixesClientListOptions contains the optional parameters for the CustomIPPrefixesClient.List method. +func (client *CustomIPPrefixesClient) NewListPager(resourceGroupName string, options *CustomIPPrefixesClientListOptions) *runtime.Pager[CustomIPPrefixesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CustomIPPrefixesClientListResponse]{ + More: func(page CustomIPPrefixesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CustomIPPrefixesClientListResponse) (CustomIPPrefixesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CustomIPPrefixesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomIPPrefixesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomIPPrefixesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CustomIPPrefixesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *CustomIPPrefixesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CustomIPPrefixesClient) listHandleResponse(resp *http.Response) (CustomIPPrefixesClientListResponse, error) { + result := CustomIPPrefixesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefixListResult); err != nil { + return CustomIPPrefixesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the custom IP prefixes in a subscription. +// Generated from API version 2022-05-01 +// options - CustomIPPrefixesClientListAllOptions contains the optional parameters for the CustomIPPrefixesClient.ListAll +// method. +func (client *CustomIPPrefixesClient) NewListAllPager(options *CustomIPPrefixesClientListAllOptions) *runtime.Pager[CustomIPPrefixesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[CustomIPPrefixesClientListAllResponse]{ + More: func(page CustomIPPrefixesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CustomIPPrefixesClientListAllResponse) (CustomIPPrefixesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CustomIPPrefixesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomIPPrefixesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomIPPrefixesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *CustomIPPrefixesClient) listAllCreateRequest(ctx context.Context, options *CustomIPPrefixesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *CustomIPPrefixesClient) listAllHandleResponse(resp *http.Response) (CustomIPPrefixesClientListAllResponse, error) { + result := CustomIPPrefixesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefixListResult); err != nil { + return CustomIPPrefixesClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates custom IP prefix tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// customIPPrefixName - The name of the custom IP prefix. +// parameters - Parameters supplied to update custom IP prefix tags. +// options - CustomIPPrefixesClientUpdateTagsOptions contains the optional parameters for the CustomIPPrefixesClient.UpdateTags +// method. +func (client *CustomIPPrefixesClient) UpdateTags(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters TagsObject, options *CustomIPPrefixesClientUpdateTagsOptions) (CustomIPPrefixesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, customIPPrefixName, parameters, options) + if err != nil { + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomIPPrefixesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *CustomIPPrefixesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters TagsObject, options *CustomIPPrefixesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if customIPPrefixName == "" { + return nil, errors.New("parameter customIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customIpPrefixName}", url.PathEscape(customIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *CustomIPPrefixesClient) updateTagsHandleResponse(resp *http.Response) (CustomIPPrefixesClientUpdateTagsResponse, error) { + result := CustomIPPrefixesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefix); err != nil { + return CustomIPPrefixesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddoscustompolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddoscustompolicies_client.go new file mode 100644 index 000000000..97781e2df --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddoscustompolicies_client.go @@ -0,0 +1,302 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DdosCustomPoliciesClient contains the methods for the DdosCustomPolicies group. +// Don't use this type directly, use NewDdosCustomPoliciesClient() instead. +type DdosCustomPoliciesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDdosCustomPoliciesClient creates a new instance of DdosCustomPoliciesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDdosCustomPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DdosCustomPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DdosCustomPoliciesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosCustomPolicyName - The name of the DDoS custom policy. +// parameters - Parameters supplied to the create or update operation. +// options - DdosCustomPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the DdosCustomPoliciesClient.BeginCreateOrUpdate +// method. +func (client *DdosCustomPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy, options *DdosCustomPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[DdosCustomPoliciesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, ddosCustomPolicyName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DdosCustomPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[DdosCustomPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DdosCustomPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy, options *DdosCustomPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DdosCustomPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy, options *DdosCustomPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosCustomPolicyName == "" { + return nil, errors.New("parameter ddosCustomPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosCustomPolicyName}", url.PathEscape(ddosCustomPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosCustomPolicyName - The name of the DDoS custom policy. +// options - DdosCustomPoliciesClientBeginDeleteOptions contains the optional parameters for the DdosCustomPoliciesClient.BeginDelete +// method. +func (client *DdosCustomPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientBeginDeleteOptions) (*runtime.Poller[DdosCustomPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, ddosCustomPolicyName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DdosCustomPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DdosCustomPoliciesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DdosCustomPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DdosCustomPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosCustomPolicyName == "" { + return nil, errors.New("parameter ddosCustomPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosCustomPolicyName}", url.PathEscape(ddosCustomPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified DDoS custom policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosCustomPolicyName - The name of the DDoS custom policy. +// options - DdosCustomPoliciesClientGetOptions contains the optional parameters for the DdosCustomPoliciesClient.Get method. +func (client *DdosCustomPoliciesClient) Get(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientGetOptions) (DdosCustomPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, options) + if err != nil { + return DdosCustomPoliciesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosCustomPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosCustomPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DdosCustomPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, options *DdosCustomPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosCustomPolicyName == "" { + return nil, errors.New("parameter ddosCustomPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosCustomPolicyName}", url.PathEscape(ddosCustomPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DdosCustomPoliciesClient) getHandleResponse(resp *http.Response) (DdosCustomPoliciesClientGetResponse, error) { + result := DdosCustomPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosCustomPolicy); err != nil { + return DdosCustomPoliciesClientGetResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a DDoS custom policy tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosCustomPolicyName - The name of the DDoS custom policy. +// parameters - Parameters supplied to update DDoS custom policy resource tags. +// options - DdosCustomPoliciesClientUpdateTagsOptions contains the optional parameters for the DdosCustomPoliciesClient.UpdateTags +// method. +func (client *DdosCustomPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters TagsObject, options *DdosCustomPoliciesClientUpdateTagsOptions) (DdosCustomPoliciesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ddosCustomPolicyName, parameters, options) + if err != nil { + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosCustomPoliciesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *DdosCustomPoliciesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters TagsObject, options *DdosCustomPoliciesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosCustomPolicyName == "" { + return nil, errors.New("parameter ddosCustomPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosCustomPolicyName}", url.PathEscape(ddosCustomPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *DdosCustomPoliciesClient) updateTagsHandleResponse(resp *http.Response) (DdosCustomPoliciesClientUpdateTagsResponse, error) { + result := DdosCustomPoliciesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosCustomPolicy); err != nil { + return DdosCustomPoliciesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddosprotectionplans_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddosprotectionplans_client.go new file mode 100644 index 000000000..74bb77645 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ddosprotectionplans_client.go @@ -0,0 +1,425 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DdosProtectionPlansClient contains the methods for the DdosProtectionPlans group. +// Don't use this type directly, use NewDdosProtectionPlansClient() instead. +type DdosProtectionPlansClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDdosProtectionPlansClient creates a new instance of DdosProtectionPlansClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDdosProtectionPlansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DdosProtectionPlansClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DdosProtectionPlansClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosProtectionPlanName - The name of the DDoS protection plan. +// parameters - Parameters supplied to the create or update operation. +// options - DdosProtectionPlansClientBeginCreateOrUpdateOptions contains the optional parameters for the DdosProtectionPlansClient.BeginCreateOrUpdate +// method. +func (client *DdosProtectionPlansClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan, options *DdosProtectionPlansClientBeginCreateOrUpdateOptions) (*runtime.Poller[DdosProtectionPlansClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, ddosProtectionPlanName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DdosProtectionPlansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[DdosProtectionPlansClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DdosProtectionPlansClient) createOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan, options *DdosProtectionPlansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DdosProtectionPlansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan, options *DdosProtectionPlansClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosProtectionPlanName == "" { + return nil, errors.New("parameter ddosProtectionPlanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosProtectionPlanName}", url.PathEscape(ddosProtectionPlanName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosProtectionPlanName - The name of the DDoS protection plan. +// options - DdosProtectionPlansClientBeginDeleteOptions contains the optional parameters for the DdosProtectionPlansClient.BeginDelete +// method. +func (client *DdosProtectionPlansClient) BeginDelete(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientBeginDeleteOptions) (*runtime.Poller[DdosProtectionPlansClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, ddosProtectionPlanName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DdosProtectionPlansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DdosProtectionPlansClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DdosProtectionPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DdosProtectionPlansClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosProtectionPlanName == "" { + return nil, errors.New("parameter ddosProtectionPlanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosProtectionPlanName}", url.PathEscape(ddosProtectionPlanName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified DDoS protection plan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosProtectionPlanName - The name of the DDoS protection plan. +// options - DdosProtectionPlansClientGetOptions contains the optional parameters for the DdosProtectionPlansClient.Get method. +func (client *DdosProtectionPlansClient) Get(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientGetOptions) (DdosProtectionPlansClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, options) + if err != nil { + return DdosProtectionPlansClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosProtectionPlansClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosProtectionPlansClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DdosProtectionPlansClient) getCreateRequest(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, options *DdosProtectionPlansClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosProtectionPlanName == "" { + return nil, errors.New("parameter ddosProtectionPlanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosProtectionPlanName}", url.PathEscape(ddosProtectionPlanName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DdosProtectionPlansClient) getHandleResponse(resp *http.Response) (DdosProtectionPlansClientGetResponse, error) { + result := DdosProtectionPlansClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlan); err != nil { + return DdosProtectionPlansClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all DDoS protection plans in a subscription. +// Generated from API version 2022-05-01 +// options - DdosProtectionPlansClientListOptions contains the optional parameters for the DdosProtectionPlansClient.List +// method. +func (client *DdosProtectionPlansClient) NewListPager(options *DdosProtectionPlansClientListOptions) *runtime.Pager[DdosProtectionPlansClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DdosProtectionPlansClientListResponse]{ + More: func(page DdosProtectionPlansClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DdosProtectionPlansClientListResponse) (DdosProtectionPlansClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DdosProtectionPlansClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosProtectionPlansClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosProtectionPlansClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DdosProtectionPlansClient) listCreateRequest(ctx context.Context, options *DdosProtectionPlansClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DdosProtectionPlansClient) listHandleResponse(resp *http.Response) (DdosProtectionPlansClientListResponse, error) { + result := DdosProtectionPlansClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlanListResult); err != nil { + return DdosProtectionPlansClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all the DDoS protection plans in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - DdosProtectionPlansClientListByResourceGroupOptions contains the optional parameters for the DdosProtectionPlansClient.ListByResourceGroup +// method. +func (client *DdosProtectionPlansClient) NewListByResourceGroupPager(resourceGroupName string, options *DdosProtectionPlansClientListByResourceGroupOptions) *runtime.Pager[DdosProtectionPlansClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DdosProtectionPlansClientListByResourceGroupResponse]{ + More: func(page DdosProtectionPlansClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DdosProtectionPlansClientListByResourceGroupResponse) (DdosProtectionPlansClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DdosProtectionPlansClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosProtectionPlansClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosProtectionPlansClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DdosProtectionPlansClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DdosProtectionPlansClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DdosProtectionPlansClient) listByResourceGroupHandleResponse(resp *http.Response) (DdosProtectionPlansClientListByResourceGroupResponse, error) { + result := DdosProtectionPlansClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlanListResult); err != nil { + return DdosProtectionPlansClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Update a DDoS protection plan tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ddosProtectionPlanName - The name of the DDoS protection plan. +// parameters - Parameters supplied to the update DDoS protection plan resource tags. +// options - DdosProtectionPlansClientUpdateTagsOptions contains the optional parameters for the DdosProtectionPlansClient.UpdateTags +// method. +func (client *DdosProtectionPlansClient) UpdateTags(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters TagsObject, options *DdosProtectionPlansClientUpdateTagsOptions) (DdosProtectionPlansClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ddosProtectionPlanName, parameters, options) + if err != nil { + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DdosProtectionPlansClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *DdosProtectionPlansClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters TagsObject, options *DdosProtectionPlansClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ddosProtectionPlanName == "" { + return nil, errors.New("parameter ddosProtectionPlanName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ddosProtectionPlanName}", url.PathEscape(ddosProtectionPlanName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *DdosProtectionPlansClient) updateTagsHandleResponse(resp *http.Response) (DdosProtectionPlansClientUpdateTagsResponse, error) { + result := DdosProtectionPlansClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlan); err != nil { + return DdosProtectionPlansClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/defaultsecurityrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/defaultsecurityrules_client.go new file mode 100644 index 000000000..39c155a9f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/defaultsecurityrules_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DefaultSecurityRulesClient contains the methods for the DefaultSecurityRules group. +// Don't use this type directly, use NewDefaultSecurityRulesClient() instead. +type DefaultSecurityRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDefaultSecurityRulesClient creates a new instance of DefaultSecurityRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDefaultSecurityRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DefaultSecurityRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DefaultSecurityRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get the specified default network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// defaultSecurityRuleName - The name of the default security rule. +// options - DefaultSecurityRulesClientGetOptions contains the optional parameters for the DefaultSecurityRulesClient.Get +// method. +func (client *DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string, options *DefaultSecurityRulesClientGetOptions) (DefaultSecurityRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options) + if err != nil { + return DefaultSecurityRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DefaultSecurityRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DefaultSecurityRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DefaultSecurityRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string, options *DefaultSecurityRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if defaultSecurityRuleName == "" { + return nil, errors.New("parameter defaultSecurityRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{defaultSecurityRuleName}", url.PathEscape(defaultSecurityRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DefaultSecurityRulesClient) getHandleResponse(resp *http.Response) (DefaultSecurityRulesClientGetResponse, error) { + result := DefaultSecurityRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRule); err != nil { + return DefaultSecurityRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all default security rules in a network security group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// options - DefaultSecurityRulesClientListOptions contains the optional parameters for the DefaultSecurityRulesClient.List +// method. +func (client *DefaultSecurityRulesClient) NewListPager(resourceGroupName string, networkSecurityGroupName string, options *DefaultSecurityRulesClientListOptions) *runtime.Pager[DefaultSecurityRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DefaultSecurityRulesClientListResponse]{ + More: func(page DefaultSecurityRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DefaultSecurityRulesClientListResponse) (DefaultSecurityRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DefaultSecurityRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DefaultSecurityRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DefaultSecurityRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DefaultSecurityRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *DefaultSecurityRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DefaultSecurityRulesClient) listHandleResponse(resp *http.Response) (DefaultSecurityRulesClientListResponse, error) { + result := DefaultSecurityRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRuleListResult); err != nil { + return DefaultSecurityRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/dscpconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/dscpconfiguration_client.go new file mode 100644 index 000000000..ca1793abe --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/dscpconfiguration_client.go @@ -0,0 +1,366 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DscpConfigurationClient contains the methods for the DscpConfiguration group. +// Don't use this type directly, use NewDscpConfigurationClient() instead. +type DscpConfigurationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDscpConfigurationClient creates a new instance of DscpConfigurationClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDscpConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DscpConfigurationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DscpConfigurationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// dscpConfigurationName - The name of the resource. +// parameters - Parameters supplied to the create or update dscp configuration operation. +// options - DscpConfigurationClientBeginCreateOrUpdateOptions contains the optional parameters for the DscpConfigurationClient.BeginCreateOrUpdate +// method. +func (client *DscpConfigurationClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration, options *DscpConfigurationClientBeginCreateOrUpdateOptions) (*runtime.Poller[DscpConfigurationClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, dscpConfigurationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DscpConfigurationClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DscpConfigurationClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DscpConfigurationClient) createOrUpdate(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration, options *DscpConfigurationClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dscpConfigurationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DscpConfigurationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration, options *DscpConfigurationClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dscpConfigurationName == "" { + return nil, errors.New("parameter dscpConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dscpConfigurationName}", url.PathEscape(dscpConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// dscpConfigurationName - The name of the resource. +// options - DscpConfigurationClientBeginDeleteOptions contains the optional parameters for the DscpConfigurationClient.BeginDelete +// method. +func (client *DscpConfigurationClient) BeginDelete(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientBeginDeleteOptions) (*runtime.Poller[DscpConfigurationClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, dscpConfigurationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DscpConfigurationClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DscpConfigurationClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *DscpConfigurationClient) deleteOperation(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dscpConfigurationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DscpConfigurationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dscpConfigurationName == "" { + return nil, errors.New("parameter dscpConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dscpConfigurationName}", url.PathEscape(dscpConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a DSCP Configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// dscpConfigurationName - The name of the resource. +// options - DscpConfigurationClientGetOptions contains the optional parameters for the DscpConfigurationClient.Get method. +func (client *DscpConfigurationClient) Get(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientGetOptions) (DscpConfigurationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dscpConfigurationName, options) + if err != nil { + return DscpConfigurationClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DscpConfigurationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DscpConfigurationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DscpConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, dscpConfigurationName string, options *DscpConfigurationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if dscpConfigurationName == "" { + return nil, errors.New("parameter dscpConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dscpConfigurationName}", url.PathEscape(dscpConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DscpConfigurationClient) getHandleResponse(resp *http.Response) (DscpConfigurationClientGetResponse, error) { + result := DscpConfigurationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfiguration); err != nil { + return DscpConfigurationClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a DSCP Configuration. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - DscpConfigurationClientListOptions contains the optional parameters for the DscpConfigurationClient.List method. +func (client *DscpConfigurationClient) NewListPager(resourceGroupName string, options *DscpConfigurationClientListOptions) *runtime.Pager[DscpConfigurationClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DscpConfigurationClientListResponse]{ + More: func(page DscpConfigurationClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DscpConfigurationClientListResponse) (DscpConfigurationClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DscpConfigurationClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DscpConfigurationClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DscpConfigurationClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DscpConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *DscpConfigurationClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DscpConfigurationClient) listHandleResponse(resp *http.Response) (DscpConfigurationClientListResponse, error) { + result := DscpConfigurationClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfigurationListResult); err != nil { + return DscpConfigurationClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all dscp configurations in a subscription. +// Generated from API version 2022-05-01 +// options - DscpConfigurationClientListAllOptions contains the optional parameters for the DscpConfigurationClient.ListAll +// method. +func (client *DscpConfigurationClient) NewListAllPager(options *DscpConfigurationClientListAllOptions) *runtime.Pager[DscpConfigurationClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[DscpConfigurationClientListAllResponse]{ + More: func(page DscpConfigurationClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DscpConfigurationClientListAllResponse) (DscpConfigurationClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DscpConfigurationClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DscpConfigurationClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DscpConfigurationClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *DscpConfigurationClient) listAllCreateRequest(ctx context.Context, options *DscpConfigurationClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *DscpConfigurationClient) listAllHandleResponse(resp *http.Response) (DscpConfigurationClientListAllResponse, error) { + result := DscpConfigurationClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfigurationListResult); err != nil { + return DscpConfigurationClientListAllResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitauthorizations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitauthorizations_client.go new file mode 100644 index 000000000..ff31639a4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitauthorizations_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCircuitAuthorizationsClient contains the methods for the ExpressRouteCircuitAuthorizations group. +// Don't use this type directly, use NewExpressRouteCircuitAuthorizationsClient() instead. +type ExpressRouteCircuitAuthorizationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCircuitAuthorizationsClient creates a new instance of ExpressRouteCircuitAuthorizationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCircuitAuthorizationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitAuthorizationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an authorization in the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// authorizationName - The name of the authorization. +// authorizationParameters - Parameters supplied to the create or update express route circuit authorization operation. +// options - ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteCircuitAuthorizationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, options *ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an authorization in the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitAuthorizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, options *ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCircuitAuthorizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, options *ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, authorizationParameters) +} + +// BeginDelete - Deletes the specified authorization from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// authorizationName - The name of the authorization. +// options - ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.BeginDelete +// method. +func (client *ExpressRouteCircuitAuthorizationsClient) BeginDelete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCircuitAuthorizationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, circuitName, authorizationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitAuthorizationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitAuthorizationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified authorization from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitAuthorizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteCircuitAuthorizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified authorization from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// authorizationName - The name of the authorization. +// options - ExpressRouteCircuitAuthorizationsClientGetOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.Get +// method. +func (client *ExpressRouteCircuitAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientGetOptions) (ExpressRouteCircuitAuthorizationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, authorizationName, options) + if err != nil { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCircuitAuthorizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, options *ExpressRouteCircuitAuthorizationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCircuitAuthorizationsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitAuthorizationsClientGetResponse, error) { + result := ExpressRouteCircuitAuthorizationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitAuthorization); err != nil { + return ExpressRouteCircuitAuthorizationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all authorizations in an express route circuit. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the circuit. +// options - ExpressRouteCircuitAuthorizationsClientListOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.List +// method. +func (client *ExpressRouteCircuitAuthorizationsClient) NewListPager(resourceGroupName string, circuitName string, options *ExpressRouteCircuitAuthorizationsClientListOptions) *runtime.Pager[ExpressRouteCircuitAuthorizationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitAuthorizationsClientListResponse]{ + More: func(page ExpressRouteCircuitAuthorizationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCircuitAuthorizationsClientListResponse) (ExpressRouteCircuitAuthorizationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, circuitName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCircuitAuthorizationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitAuthorizationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitAuthorizationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCircuitAuthorizationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitAuthorizationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCircuitAuthorizationsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitAuthorizationsClientListResponse, error) { + result := ExpressRouteCircuitAuthorizationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationListResult); err != nil { + return ExpressRouteCircuitAuthorizationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitconnections_client.go new file mode 100644 index 000000000..a54dc444a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitconnections_client.go @@ -0,0 +1,350 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCircuitConnectionsClient contains the methods for the ExpressRouteCircuitConnections group. +// Don't use this type directly, use NewExpressRouteCircuitConnectionsClient() instead. +type ExpressRouteCircuitConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCircuitConnectionsClient creates a new instance of ExpressRouteCircuitConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCircuitConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCircuitConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Express Route Circuit Connection in the specified express route circuits. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// connectionName - The name of the express route circuit connection. +// expressRouteCircuitConnectionParameters - Parameters supplied to the create or update express route circuit connection +// operation. +// options - ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteCircuitConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection, options *ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a Express Route Circuit Connection in the specified express route circuits. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection, options *ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCircuitConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection, options *ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, expressRouteCircuitConnectionParameters) +} + +// BeginDelete - Deletes the specified Express Route Circuit Connection from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// connectionName - The name of the express route circuit connection. +// options - ExpressRouteCircuitConnectionsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.BeginDelete +// method. +func (client *ExpressRouteCircuitConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCircuitConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Express Route Circuit Connection from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteCircuitConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Express Route Circuit Connection from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// connectionName - The name of the express route circuit connection. +// options - ExpressRouteCircuitConnectionsClientGetOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.Get +// method. +func (client *ExpressRouteCircuitConnectionsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientGetOptions) (ExpressRouteCircuitConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCircuitConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *ExpressRouteCircuitConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCircuitConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitConnectionsClientGetResponse, error) { + result := ExpressRouteCircuitConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitConnection); err != nil { + return ExpressRouteCircuitConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all global reach connections associated with a private peering in an express route circuit. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the circuit. +// peeringName - The name of the peering. +// options - ExpressRouteCircuitConnectionsClientListOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.List +// method. +func (client *ExpressRouteCircuitConnectionsClient) NewListPager(resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitConnectionsClientListOptions) *runtime.Pager[ExpressRouteCircuitConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitConnectionsClientListResponse]{ + More: func(page ExpressRouteCircuitConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCircuitConnectionsClientListResponse) (ExpressRouteCircuitConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCircuitConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCircuitConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCircuitConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitConnectionsClientListResponse, error) { + result := ExpressRouteCircuitConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitConnectionListResult); err != nil { + return ExpressRouteCircuitConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitpeerings_client.go new file mode 100644 index 000000000..420d5fafa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuitpeerings_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCircuitPeeringsClient contains the methods for the ExpressRouteCircuitPeerings group. +// Don't use this type directly, use NewExpressRouteCircuitPeeringsClient() instead. +type ExpressRouteCircuitPeeringsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCircuitPeeringsClient creates a new instance of ExpressRouteCircuitPeeringsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCircuitPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCircuitPeeringsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitPeeringsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a peering in the specified express route circuits. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// peeringParameters - Parameters supplied to the create or update express route circuit peering operation. +// options - ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteCircuitPeeringsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, options *ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, circuitName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a peering in the specified express route circuits. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, options *ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCircuitPeeringsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, options *ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, peeringParameters) +} + +// BeginDelete - Deletes the specified peering from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// options - ExpressRouteCircuitPeeringsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.BeginDelete +// method. +func (client *ExpressRouteCircuitPeeringsClient) BeginDelete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCircuitPeeringsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitPeeringsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified peering from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteCircuitPeeringsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified peering for the express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// options - ExpressRouteCircuitPeeringsClientGetOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.Get +// method. +func (client *ExpressRouteCircuitPeeringsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientGetOptions) (ExpressRouteCircuitPeeringsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitPeeringsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCircuitPeeringsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitPeeringsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCircuitPeeringsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitPeeringsClientGetResponse, error) { + result := ExpressRouteCircuitPeeringsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitPeering); err != nil { + return ExpressRouteCircuitPeeringsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all peerings in a specified express route circuit. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// options - ExpressRouteCircuitPeeringsClientListOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.List +// method. +func (client *ExpressRouteCircuitPeeringsClient) NewListPager(resourceGroupName string, circuitName string, options *ExpressRouteCircuitPeeringsClientListOptions) *runtime.Pager[ExpressRouteCircuitPeeringsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitPeeringsClientListResponse]{ + More: func(page ExpressRouteCircuitPeeringsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCircuitPeeringsClientListResponse) (ExpressRouteCircuitPeeringsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, circuitName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCircuitPeeringsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitPeeringsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitPeeringsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCircuitPeeringsClient) listCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitPeeringsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCircuitPeeringsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitPeeringsClientListResponse, error) { + result := ExpressRouteCircuitPeeringsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitPeeringListResult); err != nil { + return ExpressRouteCircuitPeeringsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuits_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuits_client.go new file mode 100644 index 000000000..985093fce --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecircuits_client.go @@ -0,0 +1,773 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCircuitsClient contains the methods for the ExpressRouteCircuits group. +// Don't use this type directly, use NewExpressRouteCircuitsClient() instead. +type ExpressRouteCircuitsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCircuitsClient creates a new instance of ExpressRouteCircuitsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCircuitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCircuitsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCircuitsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the circuit. +// parameters - Parameters supplied to the create or update express route circuit operation. +// options - ExpressRouteCircuitsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteCircuitsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCircuitsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, circuitName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCircuitsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// options - ExpressRouteCircuitsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginDelete +// method. +func (client *ExpressRouteCircuitsClient) BeginDelete(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCircuitsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, circuitName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteCircuitsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of express route circuit. +// options - ExpressRouteCircuitsClientGetOptions contains the optional parameters for the ExpressRouteCircuitsClient.Get +// method. +func (client *ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetOptions) (ExpressRouteCircuitsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return ExpressRouteCircuitsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCircuitsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCircuitsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetResponse, error) { + result := ExpressRouteCircuitsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { + return ExpressRouteCircuitsClientGetResponse{}, err + } + return result, nil +} + +// GetPeeringStats - Gets all stats from an express route circuit in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// options - ExpressRouteCircuitsClientGetPeeringStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetPeeringStats +// method. +func (client *ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitsClientGetPeeringStatsOptions) (ExpressRouteCircuitsClientGetPeeringStatsResponse, error) { + req, err := client.getPeeringStatsCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + if err != nil { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, runtime.NewResponseError(resp) + } + return client.getPeeringStatsHandleResponse(resp) +} + +// getPeeringStatsCreateRequest creates the GetPeeringStats request. +func (client *ExpressRouteCircuitsClient) getPeeringStatsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitsClientGetPeeringStatsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPeeringStatsHandleResponse handles the GetPeeringStats response. +func (client *ExpressRouteCircuitsClient) getPeeringStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetPeeringStatsResponse, error) { + result := ExpressRouteCircuitsClientGetPeeringStatsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { + return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err + } + return result, nil +} + +// GetStats - Gets all the stats from an express route circuit in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// options - ExpressRouteCircuitsClientGetStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetStats +// method. +func (client *ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetStatsOptions) (ExpressRouteCircuitsClientGetStatsResponse, error) { + req, err := client.getStatsCreateRequest(ctx, resourceGroupName, circuitName, options) + if err != nil { + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientGetStatsResponse{}, runtime.NewResponseError(resp) + } + return client.getStatsHandleResponse(resp) +} + +// getStatsCreateRequest creates the GetStats request. +func (client *ExpressRouteCircuitsClient) getStatsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetStatsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getStatsHandleResponse handles the GetStats response. +func (client *ExpressRouteCircuitsClient) getStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetStatsResponse, error) { + result := ExpressRouteCircuitsClientGetStatsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { + return ExpressRouteCircuitsClientGetStatsResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the express route circuits in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ExpressRouteCircuitsClientListOptions contains the optional parameters for the ExpressRouteCircuitsClient.List +// method. +func (client *ExpressRouteCircuitsClient) NewListPager(resourceGroupName string, options *ExpressRouteCircuitsClientListOptions) *runtime.Pager[ExpressRouteCircuitsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitsClientListResponse]{ + More: func(page ExpressRouteCircuitsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCircuitsClientListResponse) (ExpressRouteCircuitsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCircuitsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCircuitsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteCircuitsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCircuitsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientListResponse, error) { + result := ExpressRouteCircuitsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { + return ExpressRouteCircuitsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the express route circuits in a subscription. +// Generated from API version 2022-05-01 +// options - ExpressRouteCircuitsClientListAllOptions contains the optional parameters for the ExpressRouteCircuitsClient.ListAll +// method. +func (client *ExpressRouteCircuitsClient) NewListAllPager(options *ExpressRouteCircuitsClientListAllOptions) *runtime.Pager[ExpressRouteCircuitsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitsClientListAllResponse]{ + More: func(page ExpressRouteCircuitsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCircuitsClientListAllResponse) (ExpressRouteCircuitsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCircuitsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *ExpressRouteCircuitsClient) listAllCreateRequest(ctx context.Context, options *ExpressRouteCircuitsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *ExpressRouteCircuitsClient) listAllHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientListAllResponse, error) { + result := ExpressRouteCircuitsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { + return ExpressRouteCircuitsClientListAllResponse{}, err + } + return result, nil +} + +// BeginListArpTable - Gets the currently advertised ARP table associated with the express route circuit in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCircuitsClientBeginListArpTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListArpTable +// method. +func (client *ExpressRouteCircuitsClient) BeginListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*runtime.Poller[ExpressRouteCircuitsClientListArpTableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listArpTable(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitsClientListArpTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListArpTableResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListArpTable - Gets the currently advertised ARP table associated with the express route circuit in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitsClient) listArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*http.Response, error) { + req, err := client.listArpTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listArpTableCreateRequest creates the ListArpTable request. +func (client *ExpressRouteCircuitsClient) listArpTableCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListRoutesTable - Gets the currently advertised routes table associated with the express route circuit in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCircuitsClientBeginListRoutesTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTable +// method. +func (client *ExpressRouteCircuitsClient) BeginListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*runtime.Poller[ExpressRouteCircuitsClientListRoutesTableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listRoutesTable(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListRoutesTableResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListRoutesTable - Gets the currently advertised routes table associated with the express route circuit in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitsClient) listRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*http.Response, error) { + req, err := client.listRoutesTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listRoutesTableCreateRequest creates the ListRoutesTable request. +func (client *ExpressRouteCircuitsClient) listRoutesTableCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListRoutesTableSummary - Gets the currently advertised routes table summary associated with the express route circuit +// in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTableSummary +// method. +func (client *ExpressRouteCircuitsClient) BeginListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*runtime.Poller[ExpressRouteCircuitsClientListRoutesTableSummaryResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listRoutesTableSummary(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableSummaryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCircuitsClientListRoutesTableSummaryResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListRoutesTableSummary - Gets the currently advertised routes table summary associated with the express route circuit in +// a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCircuitsClient) listRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*http.Response, error) { + req, err := client.listRoutesTableSummaryCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listRoutesTableSummaryCreateRequest creates the ListRoutesTableSummary request. +func (client *ExpressRouteCircuitsClient) listRoutesTableSummaryCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateTags - Updates an express route circuit tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the circuit. +// parameters - Parameters supplied to update express route circuit tags. +// options - ExpressRouteCircuitsClientUpdateTagsOptions contains the optional parameters for the ExpressRouteCircuitsClient.UpdateTags +// method. +func (client *ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject, options *ExpressRouteCircuitsClientUpdateTagsOptions) (ExpressRouteCircuitsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) + if err != nil { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ExpressRouteCircuitsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject, options *ExpressRouteCircuitsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ExpressRouteCircuitsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientUpdateTagsResponse, error) { + result := ExpressRouteCircuitsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { + return ExpressRouteCircuitsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteconnections_client.go new file mode 100644 index 000000000..181e6839c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteconnections_client.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteConnectionsClient contains the methods for the ExpressRouteConnections group. +// Don't use this type directly, use NewExpressRouteConnectionsClient() instead. +type ExpressRouteConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteConnectionsClient creates a new instance of ExpressRouteConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// connectionName - The name of the connection subresource. +// putExpressRouteConnectionParameters - Parameters required in an ExpressRouteConnection PUT operation. +// options - ExpressRouteConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteConnectionsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection, options *ExpressRouteConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection, options *ExpressRouteConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection, options *ExpressRouteConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, putExpressRouteConnectionParameters) +} + +// BeginDelete - Deletes a connection to a ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// connectionName - The name of the connection subresource. +// options - ExpressRouteConnectionsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteConnectionsClient.BeginDelete +// method. +func (client *ExpressRouteConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, expressRouteGatewayName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a connection to a ExpressRoute circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified ExpressRouteConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// connectionName - The name of the ExpressRoute connection. +// options - ExpressRouteConnectionsClientGetOptions contains the optional parameters for the ExpressRouteConnectionsClient.Get +// method. +func (client *ExpressRouteConnectionsClient) Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientGetOptions) (ExpressRouteConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, connectionName, options) + if err != nil { + return ExpressRouteConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, options *ExpressRouteConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteConnectionsClientGetResponse, error) { + result := ExpressRouteConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteConnection); err != nil { + return ExpressRouteConnectionsClientGetResponse{}, err + } + return result, nil +} + +// List - Lists ExpressRouteConnections. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// options - ExpressRouteConnectionsClientListOptions contains the optional parameters for the ExpressRouteConnectionsClient.List +// method. +func (client *ExpressRouteConnectionsClient) List(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteConnectionsClientListOptions) (ExpressRouteConnectionsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return ExpressRouteConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteConnectionsClientListResponse, error) { + result := ExpressRouteConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteConnectionList); err != nil { + return ExpressRouteConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnectionpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnectionpeerings_client.go new file mode 100644 index 000000000..7bbcb7a0b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnectionpeerings_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCrossConnectionPeeringsClient contains the methods for the ExpressRouteCrossConnectionPeerings group. +// Don't use this type directly, use NewExpressRouteCrossConnectionPeeringsClient() instead. +type ExpressRouteCrossConnectionPeeringsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCrossConnectionPeeringsClient creates a new instance of ExpressRouteCrossConnectionPeeringsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCrossConnectionPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCrossConnectionPeeringsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCrossConnectionPeeringsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a peering in the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// peeringParameters - Parameters supplied to the create or update ExpressRouteCrossConnection peering operation. +// options - ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the +// ExpressRouteCrossConnectionPeeringsClient.BeginCreateOrUpdate method. +func (client *ExpressRouteCrossConnectionPeeringsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering, options *ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, crossConnectionName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a peering in the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering, options *ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, peeringParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCrossConnectionPeeringsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering, options *ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, peeringParameters) +} + +// BeginDelete - Deletes the specified peering from the ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// options - ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.BeginDelete +// method. +func (client *ExpressRouteCrossConnectionPeeringsClient) BeginDelete(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCrossConnectionPeeringsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, crossConnectionName, peeringName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionPeeringsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified peering from the ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteCrossConnectionPeeringsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified peering for the ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// options - ExpressRouteCrossConnectionPeeringsClientGetOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.Get +// method. +func (client *ExpressRouteCrossConnectionPeeringsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientGetOptions) (ExpressRouteCrossConnectionPeeringsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, options) + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCrossConnectionPeeringsClient) getCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, options *ExpressRouteCrossConnectionPeeringsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCrossConnectionPeeringsClient) getHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionPeeringsClientGetResponse, error) { + result := ExpressRouteCrossConnectionPeeringsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionPeering); err != nil { + return ExpressRouteCrossConnectionPeeringsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all peerings in a specified ExpressRouteCrossConnection. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// options - ExpressRouteCrossConnectionPeeringsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.List +// method. +func (client *ExpressRouteCrossConnectionPeeringsClient) NewListPager(resourceGroupName string, crossConnectionName string, options *ExpressRouteCrossConnectionPeeringsClientListOptions) *runtime.Pager[ExpressRouteCrossConnectionPeeringsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCrossConnectionPeeringsClientListResponse]{ + More: func(page ExpressRouteCrossConnectionPeeringsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCrossConnectionPeeringsClientListResponse) (ExpressRouteCrossConnectionPeeringsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, crossConnectionName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionPeeringsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionPeeringsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCrossConnectionPeeringsClient) listCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, options *ExpressRouteCrossConnectionPeeringsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCrossConnectionPeeringsClient) listHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionPeeringsClientListResponse, error) { + result := ExpressRouteCrossConnectionPeeringsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionPeeringList); err != nil { + return ExpressRouteCrossConnectionPeeringsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnections_client.go new file mode 100644 index 000000000..e68bc6231 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutecrossconnections_client.go @@ -0,0 +1,592 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteCrossConnectionsClient contains the methods for the ExpressRouteCrossConnections group. +// Don't use this type directly, use NewExpressRouteCrossConnectionsClient() instead. +type ExpressRouteCrossConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteCrossConnectionsClient creates a new instance of ExpressRouteCrossConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteCrossConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCrossConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteCrossConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Update the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// parameters - Parameters supplied to the update express route crossConnection operation. +// options - ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteCrossConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection, options *ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCrossConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, crossConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Update the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection, options *ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, crossConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteCrossConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection, options *ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Get - Gets details about the specified ExpressRouteCrossConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group (peering location of the circuit). +// crossConnectionName - The name of the ExpressRouteCrossConnection (service key of the circuit). +// options - ExpressRouteCrossConnectionsClientGetOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.Get +// method. +func (client *ExpressRouteCrossConnectionsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string, options *ExpressRouteCrossConnectionsClientGetOptions) (ExpressRouteCrossConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, crossConnectionName, options) + if err != nil { + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteCrossConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, options *ExpressRouteCrossConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteCrossConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientGetResponse, error) { + result := ExpressRouteCrossConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnection); err != nil { + return ExpressRouteCrossConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves all the ExpressRouteCrossConnections in a subscription. +// Generated from API version 2022-05-01 +// options - ExpressRouteCrossConnectionsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.List +// method. +func (client *ExpressRouteCrossConnectionsClient) NewListPager(options *ExpressRouteCrossConnectionsClientListOptions) *runtime.Pager[ExpressRouteCrossConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCrossConnectionsClientListResponse]{ + More: func(page ExpressRouteCrossConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCrossConnectionsClientListResponse) (ExpressRouteCrossConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCrossConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteCrossConnectionsClient) listCreateRequest(ctx context.Context, options *ExpressRouteCrossConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteCrossConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientListResponse, error) { + result := ExpressRouteCrossConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionListResult); err != nil { + return ExpressRouteCrossConnectionsClientListResponse{}, err + } + return result, nil +} + +// BeginListArpTable - Gets the currently advertised ARP table associated with the express route cross connection in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCrossConnectionsClientBeginListArpTableOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginListArpTable +// method. +func (client *ExpressRouteCrossConnectionsClient) BeginListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListArpTableOptions) (*runtime.Poller[ExpressRouteCrossConnectionsClientListArpTableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listArpTable(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListArpTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListArpTableResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListArpTable - Gets the currently advertised ARP table associated with the express route cross connection in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionsClient) listArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListArpTableOptions) (*http.Response, error) { + req, err := client.listArpTableCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listArpTableCreateRequest creates the ListArpTable request. +func (client *ExpressRouteCrossConnectionsClient) listArpTableCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListArpTableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByResourceGroupPager - Retrieves all the ExpressRouteCrossConnections in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ExpressRouteCrossConnectionsClientListByResourceGroupOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.ListByResourceGroup +// method. +func (client *ExpressRouteCrossConnectionsClient) NewListByResourceGroupPager(resourceGroupName string, options *ExpressRouteCrossConnectionsClientListByResourceGroupOptions) *runtime.Pager[ExpressRouteCrossConnectionsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteCrossConnectionsClientListByResourceGroupResponse]{ + More: func(page ExpressRouteCrossConnectionsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteCrossConnectionsClientListByResourceGroupResponse) (ExpressRouteCrossConnectionsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteCrossConnectionsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientListByResourceGroupResponse, error) { + result := ExpressRouteCrossConnectionsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionListResult); err != nil { + return ExpressRouteCrossConnectionsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginListRoutesTable - Gets the currently advertised routes table associated with the express route cross connection in +// a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginListRoutesTable +// method. +func (client *ExpressRouteCrossConnectionsClient) BeginListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions) (*runtime.Poller[ExpressRouteCrossConnectionsClientListRoutesTableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listRoutesTable(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListRoutesTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListRoutesTableResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListRoutesTable - Gets the currently advertised routes table associated with the express route cross connection in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionsClient) listRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions) (*http.Response, error) { + req, err := client.listRoutesTableCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listRoutesTableCreateRequest creates the ListRoutesTable request. +func (client *ExpressRouteCrossConnectionsClient) listRoutesTableCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListRoutesTableSummary - Gets the route table summary associated with the express route cross connection in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the ExpressRouteCrossConnection. +// peeringName - The name of the peering. +// devicePath - The path of the device. +// options - ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions contains the optional parameters for the +// ExpressRouteCrossConnectionsClient.BeginListRoutesTableSummary method. +func (client *ExpressRouteCrossConnectionsClient) BeginListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions) (*runtime.Poller[ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listRoutesTableSummary(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListRoutesTableSummary - Gets the route table summary associated with the express route cross connection in a resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteCrossConnectionsClient) listRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions) (*http.Response, error) { + req, err := client.listRoutesTableSummaryCreateRequest(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listRoutesTableSummaryCreateRequest creates the ListRoutesTableSummary request. +func (client *ExpressRouteCrossConnectionsClient) listRoutesTableSummaryCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string, options *ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if devicePath == "" { + return nil, errors.New("parameter devicePath cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateTags - Updates an express route cross connection tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// crossConnectionName - The name of the cross connection. +// crossConnectionParameters - Parameters supplied to update express route cross connection tags. +// options - ExpressRouteCrossConnectionsClientUpdateTagsOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.UpdateTags +// method. +func (client *ExpressRouteCrossConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject, options *ExpressRouteCrossConnectionsClientUpdateTagsOptions) (ExpressRouteCrossConnectionsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters, options) + if err != nil { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ExpressRouteCrossConnectionsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject, options *ExpressRouteCrossConnectionsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if crossConnectionName == "" { + return nil, errors.New("parameter crossConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{crossConnectionName}", url.PathEscape(crossConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, crossConnectionParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ExpressRouteCrossConnectionsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsClientUpdateTagsResponse, error) { + result := ExpressRouteCrossConnectionsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnection); err != nil { + return ExpressRouteCrossConnectionsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutegateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutegateways_client.go new file mode 100644 index 000000000..346244801 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutegateways_client.go @@ -0,0 +1,412 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteGatewaysClient contains the methods for the ExpressRouteGateways group. +// Don't use this type directly, use NewExpressRouteGatewaysClient() instead. +type ExpressRouteGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteGatewaysClient creates a new instance of ExpressRouteGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a ExpressRoute gateway in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// putExpressRouteGatewayParameters - Parameters required in an ExpressRoute gateway PUT operation. +// options - ExpressRouteGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginCreateOrUpdate +// method. +func (client *ExpressRouteGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway, options *ExpressRouteGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a ExpressRoute gateway in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway, options *ExpressRouteGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRouteGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway, options *ExpressRouteGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, putExpressRouteGatewayParameters) +} + +// BeginDelete - Deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway resource can only +// be deleted when there are no connection subresources. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// options - ExpressRouteGatewaysClientBeginDeleteOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginDelete +// method. +func (client *ExpressRouteGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway resource can only be deleted +// when there are no connection subresources. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRouteGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Fetches the details of a ExpressRoute gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRouteGatewayName - The name of the ExpressRoute gateway. +// options - ExpressRouteGatewaysClientGetOptions contains the optional parameters for the ExpressRouteGatewaysClient.Get +// method. +func (client *ExpressRouteGatewaysClient) Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientGetOptions) (ExpressRouteGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, options) + if err != nil { + return ExpressRouteGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, options *ExpressRouteGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteGatewaysClient) getHandleResponse(resp *http.Response) (ExpressRouteGatewaysClientGetResponse, error) { + result := ExpressRouteGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGateway); err != nil { + return ExpressRouteGatewaysClientGetResponse{}, err + } + return result, nil +} + +// ListByResourceGroup - Lists ExpressRoute gateways in a given resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ExpressRouteGatewaysClientListByResourceGroupOptions contains the optional parameters for the ExpressRouteGatewaysClient.ListByResourceGroup +// method. +func (client *ExpressRouteGatewaysClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, options *ExpressRouteGatewaysClientListByResourceGroupOptions) (ExpressRouteGatewaysClientListByResourceGroupResponse, error) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ExpressRouteGatewaysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteGatewaysClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ExpressRouteGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteGatewaysClientListByResourceGroupResponse, error) { + result := ExpressRouteGatewaysClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGatewayList); err != nil { + return ExpressRouteGatewaysClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListBySubscription - Lists ExpressRoute gateways under a given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ExpressRouteGatewaysClientListBySubscriptionOptions contains the optional parameters for the ExpressRouteGatewaysClient.ListBySubscription +// method. +func (client *ExpressRouteGatewaysClient) ListBySubscription(ctx context.Context, options *ExpressRouteGatewaysClientListBySubscriptionOptions) (ExpressRouteGatewaysClientListBySubscriptionResponse, error) { + req, err := client.listBySubscriptionCreateRequest(ctx, options) + if err != nil { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ExpressRouteGatewaysClient) listBySubscriptionCreateRequest(ctx context.Context, options *ExpressRouteGatewaysClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ExpressRouteGatewaysClient) listBySubscriptionHandleResponse(resp *http.Response) (ExpressRouteGatewaysClientListBySubscriptionResponse, error) { + result := ExpressRouteGatewaysClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGatewayList); err != nil { + return ExpressRouteGatewaysClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdateTags - Updates express route gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the ExpressRouteGateway. +// expressRouteGatewayName - The name of the gateway. +// expressRouteGatewayParameters - Parameters supplied to update a virtual wan express route gateway tags. +// options - ExpressRouteGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginUpdateTags +// method. +func (client *ExpressRouteGatewaysClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject, options *ExpressRouteGatewaysClientBeginUpdateTagsOptions) (*runtime.Poller[ExpressRouteGatewaysClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, expressRouteGatewayName, expressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRouteGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRouteGatewaysClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates express route gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRouteGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject, options *ExpressRouteGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, expressRouteGatewayName, expressRouteGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ExpressRouteGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject, options *ExpressRouteGatewaysClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRouteGatewayName == "" { + return nil, errors.New("parameter expressRouteGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRouteGatewayName}", url.PathEscape(expressRouteGatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, expressRouteGatewayParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutelinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutelinks_client.go new file mode 100644 index 000000000..645ab2764 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressroutelinks_client.go @@ -0,0 +1,186 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteLinksClient contains the methods for the ExpressRouteLinks group. +// Don't use this type directly, use NewExpressRouteLinksClient() instead. +type ExpressRouteLinksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteLinksClient creates a new instance of ExpressRouteLinksClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteLinksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteLinksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Retrieves the specified ExpressRouteLink resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the ExpressRoutePort resource. +// linkName - The name of the ExpressRouteLink resource. +// options - ExpressRouteLinksClientGetOptions contains the optional parameters for the ExpressRouteLinksClient.Get method. +func (client *ExpressRouteLinksClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, linkName string, options *ExpressRouteLinksClientGetOptions) (ExpressRouteLinksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, linkName, options) + if err != nil { + return ExpressRouteLinksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteLinksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRouteLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, linkName string, options *ExpressRouteLinksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + if linkName == "" { + return nil, errors.New("parameter linkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{linkName}", url.PathEscape(linkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRouteLinksClient) getHandleResponse(resp *http.Response) (ExpressRouteLinksClientGetResponse, error) { + result := ExpressRouteLinksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteLink); err != nil { + return ExpressRouteLinksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the ExpressRoutePort resource. +// options - ExpressRouteLinksClientListOptions contains the optional parameters for the ExpressRouteLinksClient.List method. +func (client *ExpressRouteLinksClient) NewListPager(resourceGroupName string, expressRoutePortName string, options *ExpressRouteLinksClientListOptions) *runtime.Pager[ExpressRouteLinksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteLinksClientListResponse]{ + More: func(page ExpressRouteLinksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteLinksClientListResponse) (ExpressRouteLinksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteLinksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteLinksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteLinksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRouteLinksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteLinksClient) listHandleResponse(resp *http.Response) (ExpressRouteLinksClientListResponse, error) { + result := ExpressRouteLinksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteLinkListResult); err != nil { + return ExpressRouteLinksClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportauthorizations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportauthorizations_client.go new file mode 100644 index 000000000..923c2c4e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportauthorizations_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRoutePortAuthorizationsClient contains the methods for the ExpressRoutePortAuthorizations group. +// Don't use this type directly, use NewExpressRoutePortAuthorizationsClient() instead. +type ExpressRoutePortAuthorizationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRoutePortAuthorizationsClient creates a new instance of ExpressRoutePortAuthorizationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRoutePortAuthorizationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRoutePortAuthorizationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortAuthorizationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an authorization in the specified express route port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the express route port. +// authorizationName - The name of the authorization. +// authorizationParameters - Parameters supplied to the create or update express route port authorization operation. +// options - ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRoutePortAuthorizationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization, options *ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, expressRoutePortName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an authorization in the specified express route port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRoutePortAuthorizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization, options *ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, authorizationParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRoutePortAuthorizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization, options *ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, authorizationParameters) +} + +// BeginDelete - Deletes the specified authorization from the specified express route port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the express route port. +// authorizationName - The name of the authorization. +// options - ExpressRoutePortAuthorizationsClientBeginDeleteOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.BeginDelete +// method. +func (client *ExpressRoutePortAuthorizationsClient) BeginDelete(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientBeginDeleteOptions) (*runtime.Poller[ExpressRoutePortAuthorizationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, expressRoutePortName, authorizationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRoutePortAuthorizationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortAuthorizationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified authorization from the specified express route port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRoutePortAuthorizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRoutePortAuthorizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified authorization from the specified express route port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the express route port. +// authorizationName - The name of the authorization. +// options - ExpressRoutePortAuthorizationsClientGetOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.Get +// method. +func (client *ExpressRoutePortAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientGetOptions) (ExpressRoutePortAuthorizationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, authorizationName, options) + if err != nil { + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortAuthorizationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRoutePortAuthorizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, options *ExpressRoutePortAuthorizationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + if authorizationName == "" { + return nil, errors.New("parameter authorizationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRoutePortAuthorizationsClient) getHandleResponse(resp *http.Response) (ExpressRoutePortAuthorizationsClientGetResponse, error) { + result := ExpressRoutePortAuthorizationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortAuthorization); err != nil { + return ExpressRoutePortAuthorizationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all authorizations in an express route port. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the express route port. +// options - ExpressRoutePortAuthorizationsClientListOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.List +// method. +func (client *ExpressRoutePortAuthorizationsClient) NewListPager(resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortAuthorizationsClientListOptions) *runtime.Pager[ExpressRoutePortAuthorizationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRoutePortAuthorizationsClientListResponse]{ + More: func(page ExpressRoutePortAuthorizationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRoutePortAuthorizationsClientListResponse) (ExpressRoutePortAuthorizationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRoutePortAuthorizationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortAuthorizationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortAuthorizationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRoutePortAuthorizationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortAuthorizationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRoutePortAuthorizationsClient) listHandleResponse(resp *http.Response) (ExpressRoutePortAuthorizationsClientListResponse, error) { + result := ExpressRoutePortAuthorizationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortAuthorizationListResult); err != nil { + return ExpressRoutePortAuthorizationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteports_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteports_client.go new file mode 100644 index 000000000..13ca7e04f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteports_client.go @@ -0,0 +1,482 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRoutePortsClient contains the methods for the ExpressRoutePorts group. +// Don't use this type directly, use NewExpressRoutePortsClient() instead. +type ExpressRoutePortsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRoutePortsClient creates a new instance of ExpressRoutePortsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRoutePortsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRoutePortsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the ExpressRoutePort resource. +// parameters - Parameters supplied to the create ExpressRoutePort operation. +// options - ExpressRoutePortsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRoutePortsClient.BeginCreateOrUpdate +// method. +func (client *ExpressRoutePortsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort, options *ExpressRoutePortsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRoutePortsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, expressRoutePortName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRoutePortsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRoutePortsClient) createOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort, options *ExpressRoutePortsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, expressRoutePortName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExpressRoutePortsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort, options *ExpressRoutePortsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the ExpressRoutePort resource. +// options - ExpressRoutePortsClientBeginDeleteOptions contains the optional parameters for the ExpressRoutePortsClient.BeginDelete +// method. +func (client *ExpressRoutePortsClient) BeginDelete(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientBeginDeleteOptions) (*runtime.Poller[ExpressRoutePortsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, expressRoutePortName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ExpressRoutePortsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ExpressRoutePortsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ExpressRoutePortsClient) deleteOperation(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ExpressRoutePortsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GenerateLOA - Generate a letter of authorization for the requested ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of ExpressRoutePort. +// request - Request parameters supplied to generate a letter of authorization. +// options - ExpressRoutePortsClientGenerateLOAOptions contains the optional parameters for the ExpressRoutePortsClient.GenerateLOA +// method. +func (client *ExpressRoutePortsClient) GenerateLOA(ctx context.Context, resourceGroupName string, expressRoutePortName string, request GenerateExpressRoutePortsLOARequest, options *ExpressRoutePortsClientGenerateLOAOptions) (ExpressRoutePortsClientGenerateLOAResponse, error) { + req, err := client.generateLOACreateRequest(ctx, resourceGroupName, expressRoutePortName, request, options) + if err != nil { + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsClientGenerateLOAResponse{}, runtime.NewResponseError(resp) + } + return client.generateLOAHandleResponse(resp) +} + +// generateLOACreateRequest creates the GenerateLOA request. +func (client *ExpressRoutePortsClient) generateLOACreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, request GenerateExpressRoutePortsLOARequest, options *ExpressRoutePortsClientGenerateLOAOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/generateLoa" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// generateLOAHandleResponse handles the GenerateLOA response. +func (client *ExpressRoutePortsClient) generateLOAHandleResponse(resp *http.Response) (ExpressRoutePortsClientGenerateLOAResponse, error) { + result := ExpressRoutePortsClientGenerateLOAResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GenerateExpressRoutePortsLOAResult); err != nil { + return ExpressRoutePortsClientGenerateLOAResponse{}, err + } + return result, nil +} + +// Get - Retrieves the requested ExpressRoutePort resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of ExpressRoutePort. +// options - ExpressRoutePortsClientGetOptions contains the optional parameters for the ExpressRoutePortsClient.Get method. +func (client *ExpressRoutePortsClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientGetOptions) (ExpressRoutePortsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, expressRoutePortName, options) + if err != nil { + return ExpressRoutePortsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRoutePortsClient) getCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, options *ExpressRoutePortsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRoutePortsClient) getHandleResponse(resp *http.Response) (ExpressRoutePortsClientGetResponse, error) { + result := ExpressRoutePortsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePort); err != nil { + return ExpressRoutePortsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all the ExpressRoutePort resources in the specified subscription. +// Generated from API version 2022-05-01 +// options - ExpressRoutePortsClientListOptions contains the optional parameters for the ExpressRoutePortsClient.List method. +func (client *ExpressRoutePortsClient) NewListPager(options *ExpressRoutePortsClientListOptions) *runtime.Pager[ExpressRoutePortsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRoutePortsClientListResponse]{ + More: func(page ExpressRoutePortsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRoutePortsClientListResponse) (ExpressRoutePortsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRoutePortsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRoutePortsClient) listCreateRequest(ctx context.Context, options *ExpressRoutePortsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRoutePortsClient) listHandleResponse(resp *http.Response) (ExpressRoutePortsClientListResponse, error) { + result := ExpressRoutePortsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortListResult); err != nil { + return ExpressRoutePortsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the ExpressRoutePort resources in the specified resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ExpressRoutePortsClientListByResourceGroupOptions contains the optional parameters for the ExpressRoutePortsClient.ListByResourceGroup +// method. +func (client *ExpressRoutePortsClient) NewListByResourceGroupPager(resourceGroupName string, options *ExpressRoutePortsClientListByResourceGroupOptions) *runtime.Pager[ExpressRoutePortsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRoutePortsClientListByResourceGroupResponse]{ + More: func(page ExpressRoutePortsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRoutePortsClientListByResourceGroupResponse) (ExpressRoutePortsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRoutePortsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ExpressRoutePortsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRoutePortsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ExpressRoutePortsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRoutePortsClientListByResourceGroupResponse, error) { + result := ExpressRoutePortsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortListResult); err != nil { + return ExpressRoutePortsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Update ExpressRoutePort tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// expressRoutePortName - The name of the ExpressRoutePort resource. +// parameters - Parameters supplied to update ExpressRoutePort resource tags. +// options - ExpressRoutePortsClientUpdateTagsOptions contains the optional parameters for the ExpressRoutePortsClient.UpdateTags +// method. +func (client *ExpressRoutePortsClient) UpdateTags(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters TagsObject, options *ExpressRoutePortsClientUpdateTagsOptions) (ExpressRoutePortsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, expressRoutePortName, parameters, options) + if err != nil { + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ExpressRoutePortsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters TagsObject, options *ExpressRoutePortsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if expressRoutePortName == "" { + return nil, errors.New("parameter expressRoutePortName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{expressRoutePortName}", url.PathEscape(expressRoutePortName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ExpressRoutePortsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRoutePortsClientUpdateTagsResponse, error) { + result := ExpressRoutePortsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePort); err != nil { + return ExpressRoutePortsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportslocations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportslocations_client.go new file mode 100644 index 000000000..65c792be0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteportslocations_client.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRoutePortsLocationsClient contains the methods for the ExpressRoutePortsLocations group. +// Don't use this type directly, use NewExpressRoutePortsLocationsClient() instead. +type ExpressRoutePortsLocationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRoutePortsLocationsClient creates a new instance of ExpressRoutePortsLocationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRoutePortsLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRoutePortsLocationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRoutePortsLocationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at said +// peering location. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// locationName - Name of the requested ExpressRoutePort peering location. +// options - ExpressRoutePortsLocationsClientGetOptions contains the optional parameters for the ExpressRoutePortsLocationsClient.Get +// method. +func (client *ExpressRoutePortsLocationsClient) Get(ctx context.Context, locationName string, options *ExpressRoutePortsLocationsClientGetOptions) (ExpressRoutePortsLocationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, locationName, options) + if err != nil { + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsLocationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ExpressRoutePortsLocationsClient) getCreateRequest(ctx context.Context, locationName string, options *ExpressRoutePortsLocationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExpressRoutePortsLocationsClient) getHandleResponse(resp *http.Response) (ExpressRoutePortsLocationsClientGetResponse, error) { + result := ExpressRoutePortsLocationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortsLocation); err != nil { + return ExpressRoutePortsLocationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each location. +// Available bandwidths can only be obtained when retrieving a specific peering location. +// Generated from API version 2022-05-01 +// options - ExpressRoutePortsLocationsClientListOptions contains the optional parameters for the ExpressRoutePortsLocationsClient.List +// method. +func (client *ExpressRoutePortsLocationsClient) NewListPager(options *ExpressRoutePortsLocationsClientListOptions) *runtime.Pager[ExpressRoutePortsLocationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRoutePortsLocationsClientListResponse]{ + More: func(page ExpressRoutePortsLocationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRoutePortsLocationsClientListResponse) (ExpressRoutePortsLocationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRoutePortsLocationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRoutePortsLocationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRoutePortsLocationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRoutePortsLocationsClient) listCreateRequest(ctx context.Context, options *ExpressRoutePortsLocationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRoutePortsLocationsClient) listHandleResponse(resp *http.Response) (ExpressRoutePortsLocationsClientListResponse, error) { + result := ExpressRoutePortsLocationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortsLocationListResult); err != nil { + return ExpressRoutePortsLocationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteproviderportslocation_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteproviderportslocation_client.go new file mode 100644 index 000000000..431d5e8ae --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteproviderportslocation_client.go @@ -0,0 +1,107 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteProviderPortsLocationClient contains the methods for the ExpressRouteProviderPortsLocation group. +// Don't use this type directly, use NewExpressRouteProviderPortsLocationClient() instead. +type ExpressRouteProviderPortsLocationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteProviderPortsLocationClient creates a new instance of ExpressRouteProviderPortsLocationClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteProviderPortsLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteProviderPortsLocationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteProviderPortsLocationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Retrieves all the ExpressRouteProviderPorts in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// options - ExpressRouteProviderPortsLocationClientListOptions contains the optional parameters for the ExpressRouteProviderPortsLocationClient.List +// method. +func (client *ExpressRouteProviderPortsLocationClient) List(ctx context.Context, options *ExpressRouteProviderPortsLocationClientListOptions) (ExpressRouteProviderPortsLocationClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteProviderPortsLocationClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteProviderPortsLocationClient) listCreateRequest(ctx context.Context, options *ExpressRouteProviderPortsLocationClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteProviderPortsLocationClient) listHandleResponse(resp *http.Response) (ExpressRouteProviderPortsLocationClientListResponse, error) { + result := ExpressRouteProviderPortsLocationClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteProviderPortListResult); err != nil { + return ExpressRouteProviderPortsLocationClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteserviceproviders_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteserviceproviders_client.go new file mode 100644 index 000000000..558236225 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/expressrouteserviceproviders_client.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExpressRouteServiceProvidersClient contains the methods for the ExpressRouteServiceProviders group. +// Don't use this type directly, use NewExpressRouteServiceProvidersClient() instead. +type ExpressRouteServiceProvidersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewExpressRouteServiceProvidersClient creates a new instance of ExpressRouteServiceProvidersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewExpressRouteServiceProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteServiceProvidersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ExpressRouteServiceProvidersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets all the available express route service providers. +// Generated from API version 2022-05-01 +// options - ExpressRouteServiceProvidersClientListOptions contains the optional parameters for the ExpressRouteServiceProvidersClient.List +// method. +func (client *ExpressRouteServiceProvidersClient) NewListPager(options *ExpressRouteServiceProvidersClientListOptions) *runtime.Pager[ExpressRouteServiceProvidersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExpressRouteServiceProvidersClientListResponse]{ + More: func(page ExpressRouteServiceProvidersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExpressRouteServiceProvidersClientListResponse) (ExpressRouteServiceProvidersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ExpressRouteServiceProvidersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ExpressRouteServiceProvidersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExpressRouteServiceProvidersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ExpressRouteServiceProvidersClient) listCreateRequest(ctx context.Context, options *ExpressRouteServiceProvidersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExpressRouteServiceProvidersClient) listHandleResponse(resp *http.Response) (ExpressRouteServiceProvidersClientListResponse, error) { + result := ExpressRouteServiceProvidersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteServiceProviderListResult); err != nil { + return ExpressRouteServiceProvidersClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicies_client.go new file mode 100644 index 000000000..76ec831cf --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicies_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPoliciesClient contains the methods for the FirewallPolicies group. +// Don't use this type directly, use NewFirewallPoliciesClient() instead. +type FirewallPoliciesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFirewallPoliciesClient creates a new instance of FirewallPoliciesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFirewallPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FirewallPoliciesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// parameters - Parameters supplied to the create or update Firewall Policy operation. +// options - FirewallPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallPoliciesClient.BeginCreateOrUpdate +// method. +func (client *FirewallPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy, options *FirewallPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallPoliciesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FirewallPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy, options *FirewallPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FirewallPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy, options *FirewallPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPoliciesClientBeginDeleteOptions contains the optional parameters for the FirewallPoliciesClient.BeginDelete +// method. +func (client *FirewallPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientBeginDeleteOptions) (*runtime.Poller[FirewallPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallPoliciesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FirewallPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FirewallPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Firewall Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPoliciesClientGetOptions contains the optional parameters for the FirewallPoliciesClient.Get method. +func (client *FirewallPoliciesClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientGetOptions) (FirewallPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPoliciesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallPoliciesClient) getHandleResponse(resp *http.Response) (FirewallPoliciesClientGetResponse, error) { + result := FirewallPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicy); err != nil { + return FirewallPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all Firewall Policies in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - FirewallPoliciesClientListOptions contains the optional parameters for the FirewallPoliciesClient.List method. +func (client *FirewallPoliciesClient) NewListPager(resourceGroupName string, options *FirewallPoliciesClientListOptions) *runtime.Pager[FirewallPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallPoliciesClientListResponse]{ + More: func(page FirewallPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallPoliciesClientListResponse) (FirewallPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FirewallPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FirewallPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *FirewallPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FirewallPoliciesClient) listHandleResponse(resp *http.Response) (FirewallPoliciesClientListResponse, error) { + result := FirewallPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyListResult); err != nil { + return FirewallPoliciesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the Firewall Policies in a subscription. +// Generated from API version 2022-05-01 +// options - FirewallPoliciesClientListAllOptions contains the optional parameters for the FirewallPoliciesClient.ListAll +// method. +func (client *FirewallPoliciesClient) NewListAllPager(options *FirewallPoliciesClientListAllOptions) *runtime.Pager[FirewallPoliciesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallPoliciesClientListAllResponse]{ + More: func(page FirewallPoliciesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallPoliciesClientListAllResponse) (FirewallPoliciesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FirewallPoliciesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPoliciesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPoliciesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *FirewallPoliciesClient) listAllCreateRequest(ctx context.Context, options *FirewallPoliciesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *FirewallPoliciesClient) listAllHandleResponse(resp *http.Response) (FirewallPoliciesClientListAllResponse, error) { + result := FirewallPoliciesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyListResult); err != nil { + return FirewallPoliciesClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags of a Azure Firewall Policy resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// parameters - Parameters supplied to update Azure Firewall Policy tags. +// options - FirewallPoliciesClientUpdateTagsOptions contains the optional parameters for the FirewallPoliciesClient.UpdateTags +// method. +func (client *FirewallPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters TagsObject, options *FirewallPoliciesClientUpdateTagsOptions) (FirewallPoliciesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPoliciesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *FirewallPoliciesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters TagsObject, options *FirewallPoliciesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *FirewallPoliciesClient) updateTagsHandleResponse(resp *http.Response) (FirewallPoliciesClientUpdateTagsResponse, error) { + result := FirewallPoliciesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicy); err != nil { + return FirewallPoliciesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignatures_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignatures_client.go new file mode 100644 index 000000000..9f810d2ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignatures_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesClient contains the methods for the FirewallPolicyIdpsSignatures group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesClient() instead. +type FirewallPolicyIdpsSignaturesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFirewallPolicyIdpsSignaturesClient creates a new instance of FirewallPolicyIdpsSignaturesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFirewallPolicyIdpsSignaturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallPolicyIdpsSignaturesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Retrieves the current status of IDPS signatures for the relevant policy +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPolicyIdpsSignaturesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesClient.List +// method. +func (client *FirewallPolicyIdpsSignaturesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject, options *FirewallPolicyIdpsSignaturesClientListOptions) (FirewallPolicyIdpsSignaturesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject, options *FirewallPolicyIdpsSignaturesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsSignatures" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesClientListResponse, error) { + result := FirewallPolicyIdpsSignaturesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QueryResults); err != nil { + return FirewallPolicyIdpsSignaturesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesfiltervalues_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesfiltervalues_client.go new file mode 100644 index 000000000..909e42cd1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesfiltervalues_client.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesFilterValuesClient contains the methods for the FirewallPolicyIdpsSignaturesFilterValues group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesFilterValuesClient() instead. +type FirewallPolicyIdpsSignaturesFilterValuesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFirewallPolicyIdpsSignaturesFilterValuesClient creates a new instance of FirewallPolicyIdpsSignaturesFilterValuesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFirewallPolicyIdpsSignaturesFilterValuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallPolicyIdpsSignaturesFilterValuesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesFilterValuesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Retrieves the current filter values for the signatures overrides +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPolicyIdpsSignaturesFilterValuesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesFilterValuesClient.List +// method. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignatureOverridesFilterValuesQuery, options *FirewallPolicyIdpsSignaturesFilterValuesClientListOptions) (FirewallPolicyIdpsSignaturesFilterValuesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignatureOverridesFilterValuesQuery, options *FirewallPolicyIdpsSignaturesFilterValuesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesFilterValuesClientListResponse, error) { + result := FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SignatureOverridesFilterValuesResponse); err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesoverrides_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesoverrides_client.go new file mode 100644 index 000000000..36d92a24b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyidpssignaturesoverrides_client.go @@ -0,0 +1,287 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesOverridesClient contains the methods for the FirewallPolicyIdpsSignaturesOverrides group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesOverridesClient() instead. +type FirewallPolicyIdpsSignaturesOverridesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFirewallPolicyIdpsSignaturesOverridesClient creates a new instance of FirewallPolicyIdpsSignaturesOverridesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFirewallPolicyIdpsSignaturesOverridesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallPolicyIdpsSignaturesOverridesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyIdpsSignaturesOverridesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Returns all signatures overrides for a specific policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPolicyIdpsSignaturesOverridesClientGetOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Get +// method. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesClientGetOptions) (FirewallPolicyIdpsSignaturesOverridesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) getHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesClientGetResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientGetResponse{}, err + } + return result, nil +} + +// List - Returns all signatures overrides objects for a specific policy as a list containing a single value. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPolicyIdpsSignaturesOverridesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.List +// method. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesClientListOptions) (FirewallPolicyIdpsSignaturesOverridesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesClientListResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverridesList); err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientListResponse{}, err + } + return result, nil +} + +// Patch - Will update the status of policy's signature overrides for IDPS +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// parameters - Will contain all properties of the object to put +// options - FirewallPolicyIdpsSignaturesOverridesClientPatchOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Patch +// method. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Patch(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesClientPatchOptions) (FirewallPolicyIdpsSignaturesOverridesClientPatchResponse, error) { + req, err := client.patchCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, runtime.NewResponseError(resp) + } + return client.patchHandleResponse(resp) +} + +// patchCreateRequest creates the Patch request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// patchHandleResponse handles the Patch response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) patchHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesClientPatchResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPatchResponse{}, err + } + return result, nil +} + +// Put - Will override/create a new signature overrides for the policy's IDPS +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// parameters - Will contain all properties of the object to put +// options - FirewallPolicyIdpsSignaturesOverridesClientPutOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Put +// method. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Put(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesClientPutOptions) (FirewallPolicyIdpsSignaturesOverridesClientPutResponse, error) { + req, err := client.putCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) putCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// putHandleResponse handles the Put response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) putHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesClientPutResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesClientPutResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyrulecollectiongroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyrulecollectiongroups_client.go new file mode 100644 index 000000000..4a3b83d3f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/firewallpolicyrulecollectiongroups_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyRuleCollectionGroupsClient contains the methods for the FirewallPolicyRuleCollectionGroups group. +// Don't use this type directly, use NewFirewallPolicyRuleCollectionGroupsClient() instead. +type FirewallPolicyRuleCollectionGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFirewallPolicyRuleCollectionGroupsClient creates a new instance of FirewallPolicyRuleCollectionGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFirewallPolicyRuleCollectionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallPolicyRuleCollectionGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FirewallPolicyRuleCollectionGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// ruleCollectionGroupName - The name of the FirewallPolicyRuleCollectionGroup. +// parameters - Parameters supplied to the create or update FirewallPolicyRuleCollectionGroup operation. +// options - FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.BeginCreateOrUpdate +// method. +func (client *FirewallPolicyRuleCollectionGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup, options *FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FirewallPolicyRuleCollectionGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup, options *FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FirewallPolicyRuleCollectionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup, options *FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if ruleCollectionGroupName == "" { + return nil, errors.New("parameter ruleCollectionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionGroupName}", url.PathEscape(ruleCollectionGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// ruleCollectionGroupName - The name of the FirewallPolicyRuleCollectionGroup. +// options - FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.BeginDelete +// method. +func (client *FirewallPolicyRuleCollectionGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions) (*runtime.Poller[FirewallPolicyRuleCollectionGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallPolicyRuleCollectionGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallPolicyRuleCollectionGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FirewallPolicyRuleCollectionGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FirewallPolicyRuleCollectionGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if ruleCollectionGroupName == "" { + return nil, errors.New("parameter ruleCollectionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionGroupName}", url.PathEscape(ruleCollectionGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified FirewallPolicyRuleCollectionGroup. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// ruleCollectionGroupName - The name of the FirewallPolicyRuleCollectionGroup. +// options - FirewallPolicyRuleCollectionGroupsClientGetOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.Get +// method. +func (client *FirewallPolicyRuleCollectionGroupsClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientGetOptions) (FirewallPolicyRuleCollectionGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, options) + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallPolicyRuleCollectionGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, options *FirewallPolicyRuleCollectionGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if ruleCollectionGroupName == "" { + return nil, errors.New("parameter ruleCollectionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionGroupName}", url.PathEscape(ruleCollectionGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallPolicyRuleCollectionGroupsClient) getHandleResponse(resp *http.Response) (FirewallPolicyRuleCollectionGroupsClientGetResponse, error) { + result := FirewallPolicyRuleCollectionGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyRuleCollectionGroup); err != nil { + return FirewallPolicyRuleCollectionGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// firewallPolicyName - The name of the Firewall Policy. +// options - FirewallPolicyRuleCollectionGroupsClientListOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.List +// method. +func (client *FirewallPolicyRuleCollectionGroupsClient) NewListPager(resourceGroupName string, firewallPolicyName string, options *FirewallPolicyRuleCollectionGroupsClientListOptions) *runtime.Pager[FirewallPolicyRuleCollectionGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallPolicyRuleCollectionGroupsClientListResponse]{ + More: func(page FirewallPolicyRuleCollectionGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallPolicyRuleCollectionGroupsClientListResponse) (FirewallPolicyRuleCollectionGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyRuleCollectionGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyRuleCollectionGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyRuleCollectionGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyRuleCollectionGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyRuleCollectionGroupsClient) listHandleResponse(resp *http.Response) (FirewallPolicyRuleCollectionGroupsClientListResponse, error) { + result := FirewallPolicyRuleCollectionGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyRuleCollectionGroupListResult); err != nil { + return FirewallPolicyRuleCollectionGroupsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/flowlogs_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/flowlogs_client.go new file mode 100644 index 000000000..233d36687 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/flowlogs_client.go @@ -0,0 +1,388 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FlowLogsClient contains the methods for the FlowLogs group. +// Don't use this type directly, use NewFlowLogsClient() instead. +type FlowLogsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFlowLogsClient creates a new instance of FlowLogsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFlowLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FlowLogsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FlowLogsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a flow log for the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// flowLogName - The name of the flow log. +// parameters - Parameters that define the create or update flow log resource. +// options - FlowLogsClientBeginCreateOrUpdateOptions contains the optional parameters for the FlowLogsClient.BeginCreateOrUpdate +// method. +func (client *FlowLogsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog, options *FlowLogsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FlowLogsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FlowLogsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FlowLogsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a flow log for the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FlowLogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog, options *FlowLogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FlowLogsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog, options *FlowLogsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if flowLogName == "" { + return nil, errors.New("parameter flowLogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{flowLogName}", url.PathEscape(flowLogName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified flow log resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// flowLogName - The name of the flow log resource. +// options - FlowLogsClientBeginDeleteOptions contains the optional parameters for the FlowLogsClient.BeginDelete method. +func (client *FlowLogsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientBeginDeleteOptions) (*runtime.Poller[FlowLogsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkWatcherName, flowLogName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FlowLogsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[FlowLogsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified flow log resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *FlowLogsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FlowLogsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if flowLogName == "" { + return nil, errors.New("parameter flowLogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{flowLogName}", url.PathEscape(flowLogName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a flow log resource by name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// flowLogName - The name of the flow log resource. +// options - FlowLogsClientGetOptions contains the optional parameters for the FlowLogsClient.Get method. +func (client *FlowLogsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientGetOptions) (FlowLogsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, options) + if err != nil { + return FlowLogsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FlowLogsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FlowLogsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FlowLogsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, options *FlowLogsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if flowLogName == "" { + return nil, errors.New("parameter flowLogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{flowLogName}", url.PathEscape(flowLogName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FlowLogsClient) getHandleResponse(resp *http.Response) (FlowLogsClientGetResponse, error) { + result := FlowLogsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FlowLog); err != nil { + return FlowLogsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all flow log resources for the specified Network Watcher. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group containing Network Watcher. +// networkWatcherName - The name of the Network Watcher resource. +// options - FlowLogsClientListOptions contains the optional parameters for the FlowLogsClient.List method. +func (client *FlowLogsClient) NewListPager(resourceGroupName string, networkWatcherName string, options *FlowLogsClientListOptions) *runtime.Pager[FlowLogsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FlowLogsClientListResponse]{ + More: func(page FlowLogsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FlowLogsClientListResponse) (FlowLogsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FlowLogsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FlowLogsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FlowLogsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FlowLogsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, options *FlowLogsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FlowLogsClient) listHandleResponse(resp *http.Response) (FlowLogsClientListResponse, error) { + result := FlowLogsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FlowLogListResult); err != nil { + return FlowLogsClientListResponse{}, err + } + return result, nil +} + +// UpdateTags - Update tags of the specified flow log. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// flowLogName - The name of the flow log. +// parameters - Parameters supplied to update flow log tags. +// options - FlowLogsClientUpdateTagsOptions contains the optional parameters for the FlowLogsClient.UpdateTags method. +func (client *FlowLogsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters TagsObject, options *FlowLogsClientUpdateTagsOptions) (FlowLogsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters, options) + if err != nil { + return FlowLogsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FlowLogsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FlowLogsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *FlowLogsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters TagsObject, options *FlowLogsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if flowLogName == "" { + return nil, errors.New("parameter flowLogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{flowLogName}", url.PathEscape(flowLogName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *FlowLogsClient) updateTagsHandleResponse(resp *http.Response) (FlowLogsClientUpdateTagsResponse, error) { + result := FlowLogsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FlowLog); err != nil { + return FlowLogsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/groups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/groups_client.go new file mode 100644 index 000000000..3b37efb8b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/groups_client.go @@ -0,0 +1,333 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// GroupsClient contains the methods for the NetworkGroups group. +// Don't use this type directly, use NewGroupsClient() instead. +type GroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGroupsClient creates a new instance of GroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a network group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// parameters - Parameters supplied to the specify which network group need to create +// options - GroupsClientCreateOrUpdateOptions contains the optional parameters for the GroupsClient.CreateOrUpdate method. +func (client *GroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, parameters Group, options *GroupsClientCreateOrUpdateOptions) (GroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, parameters, options) + if err != nil { + return GroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, parameters Group, options *GroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *GroupsClient) createOrUpdateHandleResponse(resp *http.Response) (GroupsClientCreateOrUpdateResponse, error) { + result := GroupsClientCreateOrUpdateResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { + return GroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes a network group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// options - GroupsClientBeginDeleteOptions contains the optional parameters for the GroupsClient.BeginDelete method. +func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientBeginDeleteOptions) (*runtime.Poller[GroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a network group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *GroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified network group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. +func (client *GroupsClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientGetOptions) (GroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + if err != nil { + return GroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *GroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClientGetResponse, error) { + result := GroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { + return GroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the specified network group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. +func (client *GroupsClient) NewListPager(resourceGroupName string, networkManagerName string, options *GroupsClientListOptions) *runtime.Pager[GroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GroupsClientListResponse]{ + More: func(page GroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GroupsClientListResponse) (GroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *GroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GroupsClient) listHandleResponse(resp *http.Response) (GroupsClientListResponse, error) { + result := GroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GroupListResult); err != nil { + return GroupsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubroutetables_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubroutetables_client.go new file mode 100644 index 000000000..6c270147e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubroutetables_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HubRouteTablesClient contains the methods for the HubRouteTables group. +// Don't use this type directly, use NewHubRouteTablesClient() instead. +type HubRouteTablesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewHubRouteTablesClient creates a new instance of HubRouteTablesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewHubRouteTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubRouteTablesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &HubRouteTablesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the RouteTable. +// routeTableParameters - Parameters supplied to create or update RouteTable. +// options - HubRouteTablesClientBeginCreateOrUpdateOptions contains the optional parameters for the HubRouteTablesClient.BeginCreateOrUpdate +// method. +func (client *HubRouteTablesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable, options *HubRouteTablesClientBeginCreateOrUpdateOptions) (*runtime.Poller[HubRouteTablesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, routeTableName, routeTableParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[HubRouteTablesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[HubRouteTablesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *HubRouteTablesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable, options *HubRouteTablesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, routeTableParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *HubRouteTablesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable, options *HubRouteTablesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routeTableParameters) +} + +// BeginDelete - Deletes a RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RouteTable. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the RouteTable. +// options - HubRouteTablesClientBeginDeleteOptions contains the optional parameters for the HubRouteTablesClient.BeginDelete +// method. +func (client *HubRouteTablesClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientBeginDeleteOptions) (*runtime.Poller[HubRouteTablesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[HubRouteTablesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[HubRouteTablesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *HubRouteTablesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HubRouteTablesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a RouteTable. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the RouteTable. +// options - HubRouteTablesClientGetOptions contains the optional parameters for the HubRouteTablesClient.Get method. +func (client *HubRouteTablesClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientGetOptions) (HubRouteTablesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return HubRouteTablesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HubRouteTablesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HubRouteTablesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *HubRouteTablesClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *HubRouteTablesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HubRouteTablesClient) getHandleResponse(resp *http.Response) (HubRouteTablesClientGetResponse, error) { + result := HubRouteTablesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HubRouteTable); err != nil { + return HubRouteTablesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all RouteTables. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - HubRouteTablesClientListOptions contains the optional parameters for the HubRouteTablesClient.List method. +func (client *HubRouteTablesClient) NewListPager(resourceGroupName string, virtualHubName string, options *HubRouteTablesClientListOptions) *runtime.Pager[HubRouteTablesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[HubRouteTablesClientListResponse]{ + More: func(page HubRouteTablesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HubRouteTablesClientListResponse) (HubRouteTablesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HubRouteTablesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HubRouteTablesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HubRouteTablesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *HubRouteTablesClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *HubRouteTablesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *HubRouteTablesClient) listHandleResponse(resp *http.Response) (HubRouteTablesClientListResponse, error) { + result := HubRouteTablesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListHubRouteTablesResult); err != nil { + return HubRouteTablesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubvirtualnetworkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubvirtualnetworkconnections_client.go new file mode 100644 index 000000000..5fbe5c0ab --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/hubvirtualnetworkconnections_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HubVirtualNetworkConnectionsClient contains the methods for the HubVirtualNetworkConnections group. +// Don't use this type directly, use NewHubVirtualNetworkConnectionsClient() instead. +type HubVirtualNetworkConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewHubVirtualNetworkConnectionsClient creates a new instance of HubVirtualNetworkConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewHubVirtualNetworkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubVirtualNetworkConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &HubVirtualNetworkConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a hub virtual network connection if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the HubVirtualNetworkConnection. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the HubVirtualNetworkConnection. +// hubVirtualNetworkConnectionParameters - Parameters supplied to create or update a hub virtual network connection. +// options - HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.BeginCreateOrUpdate +// method. +func (client *HubVirtualNetworkConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection, options *HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[HubVirtualNetworkConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, connectionName, hubVirtualNetworkConnectionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[HubVirtualNetworkConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[HubVirtualNetworkConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a hub virtual network connection if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *HubVirtualNetworkConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection, options *HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, hubVirtualNetworkConnectionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *HubVirtualNetworkConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection, options *HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, hubVirtualNetworkConnectionParameters) +} + +// BeginDelete - Deletes a HubVirtualNetworkConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the HubVirtualNetworkConnection. +// options - HubVirtualNetworkConnectionsClientBeginDeleteOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.BeginDelete +// method. +func (client *HubVirtualNetworkConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientBeginDeleteOptions) (*runtime.Poller[HubVirtualNetworkConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[HubVirtualNetworkConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[HubVirtualNetworkConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a HubVirtualNetworkConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *HubVirtualNetworkConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *HubVirtualNetworkConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a HubVirtualNetworkConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the vpn connection. +// options - HubVirtualNetworkConnectionsClientGetOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.Get +// method. +func (client *HubVirtualNetworkConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientGetOptions) (HubVirtualNetworkConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HubVirtualNetworkConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *HubVirtualNetworkConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *HubVirtualNetworkConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HubVirtualNetworkConnectionsClient) getHandleResponse(resp *http.Response) (HubVirtualNetworkConnectionsClientGetResponse, error) { + result := HubVirtualNetworkConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HubVirtualNetworkConnection); err != nil { + return HubVirtualNetworkConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all HubVirtualNetworkConnections. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - HubVirtualNetworkConnectionsClientListOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.List +// method. +func (client *HubVirtualNetworkConnectionsClient) NewListPager(resourceGroupName string, virtualHubName string, options *HubVirtualNetworkConnectionsClientListOptions) *runtime.Pager[HubVirtualNetworkConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[HubVirtualNetworkConnectionsClientListResponse]{ + More: func(page HubVirtualNetworkConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HubVirtualNetworkConnectionsClientListResponse) (HubVirtualNetworkConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HubVirtualNetworkConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HubVirtualNetworkConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HubVirtualNetworkConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *HubVirtualNetworkConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *HubVirtualNetworkConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *HubVirtualNetworkConnectionsClient) listHandleResponse(resp *http.Response) (HubVirtualNetworkConnectionsClientListResponse, error) { + result := HubVirtualNetworkConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListHubVirtualNetworkConnectionsResult); err != nil { + return HubVirtualNetworkConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundnatrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundnatrules_client.go new file mode 100644 index 000000000..350a41eb5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundnatrules_client.go @@ -0,0 +1,330 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InboundNatRulesClient contains the methods for the InboundNatRules group. +// Don't use this type directly, use NewInboundNatRulesClient() instead. +type InboundNatRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInboundNatRulesClient creates a new instance of InboundNatRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInboundNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InboundNatRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InboundNatRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// inboundNatRuleName - The name of the inbound NAT rule. +// inboundNatRuleParameters - Parameters supplied to the create or update inbound NAT rule operation. +// options - InboundNatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the InboundNatRulesClient.BeginCreateOrUpdate +// method. +func (client *InboundNatRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[InboundNatRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InboundNatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[InboundNatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InboundNatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *InboundNatRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if inboundNatRuleName == "" { + return nil, errors.New("parameter inboundNatRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inboundNatRuleName}", url.PathEscape(inboundNatRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, inboundNatRuleParameters) +} + +// BeginDelete - Deletes the specified load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// inboundNatRuleName - The name of the inbound NAT rule. +// options - InboundNatRulesClientBeginDeleteOptions contains the optional parameters for the InboundNatRulesClient.BeginDelete +// method. +func (client *InboundNatRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientBeginDeleteOptions) (*runtime.Poller[InboundNatRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InboundNatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[InboundNatRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InboundNatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *InboundNatRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if inboundNatRuleName == "" { + return nil, errors.New("parameter inboundNatRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inboundNatRuleName}", url.PathEscape(inboundNatRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified load balancer inbound NAT rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// inboundNatRuleName - The name of the inbound NAT rule. +// options - InboundNatRulesClientGetOptions contains the optional parameters for the InboundNatRulesClient.Get method. +func (client *InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientGetOptions) (InboundNatRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) + if err != nil { + return InboundNatRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InboundNatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InboundNatRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *InboundNatRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if inboundNatRuleName == "" { + return nil, errors.New("parameter inboundNatRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inboundNatRuleName}", url.PathEscape(inboundNatRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InboundNatRulesClient) getHandleResponse(resp *http.Response) (InboundNatRulesClientGetResponse, error) { + result := InboundNatRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InboundNatRule); err != nil { + return InboundNatRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the inbound NAT rules in a load balancer. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - InboundNatRulesClientListOptions contains the optional parameters for the InboundNatRulesClient.List method. +func (client *InboundNatRulesClient) NewListPager(resourceGroupName string, loadBalancerName string, options *InboundNatRulesClientListOptions) *runtime.Pager[InboundNatRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[InboundNatRulesClientListResponse]{ + More: func(page InboundNatRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InboundNatRulesClientListResponse) (InboundNatRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InboundNatRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InboundNatRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InboundNatRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *InboundNatRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *InboundNatRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *InboundNatRulesClient) listHandleResponse(resp *http.Response) (InboundNatRulesClientListResponse, error) { + result := InboundNatRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InboundNatRuleListResult); err != nil { + return InboundNatRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundsecurityrule_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundsecurityrule_client.go new file mode 100644 index 000000000..7a7d74ef7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/inboundsecurityrule_client.go @@ -0,0 +1,128 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InboundSecurityRuleClient contains the methods for the InboundSecurityRule group. +// Don't use this type directly, use NewInboundSecurityRuleClient() instead. +type InboundSecurityRuleClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInboundSecurityRuleClient creates a new instance of InboundSecurityRuleClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInboundSecurityRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InboundSecurityRuleClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InboundSecurityRuleClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance Inbound Security Rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of the Network Virtual Appliance. +// ruleCollectionName - The name of security rule collection. +// parameters - Parameters supplied to the create or update Network Virtual Appliance Inbound Security Rules operation. +// options - InboundSecurityRuleClientBeginCreateOrUpdateOptions contains the optional parameters for the InboundSecurityRuleClient.BeginCreateOrUpdate +// method. +func (client *InboundSecurityRuleClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule, options *InboundSecurityRuleClientBeginCreateOrUpdateOptions) (*runtime.Poller[InboundSecurityRuleClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InboundSecurityRuleClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[InboundSecurityRuleClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Network Virtual Appliance Inbound Security Rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InboundSecurityRuleClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule, options *InboundSecurityRuleClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *InboundSecurityRuleClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule, options *InboundSecurityRuleClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if ruleCollectionName == "" { + return nil, errors.New("parameter ruleCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleCollectionName}", url.PathEscape(ruleCollectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceipconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceipconfigurations_client.go new file mode 100644 index 000000000..eb0b9bdc0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceipconfigurations_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InterfaceIPConfigurationsClient contains the methods for the NetworkInterfaceIPConfigurations group. +// Don't use this type directly, use NewInterfaceIPConfigurationsClient() instead. +type InterfaceIPConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInterfaceIPConfigurationsClient creates a new instance of InterfaceIPConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInterfaceIPConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InterfaceIPConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InterfaceIPConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified network interface ip configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// ipConfigurationName - The name of the ip configuration name. +// options - InterfaceIPConfigurationsClientGetOptions contains the optional parameters for the InterfaceIPConfigurationsClient.Get +// method. +func (client *InterfaceIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, ipConfigurationName string, options *InterfaceIPConfigurationsClientGetOptions) (InterfaceIPConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, ipConfigurationName, options) + if err != nil { + return InterfaceIPConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfaceIPConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfaceIPConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *InterfaceIPConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, ipConfigurationName string, options *InterfaceIPConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InterfaceIPConfigurationsClient) getHandleResponse(resp *http.Response) (InterfaceIPConfigurationsClientGetResponse, error) { + result := InterfaceIPConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfiguration); err != nil { + return InterfaceIPConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get all ip configurations in a network interface. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfaceIPConfigurationsClientListOptions contains the optional parameters for the InterfaceIPConfigurationsClient.List +// method. +func (client *InterfaceIPConfigurationsClient) NewListPager(resourceGroupName string, networkInterfaceName string, options *InterfaceIPConfigurationsClientListOptions) *runtime.Pager[InterfaceIPConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfaceIPConfigurationsClientListResponse]{ + More: func(page InterfaceIPConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfaceIPConfigurationsClientListResponse) (InterfaceIPConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfaceIPConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfaceIPConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfaceIPConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *InterfaceIPConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfaceIPConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *InterfaceIPConfigurationsClient) listHandleResponse(resp *http.Response) (InterfaceIPConfigurationsClientListResponse, error) { + result := InterfaceIPConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfigurationListResult); err != nil { + return InterfaceIPConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceloadbalancers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceloadbalancers_client.go new file mode 100644 index 000000000..90270a73b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaceloadbalancers_client.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InterfaceLoadBalancersClient contains the methods for the NetworkInterfaceLoadBalancers group. +// Don't use this type directly, use NewInterfaceLoadBalancersClient() instead. +type InterfaceLoadBalancersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInterfaceLoadBalancersClient creates a new instance of InterfaceLoadBalancersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInterfaceLoadBalancersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InterfaceLoadBalancersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InterfaceLoadBalancersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List all load balancers in a network interface. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfaceLoadBalancersClientListOptions contains the optional parameters for the InterfaceLoadBalancersClient.List +// method. +func (client *InterfaceLoadBalancersClient) NewListPager(resourceGroupName string, networkInterfaceName string, options *InterfaceLoadBalancersClientListOptions) *runtime.Pager[InterfaceLoadBalancersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfaceLoadBalancersClientListResponse]{ + More: func(page InterfaceLoadBalancersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfaceLoadBalancersClientListResponse) (InterfaceLoadBalancersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfaceLoadBalancersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfaceLoadBalancersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfaceLoadBalancersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *InterfaceLoadBalancersClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfaceLoadBalancersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *InterfaceLoadBalancersClient) listHandleResponse(resp *http.Response) (InterfaceLoadBalancersClientListResponse, error) { + result := InterfaceLoadBalancersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceLoadBalancerListResult); err != nil { + return InterfaceLoadBalancersClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaces_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaces_client.go new file mode 100644 index 000000000..f229d4416 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfaces_client.go @@ -0,0 +1,1141 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InterfacesClient contains the methods for the NetworkInterfaces group. +// Don't use this type directly, use NewInterfacesClient() instead. +type InterfacesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInterfacesClient creates a new instance of InterfacesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InterfacesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InterfacesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// parameters - Parameters supplied to the create or update network interface operation. +// options - InterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the InterfacesClient.BeginCreateOrUpdate +// method. +func (client *InterfacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[InterfacesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkInterfaceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfacesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkInterfaceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *InterfacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface, options *InterfacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientBeginDeleteOptions contains the optional parameters for the InterfacesClient.BeginDelete method. +func (client *InterfacesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*runtime.Poller[InterfacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *InterfacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientGetOptions contains the optional parameters for the InterfacesClient.Get method. +func (client *InterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientGetOptions) (InterfacesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *InterfacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InterfacesClient) getHandleResponse(resp *http.Response) (InterfacesClientGetResponse, error) { + result := InterfacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { + return InterfacesClientGetResponse{}, err + } + return result, nil +} + +// GetCloudServiceNetworkInterface - Get the specified network interface in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// roleInstanceName - The name of role instance. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientGetCloudServiceNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetCloudServiceNetworkInterface +// method. +func (client *InterfacesClient) GetCloudServiceNetworkInterface(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, options *InterfacesClientGetCloudServiceNetworkInterfaceOptions) (InterfacesClientGetCloudServiceNetworkInterfaceResponse, error) { + req, err := client.getCloudServiceNetworkInterfaceCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, runtime.NewResponseError(resp) + } + return client.getCloudServiceNetworkInterfaceHandleResponse(resp) +} + +// getCloudServiceNetworkInterfaceCreateRequest creates the GetCloudServiceNetworkInterface request. +func (client *InterfacesClient) getCloudServiceNetworkInterfaceCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, options *InterfacesClientGetCloudServiceNetworkInterfaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCloudServiceNetworkInterfaceHandleResponse handles the GetCloudServiceNetworkInterface response. +func (client *InterfacesClient) getCloudServiceNetworkInterfaceHandleResponse(resp *http.Response) (InterfacesClientGetCloudServiceNetworkInterfaceResponse, error) { + result := InterfacesClientGetCloudServiceNetworkInterfaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { + return InterfacesClientGetCloudServiceNetworkInterfaceResponse{}, err + } + return result, nil +} + +// BeginGetEffectiveRouteTable - Gets all route tables applied to a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientBeginGetEffectiveRouteTableOptions contains the optional parameters for the InterfacesClient.BeginGetEffectiveRouteTable +// method. +func (client *InterfacesClient) BeginGetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*runtime.Poller[InterfacesClientGetEffectiveRouteTableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getEffectiveRouteTable(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfacesClientGetEffectiveRouteTableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientGetEffectiveRouteTableResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetEffectiveRouteTable - Gets all route tables applied to a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfacesClient) getEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*http.Response, error) { + req, err := client.getEffectiveRouteTableCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getEffectiveRouteTableCreateRequest creates the GetEffectiveRouteTable request. +func (client *InterfacesClient) getEffectiveRouteTableCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginGetEffectiveRouteTableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetVirtualMachineScaleSetIPConfiguration - Get the specified network interface ip configuration in a virtual machine scale +// set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// networkInterfaceName - The name of the network interface. +// ipConfigurationName - The name of the ip configuration. +// options - InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetIPConfiguration +// method. +func (client *InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions) (InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse, error) { + req, err := client.getVirtualMachineScaleSetIPConfigurationCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, runtime.NewResponseError(resp) + } + return client.getVirtualMachineScaleSetIPConfigurationHandleResponse(resp) +} + +// getVirtualMachineScaleSetIPConfigurationCreateRequest creates the GetVirtualMachineScaleSetIPConfiguration request. +func (client *InterfacesClient) getVirtualMachineScaleSetIPConfigurationCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVirtualMachineScaleSetIPConfigurationHandleResponse handles the GetVirtualMachineScaleSetIPConfiguration response. +func (client *InterfacesClient) getVirtualMachineScaleSetIPConfigurationHandleResponse(resp *http.Response) (InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse, error) { + result := InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfiguration); err != nil { + return InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse{}, err + } + return result, nil +} + +// GetVirtualMachineScaleSetNetworkInterface - Get the specified network interface in a virtual machine scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetNetworkInterface +// method. +func (client *InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse, error) { + req, err := client.getVirtualMachineScaleSetNetworkInterfaceCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, runtime.NewResponseError(resp) + } + return client.getVirtualMachineScaleSetNetworkInterfaceHandleResponse(resp) +} + +// getVirtualMachineScaleSetNetworkInterfaceCreateRequest creates the GetVirtualMachineScaleSetNetworkInterface request. +func (client *InterfacesClient) getVirtualMachineScaleSetNetworkInterfaceCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVirtualMachineScaleSetNetworkInterfaceHandleResponse handles the GetVirtualMachineScaleSetNetworkInterface response. +func (client *InterfacesClient) getVirtualMachineScaleSetNetworkInterfaceHandleResponse(resp *http.Response) (InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse, error) { + result := InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { + return InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all network interfaces in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - InterfacesClientListOptions contains the optional parameters for the InterfacesClient.List method. +func (client *InterfacesClient) NewListPager(resourceGroupName string, options *InterfacesClientListOptions) *runtime.Pager[InterfacesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListResponse]{ + More: func(page InterfacesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListResponse) (InterfacesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *InterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *InterfacesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *InterfacesClient) listHandleResponse(resp *http.Response) (InterfacesClientListResponse, error) { + result := InterfacesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all network interfaces in a subscription. +// Generated from API version 2022-05-01 +// options - InterfacesClientListAllOptions contains the optional parameters for the InterfacesClient.ListAll method. +func (client *InterfacesClient) NewListAllPager(options *InterfacesClientListAllOptions) *runtime.Pager[InterfacesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListAllResponse]{ + More: func(page InterfacesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListAllResponse) (InterfacesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *InterfacesClient) listAllCreateRequest(ctx context.Context, options *InterfacesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *InterfacesClient) listAllHandleResponse(resp *http.Response) (InterfacesClientListAllResponse, error) { + result := InterfacesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListAllResponse{}, err + } + return result, nil +} + +// NewListCloudServiceNetworkInterfacesPager - Gets all network interfaces in a cloud service. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// options - InterfacesClientListCloudServiceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListCloudServiceNetworkInterfaces +// method. +func (client *InterfacesClient) NewListCloudServiceNetworkInterfacesPager(resourceGroupName string, cloudServiceName string, options *InterfacesClientListCloudServiceNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListCloudServiceNetworkInterfacesResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListCloudServiceNetworkInterfacesResponse]{ + More: func(page InterfacesClientListCloudServiceNetworkInterfacesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListCloudServiceNetworkInterfacesResponse) (InterfacesClientListCloudServiceNetworkInterfacesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCloudServiceNetworkInterfacesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, runtime.NewResponseError(resp) + } + return client.listCloudServiceNetworkInterfacesHandleResponse(resp) + }, + }) +} + +// listCloudServiceNetworkInterfacesCreateRequest creates the ListCloudServiceNetworkInterfaces request. +func (client *InterfacesClient) listCloudServiceNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *InterfacesClientListCloudServiceNetworkInterfacesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCloudServiceNetworkInterfacesHandleResponse handles the ListCloudServiceNetworkInterfaces response. +func (client *InterfacesClient) listCloudServiceNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListCloudServiceNetworkInterfacesResponse, error) { + result := InterfacesClientListCloudServiceNetworkInterfacesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListCloudServiceNetworkInterfacesResponse{}, err + } + return result, nil +} + +// NewListCloudServiceRoleInstanceNetworkInterfacesPager - Gets information about all network interfaces in a role instance +// in a cloud service. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// roleInstanceName - The name of role instance. +// options - InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions contains the optional parameters for the +// InterfacesClient.ListCloudServiceRoleInstanceNetworkInterfaces method. +func (client *InterfacesClient) NewListCloudServiceRoleInstanceNetworkInterfacesPager(resourceGroupName string, cloudServiceName string, roleInstanceName string, options *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse]{ + More: func(page InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse) (InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCloudServiceRoleInstanceNetworkInterfacesCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, runtime.NewResponseError(resp) + } + return client.listCloudServiceRoleInstanceNetworkInterfacesHandleResponse(resp) + }, + }) +} + +// listCloudServiceRoleInstanceNetworkInterfacesCreateRequest creates the ListCloudServiceRoleInstanceNetworkInterfaces request. +func (client *InterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, options *InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCloudServiceRoleInstanceNetworkInterfacesHandleResponse handles the ListCloudServiceRoleInstanceNetworkInterfaces response. +func (client *InterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse, error) { + result := InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err + } + return result, nil +} + +// BeginListEffectiveNetworkSecurityGroups - Gets all network security groups applied to a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions contains the optional parameters for the InterfacesClient.BeginListEffectiveNetworkSecurityGroups +// method. +func (client *InterfacesClient) BeginListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*runtime.Poller[InterfacesClientListEffectiveNetworkSecurityGroupsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listEffectiveNetworkSecurityGroups(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfacesClientListEffectiveNetworkSecurityGroupsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfacesClientListEffectiveNetworkSecurityGroupsResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListEffectiveNetworkSecurityGroups - Gets all network security groups applied to a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfacesClient) listEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*http.Response, error) { + req, err := client.listEffectiveNetworkSecurityGroupsCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listEffectiveNetworkSecurityGroupsCreateRequest creates the ListEffectiveNetworkSecurityGroups request. +func (client *InterfacesClient) listEffectiveNetworkSecurityGroupsCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListVirtualMachineScaleSetIPConfigurationsPager - Get the specified network interface ip configuration in a virtual +// machine scale set. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// networkInterfaceName - The name of the network interface. +// options - InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions contains the optional parameters for the InterfacesClient.ListVirtualMachineScaleSetIPConfigurations +// method. +func (client *InterfacesClient) NewListVirtualMachineScaleSetIPConfigurationsPager(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse]{ + More: func(page InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse) (InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVirtualMachineScaleSetIPConfigurationsCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.listVirtualMachineScaleSetIPConfigurationsHandleResponse(resp) + }, + }) +} + +// listVirtualMachineScaleSetIPConfigurationsCreateRequest creates the ListVirtualMachineScaleSetIPConfigurations request. +func (client *InterfacesClient) listVirtualMachineScaleSetIPConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, options *InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVirtualMachineScaleSetIPConfigurationsHandleResponse handles the ListVirtualMachineScaleSetIPConfigurations response. +func (client *InterfacesClient) listVirtualMachineScaleSetIPConfigurationsHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse, error) { + result := InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceIPConfigurationListResult); err != nil { + return InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse{}, err + } + return result, nil +} + +// NewListVirtualMachineScaleSetNetworkInterfacesPager - Gets all network interfaces in a virtual machine scale set. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// options - InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListVirtualMachineScaleSetNetworkInterfaces +// method. +func (client *InterfacesClient) NewListVirtualMachineScaleSetNetworkInterfacesPager(resourceGroupName string, virtualMachineScaleSetName string, options *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse]{ + More: func(page InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse) (InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVirtualMachineScaleSetNetworkInterfacesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, runtime.NewResponseError(resp) + } + return client.listVirtualMachineScaleSetNetworkInterfacesHandleResponse(resp) + }, + }) +} + +// listVirtualMachineScaleSetNetworkInterfacesCreateRequest creates the ListVirtualMachineScaleSetNetworkInterfaces request. +func (client *InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVirtualMachineScaleSetNetworkInterfacesHandleResponse handles the ListVirtualMachineScaleSetNetworkInterfaces response. +func (client *InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse, error) { + result := InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse{}, err + } + return result, nil +} + +// NewListVirtualMachineScaleSetVMNetworkInterfacesPager - Gets information about all network interfaces in a virtual machine +// in a virtual machine scale set. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// options - InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions contains the optional parameters for the +// InterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfaces method. +func (client *InterfacesClient) NewListVirtualMachineScaleSetVMNetworkInterfacesPager(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, options *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions) *runtime.Pager[InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse]{ + More: func(page InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse) (InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, runtime.NewResponseError(resp) + } + return client.listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse(resp) + }, + }) +} + +// listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest creates the ListVirtualMachineScaleSetVMNetworkInterfaces request. +func (client *InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, options *InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse handles the ListVirtualMachineScaleSetVMNetworkInterfaces response. +func (client *InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse(resp *http.Response) (InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse, error) { + result := InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a network interface tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// parameters - Parameters supplied to update network interface tags. +// options - InterfacesClientUpdateTagsOptions contains the optional parameters for the InterfacesClient.UpdateTags method. +func (client *InterfacesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject, options *InterfacesClientUpdateTagsOptions) (InterfacesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkInterfaceName, parameters, options) + if err != nil { + return InterfacesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfacesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfacesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *InterfacesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject, options *InterfacesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *InterfacesClient) updateTagsHandleResponse(resp *http.Response) (InterfacesClientUpdateTagsResponse, error) { + result := InterfacesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Interface); err != nil { + return InterfacesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfacetapconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfacetapconfigurations_client.go new file mode 100644 index 000000000..f9bd3d373 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/interfacetapconfigurations_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// InterfaceTapConfigurationsClient contains the methods for the NetworkInterfaceTapConfigurations group. +// Don't use this type directly, use NewInterfaceTapConfigurationsClient() instead. +type InterfaceTapConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewInterfaceTapConfigurationsClient creates a new instance of InterfaceTapConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewInterfaceTapConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InterfaceTapConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &InterfaceTapConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Tap configuration in the specified NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// tapConfigurationName - The name of the tap configuration. +// tapConfigurationParameters - Parameters supplied to the create or update tap configuration operation. +// options - InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the InterfaceTapConfigurationsClient.BeginCreateOrUpdate +// method. +func (client *InterfaceTapConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration, options *InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[InterfaceTapConfigurationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfaceTapConfigurationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfaceTapConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a Tap configuration in the specified NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfaceTapConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration, options *InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *InterfaceTapConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration, options *InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if tapConfigurationName == "" { + return nil, errors.New("parameter tapConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapConfigurationName}", url.PathEscape(tapConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, tapConfigurationParameters) +} + +// BeginDelete - Deletes the specified tap configuration from the NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// tapConfigurationName - The name of the tap configuration. +// options - InterfaceTapConfigurationsClientBeginDeleteOptions contains the optional parameters for the InterfaceTapConfigurationsClient.BeginDelete +// method. +func (client *InterfaceTapConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientBeginDeleteOptions) (*runtime.Poller[InterfaceTapConfigurationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[InterfaceTapConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[InterfaceTapConfigurationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified tap configuration from the NetworkInterface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *InterfaceTapConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *InterfaceTapConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if tapConfigurationName == "" { + return nil, errors.New("parameter tapConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapConfigurationName}", url.PathEscape(tapConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified tap configuration on a network interface. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// tapConfigurationName - The name of the tap configuration. +// options - InterfaceTapConfigurationsClientGetOptions contains the optional parameters for the InterfaceTapConfigurationsClient.Get +// method. +func (client *InterfaceTapConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientGetOptions) (InterfaceTapConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, options) + if err != nil { + return InterfaceTapConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfaceTapConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfaceTapConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *InterfaceTapConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, options *InterfaceTapConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if tapConfigurationName == "" { + return nil, errors.New("parameter tapConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapConfigurationName}", url.PathEscape(tapConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InterfaceTapConfigurationsClient) getHandleResponse(resp *http.Response) (InterfaceTapConfigurationsClientGetResponse, error) { + result := InterfaceTapConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceTapConfiguration); err != nil { + return InterfaceTapConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get all Tap configurations in a network interface. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkInterfaceName - The name of the network interface. +// options - InterfaceTapConfigurationsClientListOptions contains the optional parameters for the InterfaceTapConfigurationsClient.List +// method. +func (client *InterfaceTapConfigurationsClient) NewListPager(resourceGroupName string, networkInterfaceName string, options *InterfaceTapConfigurationsClientListOptions) *runtime.Pager[InterfaceTapConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[InterfaceTapConfigurationsClientListResponse]{ + More: func(page InterfaceTapConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InterfaceTapConfigurationsClientListResponse) (InterfaceTapConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkInterfaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InterfaceTapConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InterfaceTapConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InterfaceTapConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *InterfaceTapConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *InterfaceTapConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *InterfaceTapConfigurationsClient) listHandleResponse(resp *http.Response) (InterfaceTapConfigurationsClientListResponse, error) { + result := InterfaceTapConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceTapConfigurationListResult); err != nil { + return InterfaceTapConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipallocations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipallocations_client.go new file mode 100644 index 000000000..3283014e3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipallocations_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// IPAllocationsClient contains the methods for the IPAllocations group. +// Don't use this type directly, use NewIPAllocationsClient() instead. +type IPAllocationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewIPAllocationsClient creates a new instance of IPAllocationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewIPAllocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IPAllocationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &IPAllocationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an IpAllocation in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipAllocationName - The name of the IpAllocation. +// parameters - Parameters supplied to the create or update virtual network operation. +// options - IPAllocationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPAllocationsClient.BeginCreateOrUpdate +// method. +func (client *IPAllocationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IPAllocationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, ipAllocationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[IPAllocationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[IPAllocationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an IpAllocation in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *IPAllocationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ipAllocationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IPAllocationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters IPAllocation, options *IPAllocationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipAllocationName == "" { + return nil, errors.New("parameter ipAllocationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified IpAllocation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipAllocationName - The name of the IpAllocation. +// options - IPAllocationsClientBeginDeleteOptions contains the optional parameters for the IPAllocationsClient.BeginDelete +// method. +func (client *IPAllocationsClient) BeginDelete(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*runtime.Poller[IPAllocationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, ipAllocationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[IPAllocationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[IPAllocationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified IpAllocation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *IPAllocationsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ipAllocationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IPAllocationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipAllocationName == "" { + return nil, errors.New("parameter ipAllocationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified IpAllocation by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipAllocationName - The name of the IpAllocation. +// options - IPAllocationsClientGetOptions contains the optional parameters for the IPAllocationsClient.Get method. +func (client *IPAllocationsClient) Get(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientGetOptions) (IPAllocationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, ipAllocationName, options) + if err != nil { + return IPAllocationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPAllocationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPAllocationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IPAllocationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, options *IPAllocationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipAllocationName == "" { + return nil, errors.New("parameter ipAllocationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IPAllocationsClient) getHandleResponse(resp *http.Response) (IPAllocationsClientGetResponse, error) { + result := IPAllocationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil { + return IPAllocationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all IpAllocations in a subscription. +// Generated from API version 2022-05-01 +// options - IPAllocationsClientListOptions contains the optional parameters for the IPAllocationsClient.List method. +func (client *IPAllocationsClient) NewListPager(options *IPAllocationsClientListOptions) *runtime.Pager[IPAllocationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[IPAllocationsClientListResponse]{ + More: func(page IPAllocationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IPAllocationsClientListResponse) (IPAllocationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return IPAllocationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPAllocationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPAllocationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *IPAllocationsClient) listCreateRequest(ctx context.Context, options *IPAllocationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *IPAllocationsClient) listHandleResponse(resp *http.Response) (IPAllocationsClientListResponse, error) { + result := IPAllocationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil { + return IPAllocationsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all IpAllocations in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - IPAllocationsClientListByResourceGroupOptions contains the optional parameters for the IPAllocationsClient.ListByResourceGroup +// method. +func (client *IPAllocationsClient) NewListByResourceGroupPager(resourceGroupName string, options *IPAllocationsClientListByResourceGroupOptions) *runtime.Pager[IPAllocationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[IPAllocationsClientListByResourceGroupResponse]{ + More: func(page IPAllocationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IPAllocationsClientListByResourceGroupResponse) (IPAllocationsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return IPAllocationsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPAllocationsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPAllocationsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *IPAllocationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *IPAllocationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *IPAllocationsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPAllocationsClientListByResourceGroupResponse, error) { + result := IPAllocationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil { + return IPAllocationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a IpAllocation tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipAllocationName - The name of the IpAllocation. +// parameters - Parameters supplied to update IpAllocation tags. +// options - IPAllocationsClientUpdateTagsOptions contains the optional parameters for the IPAllocationsClient.UpdateTags +// method. +func (client *IPAllocationsClient) UpdateTags(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters TagsObject, options *IPAllocationsClientUpdateTagsOptions) (IPAllocationsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, ipAllocationName, parameters, options) + if err != nil { + return IPAllocationsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPAllocationsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPAllocationsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *IPAllocationsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, ipAllocationName string, parameters TagsObject, options *IPAllocationsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipAllocationName == "" { + return nil, errors.New("parameter ipAllocationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipAllocationName}", url.PathEscape(ipAllocationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *IPAllocationsClient) updateTagsHandleResponse(resp *http.Response) (IPAllocationsClientUpdateTagsResponse, error) { + result := IPAllocationsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil { + return IPAllocationsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipgroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipgroups_client.go new file mode 100644 index 000000000..5ff2a92c2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/ipgroups_client.go @@ -0,0 +1,425 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// IPGroupsClient contains the methods for the IPGroups group. +// Don't use this type directly, use NewIPGroupsClient() instead. +type IPGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewIPGroupsClient creates a new instance of IPGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewIPGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IPGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &IPGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an ipGroups in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipGroupsName - The name of the ipGroups. +// parameters - Parameters supplied to the create or update IpGroups operation. +// options - IPGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPGroupsClient.BeginCreateOrUpdate +// method. +func (client *IPGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[IPGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, ipGroupsName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[IPGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[IPGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an ipGroups in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *IPGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ipGroupsName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *IPGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters IPGroup, options *IPGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipGroupsName == "" { + return nil, errors.New("parameter ipGroupsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified ipGroups. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipGroupsName - The name of the ipGroups. +// options - IPGroupsClientBeginDeleteOptions contains the optional parameters for the IPGroupsClient.BeginDelete method. +func (client *IPGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*runtime.Poller[IPGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, ipGroupsName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[IPGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[IPGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified ipGroups. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *IPGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, ipGroupsName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *IPGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipGroupsName == "" { + return nil, errors.New("parameter ipGroupsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified ipGroups. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipGroupsName - The name of the ipGroups. +// options - IPGroupsClientGetOptions contains the optional parameters for the IPGroupsClient.Get method. +func (client *IPGroupsClient) Get(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientGetOptions) (IPGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, ipGroupsName, options) + if err != nil { + return IPGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *IPGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, options *IPGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipGroupsName == "" { + return nil, errors.New("parameter ipGroupsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IPGroupsClient) getHandleResponse(resp *http.Response) (IPGroupsClientGetResponse, error) { + result := IPGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil { + return IPGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all IpGroups in a subscription. +// Generated from API version 2022-05-01 +// options - IPGroupsClientListOptions contains the optional parameters for the IPGroupsClient.List method. +func (client *IPGroupsClient) NewListPager(options *IPGroupsClientListOptions) *runtime.Pager[IPGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[IPGroupsClientListResponse]{ + More: func(page IPGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IPGroupsClientListResponse) (IPGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return IPGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *IPGroupsClient) listCreateRequest(ctx context.Context, options *IPGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *IPGroupsClient) listHandleResponse(resp *http.Response) (IPGroupsClientListResponse, error) { + result := IPGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil { + return IPGroupsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all IpGroups in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - IPGroupsClientListByResourceGroupOptions contains the optional parameters for the IPGroupsClient.ListByResourceGroup +// method. +func (client *IPGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *IPGroupsClientListByResourceGroupOptions) *runtime.Pager[IPGroupsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[IPGroupsClientListByResourceGroupResponse]{ + More: func(page IPGroupsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IPGroupsClientListByResourceGroupResponse) (IPGroupsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return IPGroupsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPGroupsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *IPGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *IPGroupsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *IPGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPGroupsClientListByResourceGroupResponse, error) { + result := IPGroupsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil { + return IPGroupsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateGroups - Updates tags of an IpGroups resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// ipGroupsName - The name of the ipGroups. +// parameters - Parameters supplied to the update ipGroups operation. +// options - IPGroupsClientUpdateGroupsOptions contains the optional parameters for the IPGroupsClient.UpdateGroups method. +func (client *IPGroupsClient) UpdateGroups(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters TagsObject, options *IPGroupsClientUpdateGroupsOptions) (IPGroupsClientUpdateGroupsResponse, error) { + req, err := client.updateGroupsCreateRequest(ctx, resourceGroupName, ipGroupsName, parameters, options) + if err != nil { + return IPGroupsClientUpdateGroupsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return IPGroupsClientUpdateGroupsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return IPGroupsClientUpdateGroupsResponse{}, runtime.NewResponseError(resp) + } + return client.updateGroupsHandleResponse(resp) +} + +// updateGroupsCreateRequest creates the UpdateGroups request. +func (client *IPGroupsClient) updateGroupsCreateRequest(ctx context.Context, resourceGroupName string, ipGroupsName string, parameters TagsObject, options *IPGroupsClientUpdateGroupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if ipGroupsName == "" { + return nil, errors.New("parameter ipGroupsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipGroupsName}", url.PathEscape(ipGroupsName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateGroupsHandleResponse handles the UpdateGroups response. +func (client *IPGroupsClient) updateGroupsHandleResponse(resp *http.Response) (IPGroupsClientUpdateGroupsResponse, error) { + result := IPGroupsClientUpdateGroupsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil { + return IPGroupsClientUpdateGroupsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerbackendaddresspools_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerbackendaddresspools_client.go new file mode 100644 index 000000000..d02306892 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerbackendaddresspools_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerBackendAddressPoolsClient contains the methods for the LoadBalancerBackendAddressPools group. +// Don't use this type directly, use NewLoadBalancerBackendAddressPoolsClient() instead. +type LoadBalancerBackendAddressPoolsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerBackendAddressPoolsClient creates a new instance of LoadBalancerBackendAddressPoolsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerBackendAddressPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerBackendAddressPoolsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerBackendAddressPoolsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// backendAddressPoolName - The name of the backend address pool. +// parameters - Parameters supplied to the create or update load balancer backend address pool operation. +// options - LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.BeginCreateOrUpdate +// method. +func (client *LoadBalancerBackendAddressPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool, options *LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancerBackendAddressPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool, options *LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LoadBalancerBackendAddressPoolsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool, options *LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if backendAddressPoolName == "" { + return nil, errors.New("parameter backendAddressPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backendAddressPoolName}", url.PathEscape(backendAddressPoolName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// backendAddressPoolName - The name of the backend address pool. +// options - LoadBalancerBackendAddressPoolsClientBeginDeleteOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.BeginDelete +// method. +func (client *LoadBalancerBackendAddressPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientBeginDeleteOptions) (*runtime.Poller[LoadBalancerBackendAddressPoolsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancerBackendAddressPoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancerBackendAddressPoolsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancerBackendAddressPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LoadBalancerBackendAddressPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if backendAddressPoolName == "" { + return nil, errors.New("parameter backendAddressPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backendAddressPoolName}", url.PathEscape(backendAddressPoolName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets load balancer backend address pool. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// backendAddressPoolName - The name of the backend address pool. +// options - LoadBalancerBackendAddressPoolsClientGetOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.Get +// method. +func (client *LoadBalancerBackendAddressPoolsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientGetOptions) (LoadBalancerBackendAddressPoolsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, options) + if err != nil { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancerBackendAddressPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, options *LoadBalancerBackendAddressPoolsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if backendAddressPoolName == "" { + return nil, errors.New("parameter backendAddressPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backendAddressPoolName}", url.PathEscape(backendAddressPoolName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancerBackendAddressPoolsClient) getHandleResponse(resp *http.Response) (LoadBalancerBackendAddressPoolsClientGetResponse, error) { + result := LoadBalancerBackendAddressPoolsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackendAddressPool); err != nil { + return LoadBalancerBackendAddressPoolsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the load balancer backed address pools. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerBackendAddressPoolsClientListOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.List +// method. +func (client *LoadBalancerBackendAddressPoolsClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerBackendAddressPoolsClientListOptions) *runtime.Pager[LoadBalancerBackendAddressPoolsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerBackendAddressPoolsClientListResponse]{ + More: func(page LoadBalancerBackendAddressPoolsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerBackendAddressPoolsClientListResponse) (LoadBalancerBackendAddressPoolsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerBackendAddressPoolsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerBackendAddressPoolsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerBackendAddressPoolsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerBackendAddressPoolsClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerBackendAddressPoolsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerBackendAddressPoolsClient) listHandleResponse(resp *http.Response) (LoadBalancerBackendAddressPoolsClientListResponse, error) { + result := LoadBalancerBackendAddressPoolsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerBackendAddressPoolListResult); err != nil { + return LoadBalancerBackendAddressPoolsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerfrontendipconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerfrontendipconfigurations_client.go new file mode 100644 index 000000000..6307bd85a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerfrontendipconfigurations_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerFrontendIPConfigurationsClient contains the methods for the LoadBalancerFrontendIPConfigurations group. +// Don't use this type directly, use NewLoadBalancerFrontendIPConfigurationsClient() instead. +type LoadBalancerFrontendIPConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerFrontendIPConfigurationsClient creates a new instance of LoadBalancerFrontendIPConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerFrontendIPConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerFrontendIPConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerFrontendIPConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets load balancer frontend IP configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// frontendIPConfigurationName - The name of the frontend IP configuration. +// options - LoadBalancerFrontendIPConfigurationsClientGetOptions contains the optional parameters for the LoadBalancerFrontendIPConfigurationsClient.Get +// method. +func (client *LoadBalancerFrontendIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string, options *LoadBalancerFrontendIPConfigurationsClientGetOptions) (LoadBalancerFrontendIPConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, frontendIPConfigurationName, options) + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancerFrontendIPConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string, options *LoadBalancerFrontendIPConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if frontendIPConfigurationName == "" { + return nil, errors.New("parameter frontendIPConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{frontendIPConfigurationName}", url.PathEscape(frontendIPConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancerFrontendIPConfigurationsClient) getHandleResponse(resp *http.Response) (LoadBalancerFrontendIPConfigurationsClientGetResponse, error) { + result := LoadBalancerFrontendIPConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FrontendIPConfiguration); err != nil { + return LoadBalancerFrontendIPConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the load balancer frontend IP configurations. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerFrontendIPConfigurationsClientListOptions contains the optional parameters for the LoadBalancerFrontendIPConfigurationsClient.List +// method. +func (client *LoadBalancerFrontendIPConfigurationsClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerFrontendIPConfigurationsClientListOptions) *runtime.Pager[LoadBalancerFrontendIPConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerFrontendIPConfigurationsClientListResponse]{ + More: func(page LoadBalancerFrontendIPConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerFrontendIPConfigurationsClientListResponse) (LoadBalancerFrontendIPConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerFrontendIPConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerFrontendIPConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerFrontendIPConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerFrontendIPConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerFrontendIPConfigurationsClient) listHandleResponse(resp *http.Response) (LoadBalancerFrontendIPConfigurationsClientListResponse, error) { + result := LoadBalancerFrontendIPConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerFrontendIPConfigurationListResult); err != nil { + return LoadBalancerFrontendIPConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerloadbalancingrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerloadbalancingrules_client.go new file mode 100644 index 000000000..ab9108e13 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerloadbalancingrules_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerLoadBalancingRulesClient contains the methods for the LoadBalancerLoadBalancingRules group. +// Don't use this type directly, use NewLoadBalancerLoadBalancingRulesClient() instead. +type LoadBalancerLoadBalancingRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerLoadBalancingRulesClient creates a new instance of LoadBalancerLoadBalancingRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerLoadBalancingRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerLoadBalancingRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerLoadBalancingRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified load balancer load balancing rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// loadBalancingRuleName - The name of the load balancing rule. +// options - LoadBalancerLoadBalancingRulesClientGetOptions contains the optional parameters for the LoadBalancerLoadBalancingRulesClient.Get +// method. +func (client *LoadBalancerLoadBalancingRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string, options *LoadBalancerLoadBalancingRulesClientGetOptions) (LoadBalancerLoadBalancingRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, loadBalancingRuleName, options) + if err != nil { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancerLoadBalancingRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string, options *LoadBalancerLoadBalancingRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if loadBalancingRuleName == "" { + return nil, errors.New("parameter loadBalancingRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancingRuleName}", url.PathEscape(loadBalancingRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancerLoadBalancingRulesClient) getHandleResponse(resp *http.Response) (LoadBalancerLoadBalancingRulesClientGetResponse, error) { + result := LoadBalancerLoadBalancingRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancingRule); err != nil { + return LoadBalancerLoadBalancingRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the load balancing rules in a load balancer. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerLoadBalancingRulesClientListOptions contains the optional parameters for the LoadBalancerLoadBalancingRulesClient.List +// method. +func (client *LoadBalancerLoadBalancingRulesClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerLoadBalancingRulesClientListOptions) *runtime.Pager[LoadBalancerLoadBalancingRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerLoadBalancingRulesClientListResponse]{ + More: func(page LoadBalancerLoadBalancingRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerLoadBalancingRulesClientListResponse) (LoadBalancerLoadBalancingRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerLoadBalancingRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerLoadBalancingRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerLoadBalancingRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerLoadBalancingRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerLoadBalancingRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerLoadBalancingRulesClient) listHandleResponse(resp *http.Response) (LoadBalancerLoadBalancingRulesClientListResponse, error) { + result := LoadBalancerLoadBalancingRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerLoadBalancingRuleListResult); err != nil { + return LoadBalancerLoadBalancingRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancernetworkinterfaces_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancernetworkinterfaces_client.go new file mode 100644 index 000000000..2b8d6ef36 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancernetworkinterfaces_client.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerNetworkInterfacesClient contains the methods for the LoadBalancerNetworkInterfaces group. +// Don't use this type directly, use NewLoadBalancerNetworkInterfacesClient() instead. +type LoadBalancerNetworkInterfacesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerNetworkInterfacesClient creates a new instance of LoadBalancerNetworkInterfacesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerNetworkInterfacesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerNetworkInterfacesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets associated load balancer network interfaces. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerNetworkInterfacesClientListOptions contains the optional parameters for the LoadBalancerNetworkInterfacesClient.List +// method. +func (client *LoadBalancerNetworkInterfacesClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerNetworkInterfacesClientListOptions) *runtime.Pager[LoadBalancerNetworkInterfacesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerNetworkInterfacesClientListResponse]{ + More: func(page LoadBalancerNetworkInterfacesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerNetworkInterfacesClientListResponse) (LoadBalancerNetworkInterfacesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerNetworkInterfacesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerNetworkInterfacesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerNetworkInterfacesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerNetworkInterfacesClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerNetworkInterfacesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerNetworkInterfacesClient) listHandleResponse(resp *http.Response) (LoadBalancerNetworkInterfacesClientListResponse, error) { + result := LoadBalancerNetworkInterfacesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InterfaceListResult); err != nil { + return LoadBalancerNetworkInterfacesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalanceroutboundrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalanceroutboundrules_client.go new file mode 100644 index 000000000..5777f9402 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalanceroutboundrules_client.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerOutboundRulesClient contains the methods for the LoadBalancerOutboundRules group. +// Don't use this type directly, use NewLoadBalancerOutboundRulesClient() instead. +type LoadBalancerOutboundRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerOutboundRulesClient creates a new instance of LoadBalancerOutboundRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerOutboundRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerOutboundRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerOutboundRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified load balancer outbound rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// outboundRuleName - The name of the outbound rule. +// options - LoadBalancerOutboundRulesClientGetOptions contains the optional parameters for the LoadBalancerOutboundRulesClient.Get +// method. +func (client *LoadBalancerOutboundRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, outboundRuleName string, options *LoadBalancerOutboundRulesClientGetOptions) (LoadBalancerOutboundRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, outboundRuleName, options) + if err != nil { + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerOutboundRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancerOutboundRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, outboundRuleName string, options *LoadBalancerOutboundRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if outboundRuleName == "" { + return nil, errors.New("parameter outboundRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outboundRuleName}", url.PathEscape(outboundRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancerOutboundRulesClient) getHandleResponse(resp *http.Response) (LoadBalancerOutboundRulesClientGetResponse, error) { + result := LoadBalancerOutboundRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OutboundRule); err != nil { + return LoadBalancerOutboundRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the outbound rules in a load balancer. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerOutboundRulesClientListOptions contains the optional parameters for the LoadBalancerOutboundRulesClient.List +// method. +func (client *LoadBalancerOutboundRulesClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerOutboundRulesClientListOptions) *runtime.Pager[LoadBalancerOutboundRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerOutboundRulesClientListResponse]{ + More: func(page LoadBalancerOutboundRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerOutboundRulesClientListResponse) (LoadBalancerOutboundRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerOutboundRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerOutboundRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerOutboundRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerOutboundRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerOutboundRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerOutboundRulesClient) listHandleResponse(resp *http.Response) (LoadBalancerOutboundRulesClientListResponse, error) { + result := LoadBalancerOutboundRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerOutboundRuleListResult); err != nil { + return LoadBalancerOutboundRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerprobes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerprobes_client.go new file mode 100644 index 000000000..2598908d1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancerprobes_client.go @@ -0,0 +1,186 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancerProbesClient contains the methods for the LoadBalancerProbes group. +// Don't use this type directly, use NewLoadBalancerProbesClient() instead. +type LoadBalancerProbesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancerProbesClient creates a new instance of LoadBalancerProbesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancerProbesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancerProbesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancerProbesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets load balancer probe. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// probeName - The name of the probe. +// options - LoadBalancerProbesClientGetOptions contains the optional parameters for the LoadBalancerProbesClient.Get method. +func (client *LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string, options *LoadBalancerProbesClientGetOptions) (LoadBalancerProbesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, probeName, options) + if err != nil { + return LoadBalancerProbesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerProbesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerProbesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancerProbesClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string, options *LoadBalancerProbesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if probeName == "" { + return nil, errors.New("parameter probeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{probeName}", url.PathEscape(probeName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancerProbesClient) getHandleResponse(resp *http.Response) (LoadBalancerProbesClientGetResponse, error) { + result := LoadBalancerProbesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Probe); err != nil { + return LoadBalancerProbesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the load balancer probes. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancerProbesClientListOptions contains the optional parameters for the LoadBalancerProbesClient.List method. +func (client *LoadBalancerProbesClient) NewListPager(resourceGroupName string, loadBalancerName string, options *LoadBalancerProbesClientListOptions) *runtime.Pager[LoadBalancerProbesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancerProbesClientListResponse]{ + More: func(page LoadBalancerProbesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancerProbesClientListResponse) (LoadBalancerProbesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancerProbesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancerProbesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancerProbesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancerProbesClient) listCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancerProbesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancerProbesClient) listHandleResponse(resp *http.Response) (LoadBalancerProbesClientListResponse, error) { + result := LoadBalancerProbesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerProbeListResult); err != nil { + return LoadBalancerProbesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancers_client.go new file mode 100644 index 000000000..fa81af71f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/loadbalancers_client.go @@ -0,0 +1,558 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LoadBalancersClient contains the methods for the LoadBalancers group. +// Don't use this type directly, use NewLoadBalancersClient() instead. +type LoadBalancersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLoadBalancersClient creates a new instance of LoadBalancersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLoadBalancersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadBalancersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LoadBalancersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// parameters - Parameters supplied to the create or update load balancer operation. +// options - LoadBalancersClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadBalancersClient.BeginCreateOrUpdate +// method. +func (client *LoadBalancersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer, options *LoadBalancersClientBeginCreateOrUpdateOptions) (*runtime.Poller[LoadBalancersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, loadBalancerName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancersClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer, options *LoadBalancersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LoadBalancersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer, options *LoadBalancersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancersClientBeginDeleteOptions contains the optional parameters for the LoadBalancersClient.BeginDelete +// method. +func (client *LoadBalancersClient) BeginDelete(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientBeginDeleteOptions) (*runtime.Poller[LoadBalancersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, loadBalancerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancersClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LoadBalancersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified load balancer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// options - LoadBalancersClientGetOptions contains the optional parameters for the LoadBalancersClient.Get method. +func (client *LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientGetOptions) (LoadBalancersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, options) + if err != nil { + return LoadBalancersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LoadBalancersClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, options *LoadBalancersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LoadBalancersClient) getHandleResponse(resp *http.Response) (LoadBalancersClientGetResponse, error) { + result := LoadBalancersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancer); err != nil { + return LoadBalancersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the load balancers in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - LoadBalancersClientListOptions contains the optional parameters for the LoadBalancersClient.List method. +func (client *LoadBalancersClient) NewListPager(resourceGroupName string, options *LoadBalancersClientListOptions) *runtime.Pager[LoadBalancersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancersClientListResponse]{ + More: func(page LoadBalancersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancersClientListResponse) (LoadBalancersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LoadBalancersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *LoadBalancersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LoadBalancersClient) listHandleResponse(resp *http.Response) (LoadBalancersClientListResponse, error) { + result := LoadBalancersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerListResult); err != nil { + return LoadBalancersClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the load balancers in a subscription. +// Generated from API version 2022-05-01 +// options - LoadBalancersClientListAllOptions contains the optional parameters for the LoadBalancersClient.ListAll method. +func (client *LoadBalancersClient) NewListAllPager(options *LoadBalancersClientListAllOptions) *runtime.Pager[LoadBalancersClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[LoadBalancersClientListAllResponse]{ + More: func(page LoadBalancersClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LoadBalancersClientListAllResponse) (LoadBalancersClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LoadBalancersClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancersClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancersClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *LoadBalancersClient) listAllCreateRequest(ctx context.Context, options *LoadBalancersClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *LoadBalancersClient) listAllHandleResponse(resp *http.Response) (LoadBalancersClientListAllResponse, error) { + result := LoadBalancersClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerListResult); err != nil { + return LoadBalancersClientListAllResponse{}, err + } + return result, nil +} + +// BeginListInboundNatRulePortMappings - List of inbound NAT rule port mappings. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// groupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// backendPoolName - The name of the load balancer backend address pool. +// parameters - Query inbound NAT rule port mapping request. +// options - LoadBalancersClientBeginListInboundNatRulePortMappingsOptions contains the optional parameters for the LoadBalancersClient.BeginListInboundNatRulePortMappings +// method. +func (client *LoadBalancersClient) BeginListInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersClientBeginListInboundNatRulePortMappingsOptions) (*runtime.Poller[LoadBalancersClientListInboundNatRulePortMappingsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listInboundNatRulePortMappings(ctx, groupName, loadBalancerName, backendPoolName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancersClientListInboundNatRulePortMappingsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientListInboundNatRulePortMappingsResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListInboundNatRulePortMappings - List of inbound NAT rule port mappings. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancersClient) listInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersClientBeginListInboundNatRulePortMappingsOptions) (*http.Response, error) { + req, err := client.listInboundNatRulePortMappingsCreateRequest(ctx, groupName, loadBalancerName, backendPoolName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listInboundNatRulePortMappingsCreateRequest creates the ListInboundNatRulePortMappings request. +func (client *LoadBalancersClient) listInboundNatRulePortMappingsCreateRequest(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersClientBeginListInboundNatRulePortMappingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if backendPoolName == "" { + return nil, errors.New("parameter backendPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backendPoolName}", url.PathEscape(backendPoolName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginSwapPublicIPAddresses - Swaps VIPs between two load balancers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The region where load balancers are located at. +// parameters - Parameters that define which VIPs should be swapped. +// options - LoadBalancersClientBeginSwapPublicIPAddressesOptions contains the optional parameters for the LoadBalancersClient.BeginSwapPublicIPAddresses +// method. +func (client *LoadBalancersClient) BeginSwapPublicIPAddresses(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest, options *LoadBalancersClientBeginSwapPublicIPAddressesOptions) (*runtime.Poller[LoadBalancersClientSwapPublicIPAddressesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.swapPublicIPAddresses(ctx, location, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LoadBalancersClientSwapPublicIPAddressesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LoadBalancersClientSwapPublicIPAddressesResponse](options.ResumeToken, client.pl, nil) + } +} + +// SwapPublicIPAddresses - Swaps VIPs between two load balancers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LoadBalancersClient) swapPublicIPAddresses(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest, options *LoadBalancersClientBeginSwapPublicIPAddressesOptions) (*http.Response, error) { + req, err := client.swapPublicIPAddressesCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// swapPublicIPAddressesCreateRequest creates the SwapPublicIPAddresses request. +func (client *LoadBalancersClient) swapPublicIPAddressesCreateRequest(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest, options *LoadBalancersClientBeginSwapPublicIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// UpdateTags - Updates a load balancer tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// loadBalancerName - The name of the load balancer. +// parameters - Parameters supplied to update load balancer tags. +// options - LoadBalancersClientUpdateTagsOptions contains the optional parameters for the LoadBalancersClient.UpdateTags +// method. +func (client *LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject, options *LoadBalancersClientUpdateTagsOptions) (LoadBalancersClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, loadBalancerName, parameters, options) + if err != nil { + return LoadBalancersClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LoadBalancersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LoadBalancersClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *LoadBalancersClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject, options *LoadBalancersClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *LoadBalancersClient) updateTagsHandleResponse(resp *http.Response) (LoadBalancersClientUpdateTagsResponse, error) { + result := LoadBalancersClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancer); err != nil { + return LoadBalancersClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/localnetworkgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/localnetworkgateways_client.go new file mode 100644 index 000000000..8c7decb4f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/localnetworkgateways_client.go @@ -0,0 +1,367 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LocalNetworkGatewaysClient contains the methods for the LocalNetworkGateways group. +// Don't use this type directly, use NewLocalNetworkGatewaysClient() instead. +type LocalNetworkGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLocalNetworkGatewaysClient creates a new instance of LocalNetworkGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLocalNetworkGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocalNetworkGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LocalNetworkGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a local network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// localNetworkGatewayName - The name of the local network gateway. +// parameters - Parameters supplied to the create or update local network gateway operation. +// options - LocalNetworkGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalNetworkGatewaysClient.BeginCreateOrUpdate +// method. +func (client *LocalNetworkGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, options *LocalNetworkGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[LocalNetworkGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LocalNetworkGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalNetworkGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a local network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LocalNetworkGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, options *LocalNetworkGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LocalNetworkGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, options *LocalNetworkGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if localNetworkGatewayName == "" { + return nil, errors.New("parameter localNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localNetworkGatewayName}", url.PathEscape(localNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified local network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// localNetworkGatewayName - The name of the local network gateway. +// options - LocalNetworkGatewaysClientBeginDeleteOptions contains the optional parameters for the LocalNetworkGatewaysClient.BeginDelete +// method. +func (client *LocalNetworkGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientBeginDeleteOptions) (*runtime.Poller[LocalNetworkGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LocalNetworkGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalNetworkGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified local network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *LocalNetworkGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LocalNetworkGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if localNetworkGatewayName == "" { + return nil, errors.New("parameter localNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localNetworkGatewayName}", url.PathEscape(localNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified local network gateway in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// localNetworkGatewayName - The name of the local network gateway. +// options - LocalNetworkGatewaysClientGetOptions contains the optional parameters for the LocalNetworkGatewaysClient.Get +// method. +func (client *LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientGetOptions) (LocalNetworkGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, options) + if err != nil { + return LocalNetworkGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocalNetworkGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalNetworkGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LocalNetworkGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, options *LocalNetworkGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if localNetworkGatewayName == "" { + return nil, errors.New("parameter localNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localNetworkGatewayName}", url.PathEscape(localNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LocalNetworkGatewaysClient) getHandleResponse(resp *http.Response) (LocalNetworkGatewaysClientGetResponse, error) { + result := LocalNetworkGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGateway); err != nil { + return LocalNetworkGatewaysClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the local network gateways in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - LocalNetworkGatewaysClientListOptions contains the optional parameters for the LocalNetworkGatewaysClient.List +// method. +func (client *LocalNetworkGatewaysClient) NewListPager(resourceGroupName string, options *LocalNetworkGatewaysClientListOptions) *runtime.Pager[LocalNetworkGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LocalNetworkGatewaysClientListResponse]{ + More: func(page LocalNetworkGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LocalNetworkGatewaysClientListResponse) (LocalNetworkGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LocalNetworkGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocalNetworkGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalNetworkGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LocalNetworkGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *LocalNetworkGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LocalNetworkGatewaysClient) listHandleResponse(resp *http.Response) (LocalNetworkGatewaysClientListResponse, error) { + result := LocalNetworkGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGatewayListResult); err != nil { + return LocalNetworkGatewaysClientListResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a local network gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// localNetworkGatewayName - The name of the local network gateway. +// parameters - Parameters supplied to update local network gateway tags. +// options - LocalNetworkGatewaysClientUpdateTagsOptions contains the optional parameters for the LocalNetworkGatewaysClient.UpdateTags +// method. +func (client *LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject, options *LocalNetworkGatewaysClientUpdateTagsOptions) (LocalNetworkGatewaysClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, localNetworkGatewayName, parameters, options) + if err != nil { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *LocalNetworkGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject, options *LocalNetworkGatewaysClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if localNetworkGatewayName == "" { + return nil, errors.New("parameter localNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localNetworkGatewayName}", url.PathEscape(localNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *LocalNetworkGatewaysClient) updateTagsHandleResponse(resp *http.Response) (LocalNetworkGatewaysClientUpdateTagsResponse, error) { + result := LocalNetworkGatewaysClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGateway); err != nil { + return LocalNetworkGatewaysClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/management_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/management_client.go new file mode 100644 index 000000000..3ea779230 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/management_client.go @@ -0,0 +1,929 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ManagementClient contains the methods for the NetworkManagementClient group. +// Don't use this type directly, use NewManagementClient() instead. +type ManagementClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagementClient creates a new instance of ManagementClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagementClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckDNSNameAvailability - Checks whether a domain name in the cloudapp.azure.com zone is available for use. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// domainNameLabel - The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +// options - ManagementClientCheckDNSNameAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDNSNameAvailability +// method. +func (client *ManagementClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string, options *ManagementClientCheckDNSNameAvailabilityOptions) (ManagementClientCheckDNSNameAvailabilityResponse, error) { + req, err := client.checkDNSNameAvailabilityCreateRequest(ctx, location, domainNameLabel, options) + if err != nil { + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientCheckDNSNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkDNSNameAvailabilityHandleResponse(resp) +} + +// checkDNSNameAvailabilityCreateRequest creates the CheckDNSNameAvailability request. +func (client *ManagementClient) checkDNSNameAvailabilityCreateRequest(ctx context.Context, location string, domainNameLabel string, options *ManagementClientCheckDNSNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("domainNameLabel", domainNameLabel) + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// checkDNSNameAvailabilityHandleResponse handles the CheckDNSNameAvailability response. +func (client *ManagementClient) checkDNSNameAvailabilityHandleResponse(resp *http.Response) (ManagementClientCheckDNSNameAvailabilityResponse, error) { + result := ManagementClientCheckDNSNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DNSNameAvailabilityResult); err != nil { + return ManagementClientCheckDNSNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginDeleteBastionShareableLink - Deletes the Bastion Shareable Links for all the VMs specified in the request. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// bslRequest - Post request for all the Bastion Shareable Link endpoints. +// options - ManagementClientBeginDeleteBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginDeleteBastionShareableLink +// method. +func (client *ManagementClient) BeginDeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*runtime.Poller[ManagementClientDeleteBastionShareableLinkResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ManagementClientDeleteBastionShareableLinkResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ManagementClientDeleteBastionShareableLinkResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteBastionShareableLink - Deletes the Bastion Shareable Links for all the VMs specified in the request. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ManagementClient) deleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*http.Response, error) { + req, err := client.deleteBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteBastionShareableLinkCreateRequest creates the DeleteBastionShareableLink request. +func (client *ManagementClient) deleteBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginDeleteBastionShareableLinkOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, bslRequest) +} + +// NewDisconnectActiveSessionsPager - Returns the list of currently active sessions on the Bastion. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// sessionIDs - The list of sessionids to disconnect. +// options - ManagementClientDisconnectActiveSessionsOptions contains the optional parameters for the ManagementClient.DisconnectActiveSessions +// method. +func (client *ManagementClient) NewDisconnectActiveSessionsPager(resourceGroupName string, bastionHostName string, sessionIDs SessionIDs, options *ManagementClientDisconnectActiveSessionsOptions) *runtime.Pager[ManagementClientDisconnectActiveSessionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagementClientDisconnectActiveSessionsResponse]{ + More: func(page ManagementClientDisconnectActiveSessionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagementClientDisconnectActiveSessionsResponse) (ManagementClientDisconnectActiveSessionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.disconnectActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, sessionIDs, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagementClientDisconnectActiveSessionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientDisconnectActiveSessionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientDisconnectActiveSessionsResponse{}, runtime.NewResponseError(resp) + } + return client.disconnectActiveSessionsHandleResponse(resp) + }, + }) +} + +// disconnectActiveSessionsCreateRequest creates the DisconnectActiveSessions request. +func (client *ManagementClient) disconnectActiveSessionsCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIDs SessionIDs, options *ManagementClientDisconnectActiveSessionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sessionIDs) +} + +// disconnectActiveSessionsHandleResponse handles the DisconnectActiveSessions response. +func (client *ManagementClient) disconnectActiveSessionsHandleResponse(resp *http.Response) (ManagementClientDisconnectActiveSessionsResponse, error) { + result := ManagementClientDisconnectActiveSessionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionSessionDeleteResult); err != nil { + return ManagementClientDisconnectActiveSessionsResponse{}, err + } + return result, nil +} + +// ExpressRouteProviderPort - Retrieves detail of a provider port. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// providerport - The name of the provider port. +// options - ManagementClientExpressRouteProviderPortOptions contains the optional parameters for the ManagementClient.ExpressRouteProviderPort +// method. +func (client *ManagementClient) ExpressRouteProviderPort(ctx context.Context, providerport string, options *ManagementClientExpressRouteProviderPortOptions) (ManagementClientExpressRouteProviderPortResponse, error) { + req, err := client.expressRouteProviderPortCreateRequest(ctx, providerport, options) + if err != nil { + return ManagementClientExpressRouteProviderPortResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientExpressRouteProviderPortResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientExpressRouteProviderPortResponse{}, runtime.NewResponseError(resp) + } + return client.expressRouteProviderPortHandleResponse(resp) +} + +// expressRouteProviderPortCreateRequest creates the ExpressRouteProviderPort request. +func (client *ManagementClient) expressRouteProviderPortCreateRequest(ctx context.Context, providerport string, options *ManagementClientExpressRouteProviderPortOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}" + if providerport == "" { + return nil, errors.New("parameter providerport cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerport}", url.PathEscape(providerport)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// expressRouteProviderPortHandleResponse handles the ExpressRouteProviderPort response. +func (client *ManagementClient) expressRouteProviderPortHandleResponse(resp *http.Response) (ManagementClientExpressRouteProviderPortResponse, error) { + result := ManagementClientExpressRouteProviderPortResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteProviderPort); err != nil { + return ManagementClientExpressRouteProviderPortResponse{}, err + } + return result, nil +} + +// BeginGeneratevirtualwanvpnserverconfigurationvpnprofile - Generates a unique VPN profile for P2S clients for VirtualWan +// and associated VpnServerConfiguration combination in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name. +// virtualWANName - The name of the VirtualWAN whose associated VpnServerConfigurations is needed. +// vpnClientParams - Parameters supplied to the generate VirtualWan VPN profile generation operation. +// options - ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions contains the optional parameters +// for the ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile method. +func (client *ManagementClient) BeginGeneratevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*runtime.Poller[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generatevirtualwanvpnserverconfigurationvpnprofile(ctx, resourceGroupName, virtualWANName, vpnClientParams, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse](options.ResumeToken, client.pl, nil) + } +} + +// Generatevirtualwanvpnserverconfigurationvpnprofile - Generates a unique VPN profile for P2S clients for VirtualWan and +// associated VpnServerConfiguration combination in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ManagementClient) generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*http.Response, error) { + req, err := client.generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest(ctx, resourceGroupName, virtualWANName, vpnClientParams, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest creates the Generatevirtualwanvpnserverconfigurationvpnprofile request. +func (client *ManagementClient) generatevirtualwanvpnserverconfigurationvpnprofileCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVPNProfileParameters, options *ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnClientParams) +} + +// BeginGetActiveSessions - Returns the list of currently active sessions on the Bastion. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// options - ManagementClientBeginGetActiveSessionsOptions contains the optional parameters for the ManagementClient.BeginGetActiveSessions +// method. +func (client *ManagementClient) BeginGetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*runtime.Poller[*runtime.Pager[ManagementClientGetActiveSessionsResponse]], error) { + pager := runtime.NewPager(runtime.PagingHandler[ManagementClientGetActiveSessionsResponse]{ + More: func(page ManagementClientGetActiveSessionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagementClientGetActiveSessionsResponse) (ManagementClientGetActiveSessionsResponse, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + if err != nil { + return ManagementClientGetActiveSessionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientGetActiveSessionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientGetActiveSessionsResponse{}, runtime.NewResponseError(resp) + } + return client.getActiveSessionsHandleResponse(resp) + }, + }) + if options == nil || options.ResumeToken == "" { + resp, err := client.getActiveSessions(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.pl, &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[ManagementClientGetActiveSessionsResponse]]{ + Response: &pager, + }) + } +} + +// GetActiveSessions - Returns the list of currently active sessions on the Bastion. +// Generated from API version 2022-05-01 +func (client *ManagementClient) getActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*http.Response, error) { + req, err := client.getActiveSessionsCreateRequest(ctx, resourceGroupName, bastionHostName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getActiveSessionsCreateRequest creates the GetActiveSessions request. +func (client *ManagementClient) getActiveSessionsCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, options *ManagementClientBeginGetActiveSessionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getActiveSessionsHandleResponse handles the GetActiveSessions response. +func (client *ManagementClient) getActiveSessionsHandleResponse(resp *http.Response) (ManagementClientGetActiveSessionsResponse, error) { + result := ManagementClientGetActiveSessionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionActiveSessionListResult); err != nil { + return ManagementClientGetActiveSessionsResponse{}, err + } + return result, nil +} + +// NewGetBastionShareableLinkPager - Return the Bastion Shareable Links for all the VMs specified in the request. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// bslRequest - Post request for all the Bastion Shareable Link endpoints. +// options - ManagementClientGetBastionShareableLinkOptions contains the optional parameters for the ManagementClient.GetBastionShareableLink +// method. +func (client *ManagementClient) NewGetBastionShareableLinkPager(resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientGetBastionShareableLinkOptions) *runtime.Pager[ManagementClientGetBastionShareableLinkResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagementClientGetBastionShareableLinkResponse]{ + More: func(page ManagementClientGetBastionShareableLinkResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagementClientGetBastionShareableLinkResponse) (ManagementClientGetBastionShareableLinkResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.getBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagementClientGetBastionShareableLinkResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientGetBastionShareableLinkResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientGetBastionShareableLinkResponse{}, runtime.NewResponseError(resp) + } + return client.getBastionShareableLinkHandleResponse(resp) + }, + }) +} + +// getBastionShareableLinkCreateRequest creates the GetBastionShareableLink request. +func (client *ManagementClient) getBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientGetBastionShareableLinkOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, bslRequest) +} + +// getBastionShareableLinkHandleResponse handles the GetBastionShareableLink response. +func (client *ManagementClient) getBastionShareableLinkHandleResponse(resp *http.Response) (ManagementClientGetBastionShareableLinkResponse, error) { + result := ManagementClientGetBastionShareableLinkResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { + return ManagementClientGetBastionShareableLinkResponse{}, err + } + return result, nil +} + +// ListActiveConnectivityConfigurations - Lists active connectivity configurations in a network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Active Configuration Parameter. +// options - ManagementClientListActiveConnectivityConfigurationsOptions contains the optional parameters for the ManagementClient.ListActiveConnectivityConfigurations +// method. +func (client *ManagementClient) ListActiveConnectivityConfigurations(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveConnectivityConfigurationsOptions) (ManagementClientListActiveConnectivityConfigurationsResponse, error) { + req, err := client.listActiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.listActiveConnectivityConfigurationsHandleResponse(resp) +} + +// listActiveConnectivityConfigurationsCreateRequest creates the ListActiveConnectivityConfigurations request. +func (client *ManagementClient) listActiveConnectivityConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveConnectivityConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listActiveConnectivityConfigurationsHandleResponse handles the ListActiveConnectivityConfigurations response. +func (client *ManagementClient) listActiveConnectivityConfigurationsHandleResponse(resp *http.Response) (ManagementClientListActiveConnectivityConfigurationsResponse, error) { + result := ManagementClientListActiveConnectivityConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActiveConnectivityConfigurationsListResult); err != nil { + return ManagementClientListActiveConnectivityConfigurationsResponse{}, err + } + return result, nil +} + +// ListActiveSecurityAdminRules - Lists active security admin rules in a network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Active Configuration Parameter. +// options - ManagementClientListActiveSecurityAdminRulesOptions contains the optional parameters for the ManagementClient.ListActiveSecurityAdminRules +// method. +func (client *ManagementClient) ListActiveSecurityAdminRules(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveSecurityAdminRulesOptions) (ManagementClientListActiveSecurityAdminRulesResponse, error) { + req, err := client.listActiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientListActiveSecurityAdminRulesResponse{}, runtime.NewResponseError(resp) + } + return client.listActiveSecurityAdminRulesHandleResponse(resp) +} + +// listActiveSecurityAdminRulesCreateRequest creates the ListActiveSecurityAdminRules request. +func (client *ManagementClient) listActiveSecurityAdminRulesCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ActiveConfigurationParameter, options *ManagementClientListActiveSecurityAdminRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listActiveSecurityAdminRulesHandleResponse handles the ListActiveSecurityAdminRules response. +func (client *ManagementClient) listActiveSecurityAdminRulesHandleResponse(resp *http.Response) (ManagementClientListActiveSecurityAdminRulesResponse, error) { + result := ManagementClientListActiveSecurityAdminRulesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActiveSecurityAdminRulesListResult); err != nil { + return ManagementClientListActiveSecurityAdminRulesResponse{}, err + } + return result, nil +} + +// ListNetworkManagerEffectiveConnectivityConfigurations - List all effective connectivity configurations applied on a virtual +// network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// parameters - Parameters supplied to list correct page. +// options - ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions contains the optional parameters +// for the ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations method. +func (client *ManagementClient) ListNetworkManagerEffectiveConnectivityConfigurations(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse, error) { + req, err := client.listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, runtime.NewResponseError(resp) + } + return client.listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse(resp) +} + +// listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest creates the ListNetworkManagerEffectiveConnectivityConfigurations request. +func (client *ManagementClient) listNetworkManagerEffectiveConnectivityConfigurationsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse handles the ListNetworkManagerEffectiveConnectivityConfigurations response. +func (client *ManagementClient) listNetworkManagerEffectiveConnectivityConfigurationsHandleResponse(resp *http.Response) (ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse, error) { + result := ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerEffectiveConnectivityConfigurationListResult); err != nil { + return ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse{}, err + } + return result, nil +} + +// ListNetworkManagerEffectiveSecurityAdminRules - List all effective security admin rules applied on a virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// parameters - Parameters supplied to list correct page. +// options - ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions contains the optional parameters for the +// ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules method. +func (client *ManagementClient) ListNetworkManagerEffectiveSecurityAdminRules(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse, error) { + req, err := client.listNetworkManagerEffectiveSecurityAdminRulesCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, runtime.NewResponseError(resp) + } + return client.listNetworkManagerEffectiveSecurityAdminRulesHandleResponse(resp) +} + +// listNetworkManagerEffectiveSecurityAdminRulesCreateRequest creates the ListNetworkManagerEffectiveSecurityAdminRules request. +func (client *ManagementClient) listNetworkManagerEffectiveSecurityAdminRulesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters QueryRequestOptions, options *ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listNetworkManagerEffectiveSecurityAdminRulesHandleResponse handles the ListNetworkManagerEffectiveSecurityAdminRules response. +func (client *ManagementClient) listNetworkManagerEffectiveSecurityAdminRulesHandleResponse(resp *http.Response) (ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse, error) { + result := ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerEffectiveSecurityAdminRulesListResult); err != nil { + return ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse{}, err + } + return result, nil +} + +// BeginPutBastionShareableLink - Creates a Bastion Shareable Links for all the VMs specified in the request. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// bastionHostName - The name of the Bastion Host. +// bslRequest - Post request for all the Bastion Shareable Link endpoints. +// options - ManagementClientBeginPutBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginPutBastionShareableLink +// method. +func (client *ManagementClient) BeginPutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*runtime.Poller[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]], error) { + pager := runtime.NewPager(runtime.PagingHandler[ManagementClientPutBastionShareableLinkResponse]{ + More: func(page ManagementClientPutBastionShareableLinkResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagementClientPutBastionShareableLinkResponse) (ManagementClientPutBastionShareableLinkResponse, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + if err != nil { + return ManagementClientPutBastionShareableLinkResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientPutBastionShareableLinkResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientPutBastionShareableLinkResponse{}, runtime.NewResponseError(resp) + } + return client.putBastionShareableLinkHandleResponse(resp) + }, + }) + if options == nil || options.ResumeToken == "" { + resp, err := client.putBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.pl, &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[ManagementClientPutBastionShareableLinkResponse]]{ + Response: &pager, + }) + } +} + +// PutBastionShareableLink - Creates a Bastion Shareable Links for all the VMs specified in the request. +// Generated from API version 2022-05-01 +func (client *ManagementClient) putBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*http.Response, error) { + req, err := client.putBastionShareableLinkCreateRequest(ctx, resourceGroupName, bastionHostName, bslRequest, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// putBastionShareableLinkCreateRequest creates the PutBastionShareableLink request. +func (client *ManagementClient) putBastionShareableLinkCreateRequest(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest, options *ManagementClientBeginPutBastionShareableLinkOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if bastionHostName == "" { + return nil, errors.New("parameter bastionHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bastionHostName}", url.PathEscape(bastionHostName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, bslRequest) +} + +// putBastionShareableLinkHandleResponse handles the PutBastionShareableLink response. +func (client *ManagementClient) putBastionShareableLinkHandleResponse(resp *http.Response) (ManagementClientPutBastionShareableLinkResponse, error) { + result := ManagementClientPutBastionShareableLinkResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { + return ManagementClientPutBastionShareableLinkResponse{}, err + } + return result, nil +} + +// SupportedSecurityProviders - Gives the supported security providers for the virtual wan. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name. +// virtualWANName - The name of the VirtualWAN for which supported security providers are needed. +// options - ManagementClientSupportedSecurityProvidersOptions contains the optional parameters for the ManagementClient.SupportedSecurityProviders +// method. +func (client *ManagementClient) SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string, options *ManagementClientSupportedSecurityProvidersOptions) (ManagementClientSupportedSecurityProvidersResponse, error) { + req, err := client.supportedSecurityProvidersCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementClientSupportedSecurityProvidersResponse{}, runtime.NewResponseError(resp) + } + return client.supportedSecurityProvidersHandleResponse(resp) +} + +// supportedSecurityProvidersCreateRequest creates the SupportedSecurityProviders request. +func (client *ManagementClient) supportedSecurityProvidersCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, options *ManagementClientSupportedSecurityProvidersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// supportedSecurityProvidersHandleResponse handles the SupportedSecurityProviders response. +func (client *ManagementClient) supportedSecurityProvidersHandleResponse(resp *http.Response) (ManagementClientSupportedSecurityProvidersResponse, error) { + result := ManagementClientSupportedSecurityProvidersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWanSecurityProviders); err != nil { + return ManagementClientSupportedSecurityProvidersResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managementgroupnetworkmanagerconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managementgroupnetworkmanagerconnections_client.go new file mode 100644 index 000000000..eb03b3020 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managementgroupnetworkmanagerconnections_client.go @@ -0,0 +1,271 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ManagementGroupNetworkManagerConnectionsClient contains the methods for the ManagementGroupNetworkManagerConnections group. +// Don't use this type directly, use NewManagementGroupNetworkManagerConnectionsClient() instead. +type ManagementGroupNetworkManagerConnectionsClient struct { + host string + pl runtime.Pipeline +} + +// NewManagementGroupNetworkManagerConnectionsClient creates a new instance of ManagementGroupNetworkManagerConnectionsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagementGroupNetworkManagerConnectionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementGroupNetworkManagerConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagementGroupNetworkManagerConnectionsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create a network manager connection on this management group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// managementGroupID - The management group Id which uniquely identify the Microsoft Azure management group. +// networkManagerConnectionName - Name for the network manager connection. +// parameters - Network manager connection to be created/updated. +// options - ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions contains the optional parameters for the +// ManagementGroupNetworkManagerConnectionsClient.CreateOrUpdate method. +func (client *ManagementGroupNetworkManagerConnectionsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, networkManagerConnectionName string, parameters ManagerConnection, options *ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions) (ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, networkManagerConnectionName, parameters, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagementGroupNetworkManagerConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, networkManagerConnectionName string, parameters ManagerConnection, options *ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagementGroupNetworkManagerConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse, error) { + result := ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnection); err != nil { + return ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete specified pending connection created by this management group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// managementGroupID - The management group Id which uniquely identify the Microsoft Azure management group. +// networkManagerConnectionName - Name for the network manager connection. +// options - ManagementGroupNetworkManagerConnectionsClientDeleteOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.Delete +// method. +func (client *ManagementGroupNetworkManagerConnectionsClient) Delete(ctx context.Context, managementGroupID string, networkManagerConnectionName string, options *ManagementGroupNetworkManagerConnectionsClientDeleteOptions) (ManagementGroupNetworkManagerConnectionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, managementGroupID, networkManagerConnectionName, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ManagementGroupNetworkManagerConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagementGroupNetworkManagerConnectionsClient) deleteCreateRequest(ctx context.Context, managementGroupID string, networkManagerConnectionName string, options *ManagementGroupNetworkManagerConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a specified connection created by this management group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// managementGroupID - The management group Id which uniquely identify the Microsoft Azure management group. +// networkManagerConnectionName - Name for the network manager connection. +// options - ManagementGroupNetworkManagerConnectionsClientGetOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.Get +// method. +func (client *ManagementGroupNetworkManagerConnectionsClient) Get(ctx context.Context, managementGroupID string, networkManagerConnectionName string, options *ManagementGroupNetworkManagerConnectionsClientGetOptions) (ManagementGroupNetworkManagerConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, managementGroupID, networkManagerConnectionName, options) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagementGroupNetworkManagerConnectionsClient) getCreateRequest(ctx context.Context, managementGroupID string, networkManagerConnectionName string, options *ManagementGroupNetworkManagerConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagementGroupNetworkManagerConnectionsClient) getHandleResponse(resp *http.Response) (ManagementGroupNetworkManagerConnectionsClientGetResponse, error) { + result := ManagementGroupNetworkManagerConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnection); err != nil { + return ManagementGroupNetworkManagerConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all network manager connections created by this management group. +// Generated from API version 2022-05-01 +// managementGroupID - The management group Id which uniquely identify the Microsoft Azure management group. +// options - ManagementGroupNetworkManagerConnectionsClientListOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.List +// method. +func (client *ManagementGroupNetworkManagerConnectionsClient) NewListPager(managementGroupID string, options *ManagementGroupNetworkManagerConnectionsClientListOptions) *runtime.Pager[ManagementGroupNetworkManagerConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagementGroupNetworkManagerConnectionsClientListResponse]{ + More: func(page ManagementGroupNetworkManagerConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagementGroupNetworkManagerConnectionsClientListResponse) (ManagementGroupNetworkManagerConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, managementGroupID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagementGroupNetworkManagerConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagementGroupNetworkManagerConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagementGroupNetworkManagerConnectionsClient) listCreateRequest(ctx context.Context, managementGroupID string, options *ManagementGroupNetworkManagerConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagementGroupNetworkManagerConnectionsClient) listHandleResponse(resp *http.Response) (ManagementGroupNetworkManagerConnectionsClientListResponse, error) { + result := ManagementGroupNetworkManagerConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnectionListResult); err != nil { + return ManagementGroupNetworkManagerConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managercommits_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managercommits_client.go new file mode 100644 index 000000000..2ce32c01e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managercommits_client.go @@ -0,0 +1,123 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagerCommitsClient contains the methods for the NetworkManagerCommits group. +// Don't use this type directly, use NewManagerCommitsClient() instead. +type ManagerCommitsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagerCommitsClient creates a new instance of ManagerCommitsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagerCommitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagerCommitsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagerCommitsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginPost - Post a Network Manager Commit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Parameters supplied to specify which Managed Network commit is. +// options - ManagerCommitsClientBeginPostOptions contains the optional parameters for the ManagerCommitsClient.BeginPost +// method. +func (client *ManagerCommitsClient) BeginPost(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerCommit, options *ManagerCommitsClientBeginPostOptions) (*runtime.Poller[ManagerCommitsClientPostResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.post(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ManagerCommitsClientPostResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ManagerCommitsClientPostResponse](options.ResumeToken, client.pl, nil) + } +} + +// Post - Post a Network Manager Commit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ManagerCommitsClient) post(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerCommit, options *ManagerCommitsClientBeginPostOptions) (*http.Response, error) { + req, err := client.postCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// postCreateRequest creates the Post request. +func (client *ManagerCommitsClient) postCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerCommit, options *ManagerCommitsClientBeginPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/commit" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managerdeploymentstatus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managerdeploymentstatus_client.go new file mode 100644 index 000000000..9a5166434 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managerdeploymentstatus_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ManagerDeploymentStatusClient contains the methods for the NetworkManagerDeploymentStatus group. +// Don't use this type directly, use NewManagerDeploymentStatusClient() instead. +type ManagerDeploymentStatusClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagerDeploymentStatusClient creates a new instance of ManagerDeploymentStatusClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagerDeploymentStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagerDeploymentStatusClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagerDeploymentStatusClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Post to List of Network Manager Deployment Status. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Parameters supplied to specify which Managed Network deployment status is. +// options - ManagerDeploymentStatusClientListOptions contains the optional parameters for the ManagerDeploymentStatusClient.List +// method. +func (client *ManagerDeploymentStatusClient) List(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerDeploymentStatusParameter, options *ManagerDeploymentStatusClientListOptions) (ManagerDeploymentStatusClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagerDeploymentStatusClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagerDeploymentStatusClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagerDeploymentStatusClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ManagerDeploymentStatusClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters ManagerDeploymentStatusParameter, options *ManagerDeploymentStatusClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listDeploymentStatus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listHandleResponse handles the List response. +func (client *ManagerDeploymentStatusClient) listHandleResponse(resp *http.Response) (ManagerDeploymentStatusClientListResponse, error) { + result := ManagerDeploymentStatusClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerDeploymentStatusListResult); err != nil { + return ManagerDeploymentStatusClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managers_client.go new file mode 100644 index 000000000..ee49c55dd --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/managers_client.go @@ -0,0 +1,429 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ManagersClient contains the methods for the NetworkManagers group. +// Don't use this type directly, use NewManagersClient() instead. +type ManagersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagersClient creates a new instance of ManagersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a Network Manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Parameters supplied to specify which network manager is. +// options - ManagersClientCreateOrUpdateOptions contains the optional parameters for the ManagersClient.CreateOrUpdate method. +func (client *ManagersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, parameters Manager, options *ManagersClientCreateOrUpdateOptions) (ManagersClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ManagersClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters Manager, options *ManagersClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagersClient) createOrUpdateHandleResponse(resp *http.Response) (ManagersClientCreateOrUpdateResponse, error) { + result := ManagersClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes a network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - ManagersClientBeginDeleteOptions contains the optional parameters for the ManagersClient.BeginDelete method. +func (client *ManagersClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*runtime.Poller[ManagersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ManagersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ManagersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ManagersClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Network Manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - ManagersClientGetOptions contains the optional parameters for the ManagersClient.Get method. +func (client *ManagersClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientGetOptions) (ManagersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, options) + if err != nil { + return ManagersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagersClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ManagersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagersClient) getHandleResponse(resp *http.Response) (ManagersClientGetResponse, error) { + result := ManagersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List network managers in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ManagersClientListOptions contains the optional parameters for the ManagersClient.List method. +func (client *ManagersClient) NewListPager(resourceGroupName string, options *ManagersClientListOptions) *runtime.Pager[ManagersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListResponse]{ + More: func(page ManagersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagersClientListResponse) (ManagersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ManagersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagersClient) listHandleResponse(resp *http.Response) (ManagersClientListResponse, error) { + result := ManagersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerListResult); err != nil { + return ManagersClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List all network managers in a subscription. +// Generated from API version 2022-05-01 +// options - ManagersClientListBySubscriptionOptions contains the optional parameters for the ManagersClient.ListBySubscription +// method. +func (client *ManagersClient) NewListBySubscriptionPager(options *ManagersClientListBySubscriptionOptions) *runtime.Pager[ManagersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagersClientListBySubscriptionResponse]{ + More: func(page ManagersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagersClientListBySubscriptionResponse) (ManagersClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagersClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ManagersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ManagersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ManagersClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagersClientListBySubscriptionResponse, error) { + result := ManagersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerListResult); err != nil { + return ManagersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Patch - Patch NetworkManager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// parameters - Parameters supplied to specify which network manager is. +// options - ManagersClientPatchOptions contains the optional parameters for the ManagersClient.Patch method. +func (client *ManagersClient) Patch(ctx context.Context, resourceGroupName string, networkManagerName string, parameters PatchObject, options *ManagersClientPatchOptions) (ManagersClientPatchResponse, error) { + req, err := client.patchCreateRequest(ctx, resourceGroupName, networkManagerName, parameters, options) + if err != nil { + return ManagersClientPatchResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagersClientPatchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagersClientPatchResponse{}, runtime.NewResponseError(resp) + } + return client.patchHandleResponse(resp) +} + +// patchCreateRequest creates the Patch request. +func (client *ManagersClient) patchCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, parameters PatchObject, options *ManagersClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// patchHandleResponse handles the Patch response. +func (client *ManagersClient) patchHandleResponse(resp *http.Response) (ManagersClientPatchResponse, error) { + result := ManagersClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Manager); err != nil { + return ManagersClientPatchResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models.go new file mode 100644 index 000000000..e46dd8cf2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models.go @@ -0,0 +1,17438 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import "time" + +// AADAuthenticationParameters - AAD Vpn authentication type related parameters. +type AADAuthenticationParameters struct { + // AAD Vpn authentication parameter AAD audience. + AADAudience *string `json:"aadAudience,omitempty"` + + // AAD Vpn authentication parameter AAD issuer. + AADIssuer *string `json:"aadIssuer,omitempty"` + + // AAD Vpn authentication parameter AAD tenant. + AADTenant *string `json:"aadTenant,omitempty"` +} + +// Action to be taken on a route matching a RouteMap criterion. +type Action struct { + // List of parameters relevant to the action.For instance if type is drop then parameters has list of prefixes to be dropped.If + // type is add, parameters would have list of ASN numbers to be added + Parameters []*Parameter `json:"parameters,omitempty"` + + // Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and 'Drop.' + Type *RouteMapActionType `json:"type,omitempty"` +} + +// ActiveBaseSecurityAdminRuleClassification provides polymorphic access to related types. +// Call the interface's GetActiveBaseSecurityAdminRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ActiveBaseSecurityAdminRule, *ActiveDefaultSecurityAdminRule, *ActiveSecurityAdminRule +type ActiveBaseSecurityAdminRuleClassification interface { + // GetActiveBaseSecurityAdminRule returns the ActiveBaseSecurityAdminRule content of the underlying type. + GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule +} + +// ActiveBaseSecurityAdminRule - Network base admin rule. +type ActiveBaseSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // Deployment time string. + CommitTime *time.Time `json:"commitTime,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Deployment region. + Region *string `json:"region,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetActiveBaseSecurityAdminRule implements the ActiveBaseSecurityAdminRuleClassification interface for type ActiveBaseSecurityAdminRule. +func (a *ActiveBaseSecurityAdminRule) GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule { + return a +} + +// ActiveConfigurationParameter - Effective Virtual Networks Parameter. +type ActiveConfigurationParameter struct { + // List of regions. + Regions []*string `json:"regions,omitempty"` + + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ActiveConnectivityConfiguration - Active connectivity configuration. +type ActiveConnectivityConfiguration struct { + // Deployment time string. + CommitTime *time.Time `json:"commitTime,omitempty"` + + // Effective configuration groups. + ConfigurationGroups []*ConfigurationGroup `json:"configurationGroups,omitempty"` + + // Connectivity configuration ID. + ID *string `json:"id,omitempty"` + + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties `json:"properties,omitempty"` + + // Deployment region. + Region *string `json:"region,omitempty"` +} + +// ActiveConnectivityConfigurationsListResult - Result of the request to list active connectivity configurations. It contains +// a list of active connectivity configurations and a skiptoken to get the next set of results. +type ActiveConnectivityConfigurationsListResult struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` + + // Gets a page of active connectivity configurations. + Value []*ActiveConnectivityConfiguration `json:"value,omitempty"` +} + +// ActiveDefaultSecurityAdminRule - Network default admin rule. +type ActiveDefaultSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // Deployment time string. + CommitTime *time.Time `json:"commitTime,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Indicates the properties of the default security admin rule + Properties *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + + // Deployment region. + Region *string `json:"region,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetActiveBaseSecurityAdminRule implements the ActiveBaseSecurityAdminRuleClassification interface for type ActiveDefaultSecurityAdminRule. +func (a *ActiveDefaultSecurityAdminRule) GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule { + return &ActiveBaseSecurityAdminRule{ + ID: a.ID, + CommitTime: a.CommitTime, + Region: a.Region, + ConfigurationDescription: a.ConfigurationDescription, + RuleCollectionDescription: a.RuleCollectionDescription, + RuleCollectionAppliesToGroups: a.RuleCollectionAppliesToGroups, + RuleGroups: a.RuleGroups, + Kind: a.Kind, + } +} + +// ActiveSecurityAdminRule - Network admin rule. +type ActiveSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // Deployment time string. + CommitTime *time.Time `json:"commitTime,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat `json:"properties,omitempty"` + + // Deployment region. + Region *string `json:"region,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetActiveBaseSecurityAdminRule implements the ActiveBaseSecurityAdminRuleClassification interface for type ActiveSecurityAdminRule. +func (a *ActiveSecurityAdminRule) GetActiveBaseSecurityAdminRule() *ActiveBaseSecurityAdminRule { + return &ActiveBaseSecurityAdminRule{ + ID: a.ID, + CommitTime: a.CommitTime, + Region: a.Region, + ConfigurationDescription: a.ConfigurationDescription, + RuleCollectionDescription: a.RuleCollectionDescription, + RuleCollectionAppliesToGroups: a.RuleCollectionAppliesToGroups, + RuleGroups: a.RuleGroups, + Kind: a.Kind, + } +} + +// ActiveSecurityAdminRulesListResult - Result of the request to list active security admin rules. It contains a list of active +// security admin rules and a skiptoken to get the next set of results. +type ActiveSecurityAdminRulesListResult struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` + + // Gets a page of active security admin rules. + Value []ActiveBaseSecurityAdminRuleClassification `json:"value,omitempty"` +} + +// AddressPrefixItem - Address prefix item. +type AddressPrefixItem struct { + // Address prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // Address prefix type. + AddressPrefixType *AddressPrefixType `json:"addressPrefixType,omitempty"` +} + +// AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network. +type AddressSpace struct { + // A list of address blocks reserved for this virtual network in CIDR notation. + AddressPrefixes []*string `json:"addressPrefixes,omitempty"` +} + +// AdminPropertiesFormat - Security admin rule resource. +type AdminPropertiesFormat struct { + // REQUIRED; Indicates the access allowed for this particular rule + Access *SecurityConfigurationRuleAccess `json:"access,omitempty"` + + // REQUIRED; Indicates if the traffic matched against the rule in inbound or outbound. + Direction *SecurityConfigurationRuleDirection `json:"direction,omitempty"` + + // REQUIRED; The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule + // in the collection. The lower the priority number, the higher the priority of the rule. + Priority *int32 `json:"priority,omitempty"` + + // REQUIRED; Network protocol this rule applies to. + Protocol *SecurityConfigurationRuleProtocol `json:"protocol,omitempty"` + + // A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + + // The destination port ranges. + DestinationPortRanges []*string `json:"destinationPortRanges,omitempty"` + + // The destination address prefixes. CIDR or destination IP ranges. + Destinations []*AddressPrefixItem `json:"destinations,omitempty"` + + // The source port ranges. + SourcePortRanges []*string `json:"sourcePortRanges,omitempty"` + + // The CIDR or source IP ranges. + Sources []*AddressPrefixItem `json:"sources,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AdminRule - Network admin rule. +type AdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind `json:"kind,omitempty"` + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GetBaseAdminRule implements the BaseAdminRuleClassification interface for type AdminRule. +func (a *AdminRule) GetBaseAdminRule() *BaseAdminRule { + return &BaseAdminRule{ + Kind: a.Kind, + SystemData: a.SystemData, + ID: a.ID, + Name: a.Name, + Type: a.Type, + Etag: a.Etag, + } +} + +// AdminRuleCollection - Defines the admin rule collection. +type AdminRuleCollection struct { + // Indicates the properties for the network manager admin rule collection. + Properties *AdminRuleCollectionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AdminRuleCollectionListResult - Security admin configuration rule collection list result. +type AdminRuleCollectionListResult struct { + // Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of network manager security admin configuration rule collections + Value []*AdminRuleCollection `json:"value,omitempty"` +} + +// AdminRuleCollectionPropertiesFormat - Defines the admin rule collection properties. +type AdminRuleCollectionPropertiesFormat struct { + // REQUIRED; Groups for configuration + AppliesToGroups []*ManagerSecurityGroupItem `json:"appliesToGroups,omitempty"` + + // A description of the admin rule collection. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AdminRuleCollectionsClientBeginDeleteOptions contains the optional parameters for the AdminRuleCollectionsClient.BeginDelete +// method. +type AdminRuleCollectionsClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AdminRuleCollectionsClientCreateOrUpdateOptions contains the optional parameters for the AdminRuleCollectionsClient.CreateOrUpdate +// method. +type AdminRuleCollectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AdminRuleCollectionsClientGetOptions contains the optional parameters for the AdminRuleCollectionsClient.Get method. +type AdminRuleCollectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AdminRuleCollectionsClientListOptions contains the optional parameters for the AdminRuleCollectionsClient.List method. +type AdminRuleCollectionsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// AdminRuleListResult - security configuration admin rule list result. +type AdminRuleListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of admin rules + Value []BaseAdminRuleClassification `json:"value,omitempty"` +} + +// AdminRulesClientBeginDeleteOptions contains the optional parameters for the AdminRulesClient.BeginDelete method. +type AdminRulesClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AdminRulesClientCreateOrUpdateOptions contains the optional parameters for the AdminRulesClient.CreateOrUpdate method. +type AdminRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AdminRulesClientGetOptions contains the optional parameters for the AdminRulesClient.Get method. +type AdminRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AdminRulesClientListOptions contains the optional parameters for the AdminRulesClient.List method. +type AdminRulesClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ApplicationGateway - Application gateway resource. +type ApplicationGateway struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The identity of the application gateway, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the application gateway. + Properties *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting where the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayAuthenticationCertificate - Authentication certificates of an application gateway. +type ApplicationGatewayAuthenticationCertificate struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the authentication certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway authentication certificate. + Properties *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayAuthenticationCertificatePropertiesFormat - Authentication certificates properties of an application +// gateway. +type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { + // Certificate public data. + Data *string `json:"data,omitempty"` + + // READ-ONLY; The provisioning state of the authentication certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayAutoscaleConfiguration - Application Gateway autoscale configuration. +type ApplicationGatewayAutoscaleConfiguration struct { + // REQUIRED; Lower bound on number of Application Gateway capacity. + MinCapacity *int32 `json:"minCapacity,omitempty"` + + // Upper bound on number of Application Gateway capacity. + MaxCapacity *int32 `json:"maxCapacity,omitempty"` +} + +// ApplicationGatewayAvailableSSLOptions - Response for ApplicationGatewayAvailableSslOptions API service call. +type ApplicationGatewayAvailableSSLOptions struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the application gateway available SSL options. + Properties *ApplicationGatewayAvailableSSLOptionsPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayAvailableSSLOptionsPropertiesFormat - Properties of ApplicationGatewayAvailableSslOptions. +type ApplicationGatewayAvailableSSLOptionsPropertiesFormat struct { + // List of available Ssl cipher suites. + AvailableCipherSuites []*ApplicationGatewaySSLCipherSuite `json:"availableCipherSuites,omitempty"` + + // List of available Ssl protocols. + AvailableProtocols []*ApplicationGatewaySSLProtocol `json:"availableProtocols,omitempty"` + + // Name of the Ssl predefined policy applied by default to application gateway. + DefaultPolicy *ApplicationGatewaySSLPolicyName `json:"defaultPolicy,omitempty"` + + // List of available Ssl predefined policy. + PredefinedPolicies []*SubResource `json:"predefinedPolicies,omitempty"` +} + +// ApplicationGatewayAvailableSSLPredefinedPolicies - Response for ApplicationGatewayAvailableSslOptions API service call. +type ApplicationGatewayAvailableSSLPredefinedPolicies struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of available Ssl predefined policy. + Value []*ApplicationGatewaySSLPredefinedPolicy `json:"value,omitempty"` +} + +// ApplicationGatewayAvailableWafRuleSetsResult - Response for ApplicationGatewayAvailableWafRuleSets API service call. +type ApplicationGatewayAvailableWafRuleSetsResult struct { + // The list of application gateway rule sets. + Value []*ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` +} + +// ApplicationGatewayBackendAddress - Backend address of an application gateway. +type ApplicationGatewayBackendAddress struct { + // Fully qualified domain name (FQDN). + Fqdn *string `json:"fqdn,omitempty"` + + // IP address. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// ApplicationGatewayBackendAddressPool - Backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPool struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the backend address pool that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway backend address pool. + Properties *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayBackendAddressPoolPropertiesFormat - Properties of Backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { + // Backend addresses. + BackendAddresses []*ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` + + // READ-ONLY; Collection of references to IPs defined in network interfaces. + BackendIPConfigurations []*InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the backend address pool resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayBackendHTTPSettings - Backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettings struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the backend http settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway backend HTTP settings. + Properties *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayBackendHTTPSettingsPropertiesFormat - Properties of Backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { + // Cookie name to use for the affinity cookie. + AffinityCookieName *string `json:"affinityCookieName,omitempty"` + + // Array of references to application gateway authentication certificates. + AuthenticationCertificates []*SubResource `json:"authenticationCertificates,omitempty"` + + // Connection draining of the backend http settings resource. + ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` + + // Cookie based affinity. + CookieBasedAffinity *ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` + + // Host header to be sent to the backend servers. + HostName *string `json:"hostName,omitempty"` + + // Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. + Path *string `json:"path,omitempty"` + + // Whether to pick host header should be picked from the host name of the backend server. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + + // The destination port on the backend. + Port *int32 `json:"port,omitempty"` + + // Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + + // Whether the probe is enabled. Default value is false. + ProbeEnabled *bool `json:"probeEnabled,omitempty"` + + // The protocol used to communicate with the backend. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. + // Acceptable values are from 1 second to 86400 seconds. + RequestTimeout *int32 `json:"requestTimeout,omitempty"` + + // Array of references to application gateway trusted root certificates. + TrustedRootCertificates []*SubResource `json:"trustedRootCertificates,omitempty"` + + // READ-ONLY; The provisioning state of the backend HTTP settings resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayBackendHealth - Response for ApplicationGatewayBackendHealth API service call. +type ApplicationGatewayBackendHealth struct { + // A list of ApplicationGatewayBackendHealthPool resources. + BackendAddressPools []*ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` +} + +// ApplicationGatewayBackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. +type ApplicationGatewayBackendHealthHTTPSettings struct { + // Reference to an ApplicationGatewayBackendHttpSettings resource. + BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` + + // List of ApplicationGatewayBackendHealthServer resources. + Servers []*ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` +} + +// ApplicationGatewayBackendHealthOnDemand - Result of on demand test probe. +type ApplicationGatewayBackendHealthOnDemand struct { + // Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + + // Application gateway BackendHealthHttp settings. + BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings `json:"backendHealthHttpSettings,omitempty"` +} + +// ApplicationGatewayBackendHealthPool - Application gateway BackendHealth pool. +type ApplicationGatewayBackendHealthPool struct { + // Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + + // List of ApplicationGatewayBackendHealthHttpSettings resources. + BackendHTTPSettingsCollection []*ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` +} + +// ApplicationGatewayBackendHealthServer - Application gateway backendhealth http settings. +type ApplicationGatewayBackendHealthServer struct { + // IP address or FQDN of backend server. + Address *string `json:"address,omitempty"` + + // Health of backend server. + Health *ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` + + // Health Probe Log. + HealthProbeLog *string `json:"healthProbeLog,omitempty"` + + // Reference to IP configuration of backend server. + IPConfiguration *InterfaceIPConfiguration `json:"ipConfiguration,omitempty"` +} + +// ApplicationGatewayBackendSettings - Backend address pool settings of an application gateway. +type ApplicationGatewayBackendSettings struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the backend settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway backend settings. + Properties *ApplicationGatewayBackendSettingsPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayBackendSettingsPropertiesFormat - Properties of Backend address pool settings of an application gateway. +type ApplicationGatewayBackendSettingsPropertiesFormat struct { + // Server name indication to be sent to the backend servers for Tls protocol. + HostName *string `json:"hostName,omitempty"` + + // Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + + // The destination port on the backend. + Port *int32 `json:"port,omitempty"` + + // Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + + // The protocol used to communicate with the backend. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // Connection timeout in seconds. Application Gateway will fail the request if response is not received within ConnectionTimeout. + // Acceptable values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + + // Array of references to application gateway trusted root certificates. + TrustedRootCertificates []*SubResource `json:"trustedRootCertificates,omitempty"` + + // READ-ONLY; The provisioning state of the backend HTTP settings resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayClientAuthConfiguration - Application gateway client authentication configuration. +type ApplicationGatewayClientAuthConfiguration struct { + // Verify client certificate issuer name on the application gateway. + VerifyClientCertIssuerDN *bool `json:"verifyClientCertIssuerDN,omitempty"` + + // Verify client certificate revocation status. + VerifyClientRevocation *ApplicationGatewayClientRevocationOptions `json:"verifyClientRevocation,omitempty"` +} + +// ApplicationGatewayConnectionDraining - Connection draining allows open connections to a backend server to be active for +// a specified time after the backend server got removed from the configuration. +type ApplicationGatewayConnectionDraining struct { + // REQUIRED; The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds. + DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` + + // REQUIRED; Whether connection draining is enabled or not. + Enabled *bool `json:"enabled,omitempty"` +} + +// ApplicationGatewayCustomError - Customer error of an application gateway. +type ApplicationGatewayCustomError struct { + // Error page URL of the application gateway customer error. + CustomErrorPageURL *string `json:"customErrorPageUrl,omitempty"` + + // Status code of the application gateway customer error. + StatusCode *ApplicationGatewayCustomErrorStatusCode `json:"statusCode,omitempty"` +} + +// ApplicationGatewayFirewallDisabledRuleGroup - Allows to disable rules within a rule group or an entire rule group. +type ApplicationGatewayFirewallDisabledRuleGroup struct { + // REQUIRED; The name of the rule group that will be disabled. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + + // The list of rules that will be disabled. If null, all rules of the rule group will be disabled. + Rules []*int32 `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallExclusion - Allow to exclude some variable satisfy the condition for the WAF check. +type ApplicationGatewayFirewallExclusion struct { + // REQUIRED; The variable to be excluded. + MatchVariable *string `json:"matchVariable,omitempty"` + + // REQUIRED; When matchVariable is a collection, operator used to specify which elements in the collection this exclusion + // applies to. + Selector *string `json:"selector,omitempty"` + + // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this + // exclusion applies to. + SelectorMatchOperator *string `json:"selectorMatchOperator,omitempty"` +} + +// ApplicationGatewayFirewallManifestRuleSet - Properties of the web application firewall rule set. +type ApplicationGatewayFirewallManifestRuleSet struct { + // REQUIRED; The rule groups of the web application firewall rule set. + RuleGroups []*ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` + + // REQUIRED; The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // The rule set status + Status *ApplicationGatewayRuleSetStatusOptions `json:"status,omitempty"` + + // Tier of an application gateway that support the rule set. + Tiers []*ApplicationGatewayTierTypes `json:"tiers,omitempty"` +} + +// ApplicationGatewayFirewallRule - A web application firewall rule. +type ApplicationGatewayFirewallRule struct { + // REQUIRED; The identifier of the web application firewall rule. + RuleID *int32 `json:"ruleId,omitempty"` + + // The string representation of the web application firewall rule action. + Action *ApplicationGatewayWafRuleActionTypes `json:"action,omitempty"` + + // The description of the web application firewall rule. + Description *string `json:"description,omitempty"` + + // The string representation of the web application firewall rule identifier. + RuleIDString *string `json:"ruleIdString,omitempty"` + + // The string representation of the web application firewall rule state. + State *ApplicationGatewayWafRuleStateTypes `json:"state,omitempty"` +} + +// ApplicationGatewayFirewallRuleGroup - A web application firewall rule group. +type ApplicationGatewayFirewallRuleGroup struct { + // REQUIRED; The name of the web application firewall rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + + // REQUIRED; The rules of the web application firewall rule group. + Rules []*ApplicationGatewayFirewallRule `json:"rules,omitempty"` + + // The description of the web application firewall rule group. + Description *string `json:"description,omitempty"` +} + +// ApplicationGatewayFirewallRuleSet - A web application firewall rule set. +type ApplicationGatewayFirewallRuleSet struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the application gateway firewall rule set. + Properties *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayFirewallRuleSetPropertiesFormat - Properties of the web application firewall rule set. +type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { + // REQUIRED; The rule groups of the web application firewall rule set. + RuleGroups []*ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` + + // REQUIRED; The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // Tier of an application gateway that support the rule set. + Tiers []*ApplicationGatewayTierTypes `json:"tiers,omitempty"` + + // READ-ONLY; The provisioning state of the web application firewall rule set. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayFrontendIPConfiguration - Frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the frontend IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway frontend IP configuration. + Properties *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayFrontendIPConfigurationPropertiesFormat - Properties of Frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { + // PrivateIPAddress of the network interface IP Configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // Reference to the application gateway private link configuration. + PrivateLinkConfiguration *SubResource `json:"privateLinkConfiguration,omitempty"` + + // Reference to the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + + // Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the frontend IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayFrontendPort - Frontend port of an application gateway. +type ApplicationGatewayFrontendPort struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the frontend port that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway frontend port. + Properties *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayFrontendPortPropertiesFormat - Properties of Frontend port of an application gateway. +type ApplicationGatewayFrontendPortPropertiesFormat struct { + // Frontend port. + Port *int32 `json:"port,omitempty"` + + // READ-ONLY; The provisioning state of the frontend port resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayGlobalConfiguration - Application Gateway global configuration. +type ApplicationGatewayGlobalConfiguration struct { + // Enable request buffering. + EnableRequestBuffering *bool `json:"enableRequestBuffering,omitempty"` + + // Enable response buffering. + EnableResponseBuffering *bool `json:"enableResponseBuffering,omitempty"` +} + +// ApplicationGatewayHTTPListener - Http listener of an application gateway. +type ApplicationGatewayHTTPListener struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the HTTP listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway HTTP listener. + Properties *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayHTTPListenerPropertiesFormat - Properties of HTTP listener of an application gateway. +type ApplicationGatewayHTTPListenerPropertiesFormat struct { + // Custom error configurations of the HTTP listener. + CustomErrorConfigurations []*ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + + // Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + + // Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + + // Host name of HTTP listener. + HostName *string `json:"hostName,omitempty"` + + // List of Host names for HTTP Listener that allows special wildcard characters as well. + HostNames []*string `json:"hostNames,omitempty"` + + // Protocol of the HTTP listener. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // Applicable only if protocol is https. Enables SNI for multi-hosting. + RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` + + // SSL certificate resource of an application gateway. + SSLCertificate *SubResource `json:"sslCertificate,omitempty"` + + // SSL profile resource of the application gateway. + SSLProfile *SubResource `json:"sslProfile,omitempty"` + + // READ-ONLY; The provisioning state of the HTTP listener resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayHeaderConfiguration - Header configuration of the Actions set in Application Gateway. +type ApplicationGatewayHeaderConfiguration struct { + // Header name of the header configuration. + HeaderName *string `json:"headerName,omitempty"` + + // Header value of the header configuration. + HeaderValue *string `json:"headerValue,omitempty"` +} + +// ApplicationGatewayIPConfiguration - IP configuration of an application gateway. Currently 1 public and 1 private IP configuration +// is allowed. +type ApplicationGatewayIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway IP configuration. + Properties *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayIPConfigurationPropertiesFormat - Properties of IP configuration of an application gateway. +type ApplicationGatewayIPConfigurationPropertiesFormat struct { + // Reference to the subnet resource. A subnet from where application gateway gets its private address. + Subnet *SubResource `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the application gateway IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayListResult - Response for ListApplicationGateways API service call. +type ApplicationGatewayListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of an application gateways in a resource group. + Value []*ApplicationGateway `json:"value,omitempty"` +} + +// ApplicationGatewayListener - Listener of an application gateway. +type ApplicationGatewayListener struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway listener. + Properties *ApplicationGatewayListenerPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayListenerPropertiesFormat - Properties of listener of an application gateway. +type ApplicationGatewayListenerPropertiesFormat struct { + // Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + + // Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + + // Protocol of the listener. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // SSL certificate resource of an application gateway. + SSLCertificate *SubResource `json:"sslCertificate,omitempty"` + + // SSL profile resource of the application gateway. + SSLProfile *SubResource `json:"sslProfile,omitempty"` + + // READ-ONLY; The provisioning state of the listener resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayLoadDistributionPolicy - Load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway load distribution policy. + Properties *ApplicationGatewayLoadDistributionPolicyPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayLoadDistributionPolicyPropertiesFormat - Properties of Load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicyPropertiesFormat struct { + // Load Distribution Targets resource of an application gateway. + LoadDistributionAlgorithm *ApplicationGatewayLoadDistributionAlgorithm `json:"loadDistributionAlgorithm,omitempty"` + + // Load Distribution Targets resource of an application gateway. + LoadDistributionTargets []*ApplicationGatewayLoadDistributionTarget `json:"loadDistributionTargets,omitempty"` + + // READ-ONLY; The provisioning state of the Load Distribution Policy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayLoadDistributionTarget - Load Distribution Target of an application gateway. +type ApplicationGatewayLoadDistributionTarget struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway load distribution target. + Properties *ApplicationGatewayLoadDistributionTargetPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +type ApplicationGatewayLoadDistributionTargetPropertiesFormat struct { + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // Weight per server. Range between 1 and 100. + WeightPerServer *int32 `json:"weightPerServer,omitempty"` +} + +// ApplicationGatewayOnDemandProbe - Details of on demand test probe request. +type ApplicationGatewayOnDemandProbe struct { + // Reference to backend pool of application gateway to which probe request will be sent. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // Reference to backend http setting of application gateway to be used for test probe. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + + // Host name to send the probe to. + Host *string `json:"host,omitempty"` + + // Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + + // Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + + // Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + + // The protocol used for the probe. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable + // values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` +} + +// ApplicationGatewayPathRule - Path rule of URL path map of an application gateway. +type ApplicationGatewayPathRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the path rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway path rule. + Properties *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayPathRulePropertiesFormat - Properties of path rule of an application gateway. +type ApplicationGatewayPathRulePropertiesFormat struct { + // Backend address pool resource of URL path map path rule. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // Backend http settings resource of URL path map path rule. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + + // Load Distribution Policy resource of URL path map path rule. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + + // Path rules of URL path map. + Paths []*string `json:"paths,omitempty"` + + // Redirect configuration resource of URL path map path rule. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + + // Rewrite rule set resource of URL path map path rule. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + + // READ-ONLY; The provisioning state of the path rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateEndpointConnection - Private Endpoint connection on an application gateway. +type ApplicationGatewayPrivateEndpointConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the private endpoint connection on an application gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway private endpoint connection. + Properties *ApplicationGatewayPrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateEndpointConnectionListResult - Response for ListApplicationGatewayPrivateEndpointConnection API +// service call. Gets all private endpoint connections for an application gateway. +type ApplicationGatewayPrivateEndpointConnectionListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of private endpoint connections on an application gateway. + Value []*ApplicationGatewayPrivateEndpointConnection `json:"value,omitempty"` +} + +// ApplicationGatewayPrivateEndpointConnectionProperties - Properties of Private Link Resource of an application gateway. +type ApplicationGatewayPrivateEndpointConnectionProperties struct { + // A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty" azure:"ro"` + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the application gateway private endpoint connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.BeginDelete +// method. +type ApplicationGatewayPrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.BeginUpdate +// method. +type ApplicationGatewayPrivateEndpointConnectionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewayPrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.Get +// method. +type ApplicationGatewayPrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayPrivateEndpointConnectionsClientListOptions contains the optional parameters for the ApplicationGatewayPrivateEndpointConnectionsClient.List +// method. +type ApplicationGatewayPrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayPrivateLinkConfiguration - Private Link Configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the private link configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway private link configuration. + Properties *ApplicationGatewayPrivateLinkConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkConfigurationProperties - Properties of private link configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfigurationProperties struct { + // An array of application gateway private link ip configurations. + IPConfigurations []*ApplicationGatewayPrivateLinkIPConfiguration `json:"ipConfigurations,omitempty"` + + // READ-ONLY; The provisioning state of the application gateway private link configuration. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkIPConfiguration - The application gateway private link ip configuration. +type ApplicationGatewayPrivateLinkIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of application gateway private link ip configuration. + Name *string `json:"name,omitempty"` + + // Properties of an application gateway private link ip configuration. + Properties *ApplicationGatewayPrivateLinkIPConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkIPConfigurationProperties - Properties of an application gateway private link IP configuration. +type ApplicationGatewayPrivateLinkIPConfigurationProperties struct { + // Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + + // The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the application gateway private link IP configuration. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkResource - PrivateLink Resource of an application gateway. +type ApplicationGatewayPrivateLinkResource struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the private link resource that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway private link resource. + Properties *ApplicationGatewayPrivateLinkResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkResourceListResult - Response for ListApplicationGatewayPrivateLinkResources API service call. +// Gets all private link resources for an application gateway. +type ApplicationGatewayPrivateLinkResourceListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of private link resources of an application gateway. + Value []*ApplicationGatewayPrivateLinkResource `json:"value,omitempty"` +} + +// ApplicationGatewayPrivateLinkResourceProperties - Properties of a private link resource. +type ApplicationGatewayPrivateLinkResourceProperties struct { + // Required DNS zone names of the the private link resource. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + + // READ-ONLY; Group identifier of private link resource. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; Required member names of private link resource. + RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` +} + +// ApplicationGatewayPrivateLinkResourcesClientListOptions contains the optional parameters for the ApplicationGatewayPrivateLinkResourcesClient.List +// method. +type ApplicationGatewayPrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayProbe - Probe of the application gateway. +type ApplicationGatewayProbe struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the probe that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway probe. + Properties *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayProbeHealthResponseMatch - Application gateway probe health response match. +type ApplicationGatewayProbeHealthResponseMatch struct { + // Body that must be contained in the health response. Default value is empty. + Body *string `json:"body,omitempty"` + + // Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. + StatusCodes []*string `json:"statusCodes,omitempty"` +} + +// ApplicationGatewayProbePropertiesFormat - Properties of probe of an application gateway. +type ApplicationGatewayProbePropertiesFormat struct { + // Host name to send the probe to. + Host *string `json:"host,omitempty"` + + // The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 + // second to 86400 seconds. + Interval *int32 `json:"interval,omitempty"` + + // Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + + // Minimum number of servers that are always marked healthy. Default value is 0. + MinServers *int32 `json:"minServers,omitempty"` + + // Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + + // Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + + // Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false. + PickHostNameFromBackendSettings *bool `json:"pickHostNameFromBackendSettings,omitempty"` + + // Custom port which will be used for probing the backend servers. The valid value ranges from 1 to 65535. In case not set, + // port from http settings will be used. This property is valid for Standardv2 and + // WAFv2 only. + Port *int32 `json:"port,omitempty"` + + // The protocol used for the probe. + Protocol *ApplicationGatewayProtocol `json:"protocol,omitempty"` + + // The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable + // values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + + // The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. + // Acceptable values are from 1 second to 20. + UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` + + // READ-ONLY; The provisioning state of the probe resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayPropertiesFormat - Properties of the application gateway. +type ApplicationGatewayPropertiesFormat struct { + // Authentication certificates of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + AuthenticationCertificates []*ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` + + // Autoscale Configuration. + AutoscaleConfiguration *ApplicationGatewayAutoscaleConfiguration `json:"autoscaleConfiguration,omitempty"` + + // Backend address pool of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + BackendAddressPools []*ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` + + // Backend http settings of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + BackendHTTPSettingsCollection []*ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` + + // Backend settings of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits] + // . + BackendSettingsCollection []*ApplicationGatewayBackendSettings `json:"backendSettingsCollection,omitempty"` + + // Custom error configurations of the application gateway resource. + CustomErrorConfigurations []*ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + + // Whether FIPS is enabled on the application gateway resource. + EnableFips *bool `json:"enableFips,omitempty"` + + // Whether HTTP2 is enabled on the application gateway resource. + EnableHTTP2 *bool `json:"enableHttp2,omitempty"` + + // Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + + // If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. + ForceFirewallPolicyAssociation *bool `json:"forceFirewallPolicyAssociation,omitempty"` + + // Frontend IP addresses of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + FrontendIPConfigurations []*ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + + // Frontend ports of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + FrontendPorts []*ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` + + // Subnets of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + GatewayIPConfigurations []*ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` + + // Global Configuration. + GlobalConfiguration *ApplicationGatewayGlobalConfiguration `json:"globalConfiguration,omitempty"` + + // Http listeners of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + HTTPListeners []*ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` + + // Listeners of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + Listeners []*ApplicationGatewayListener `json:"listeners,omitempty"` + + // Load distribution policies of the application gateway resource. + LoadDistributionPolicies []*ApplicationGatewayLoadDistributionPolicy `json:"loadDistributionPolicies,omitempty"` + + // PrivateLink configurations on application gateway. + PrivateLinkConfigurations []*ApplicationGatewayPrivateLinkConfiguration `json:"privateLinkConfigurations,omitempty"` + + // Probes of the application gateway resource. + Probes []*ApplicationGatewayProbe `json:"probes,omitempty"` + + // Redirect configurations of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + RedirectConfigurations []*ApplicationGatewayRedirectConfiguration `json:"redirectConfigurations,omitempty"` + + // Request routing rules of the application gateway resource. + RequestRoutingRules []*ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` + + // Rewrite rules for the application gateway resource. + RewriteRuleSets []*ApplicationGatewayRewriteRuleSet `json:"rewriteRuleSets,omitempty"` + + // Routing rules of the application gateway resource. + RoutingRules []*ApplicationGatewayRoutingRule `json:"routingRules,omitempty"` + + // SKU of the application gateway resource. + SKU *ApplicationGatewaySKU `json:"sku,omitempty"` + + // SSL certificates of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits] + // . + SSLCertificates []*ApplicationGatewaySSLCertificate `json:"sslCertificates,omitempty"` + + // SSL policy of the application gateway resource. + SSLPolicy *ApplicationGatewaySSLPolicy `json:"sslPolicy,omitempty"` + + // SSL profiles of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + SSLProfiles []*ApplicationGatewaySSLProfile `json:"sslProfiles,omitempty"` + + // Trusted client certificates of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + TrustedClientCertificates []*ApplicationGatewayTrustedClientCertificate `json:"trustedClientCertificates,omitempty"` + + // Trusted Root certificates of the application gateway resource. For default limits, see Application Gateway limits + // [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + TrustedRootCertificates []*ApplicationGatewayTrustedRootCertificate `json:"trustedRootCertificates,omitempty"` + + // URL path map of the application gateway resource. For default limits, see Application Gateway limits [https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits]. + URLPathMaps []*ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` + + // Web application firewall configuration. + WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` + + // READ-ONLY; Operational state of the application gateway resource. + OperationalState *ApplicationGatewayOperationalState `json:"operationalState,omitempty" azure:"ro"` + + // READ-ONLY; Private Endpoint connections on application gateway. + PrivateEndpointConnections []*ApplicationGatewayPrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the application gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the application gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// ApplicationGatewayRedirectConfiguration - Redirect configuration of an application gateway. +type ApplicationGatewayRedirectConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the redirect configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway redirect configuration. + Properties *ApplicationGatewayRedirectConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayRedirectConfigurationPropertiesFormat - Properties of redirect configuration of the application gateway. +type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { + // Include path in the redirected url. + IncludePath *bool `json:"includePath,omitempty"` + + // Include query string in the redirected url. + IncludeQueryString *bool `json:"includeQueryString,omitempty"` + + // Path rules specifying redirect configuration. + PathRules []*SubResource `json:"pathRules,omitempty"` + + // HTTP redirection type. + RedirectType *ApplicationGatewayRedirectType `json:"redirectType,omitempty"` + + // Request routing specifying redirect configuration. + RequestRoutingRules []*SubResource `json:"requestRoutingRules,omitempty"` + + // Reference to a listener to redirect the request to. + TargetListener *SubResource `json:"targetListener,omitempty"` + + // Url to redirect the request to. + TargetURL *string `json:"targetUrl,omitempty"` + + // Url path maps specifying default redirect configuration. + URLPathMaps []*SubResource `json:"urlPathMaps,omitempty"` +} + +// ApplicationGatewayRequestRoutingRule - Request routing rule of an application gateway. +type ApplicationGatewayRequestRoutingRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the request routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway request routing rule. + Properties *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayRequestRoutingRulePropertiesFormat - Properties of request routing rule of the application gateway. +type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // Backend http settings resource of the application gateway. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + + // Http listener resource of the application gateway. + HTTPListener *SubResource `json:"httpListener,omitempty"` + + // Load Distribution Policy resource of the application gateway. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + + // Priority of the request routing rule. + Priority *int32 `json:"priority,omitempty"` + + // Redirect configuration resource of the application gateway. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + + // Rewrite Rule Set resource in Basic rule of the application gateway. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + + // Rule type. + RuleType *ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + + // URL path map resource of the application gateway. + URLPathMap *SubResource `json:"urlPathMap,omitempty"` + + // READ-ONLY; The provisioning state of the request routing rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayRewriteRule - Rewrite rule of an application gateway. +type ApplicationGatewayRewriteRule struct { + // Set of actions to be done as part of the rewrite Rule. + ActionSet *ApplicationGatewayRewriteRuleActionSet `json:"actionSet,omitempty"` + + // Conditions based on which the action set execution will be evaluated. + Conditions []*ApplicationGatewayRewriteRuleCondition `json:"conditions,omitempty"` + + // Name of the rewrite rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. + RuleSequence *int32 `json:"ruleSequence,omitempty"` +} + +// ApplicationGatewayRewriteRuleActionSet - Set of actions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleActionSet struct { + // Request Header Actions in the Action Set. + RequestHeaderConfigurations []*ApplicationGatewayHeaderConfiguration `json:"requestHeaderConfigurations,omitempty"` + + // Response Header Actions in the Action Set. + ResponseHeaderConfigurations []*ApplicationGatewayHeaderConfiguration `json:"responseHeaderConfigurations,omitempty"` + + // Url Configuration Action in the Action Set. + URLConfiguration *ApplicationGatewayURLConfiguration `json:"urlConfiguration,omitempty"` +} + +// ApplicationGatewayRewriteRuleCondition - Set of conditions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleCondition struct { + // Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison. + IgnoreCase *bool `json:"ignoreCase,omitempty"` + + // Setting this value as truth will force to check the negation of the condition given by the user. + Negate *bool `json:"negate,omitempty"` + + // The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. + Pattern *string `json:"pattern,omitempty"` + + // The condition parameter of the RewriteRuleCondition. + Variable *string `json:"variable,omitempty"` +} + +// ApplicationGatewayRewriteRuleSet - Rewrite rule set of an application gateway. +type ApplicationGatewayRewriteRuleSet struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the rewrite rule set that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway rewrite rule set. + Properties *ApplicationGatewayRewriteRuleSetPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// ApplicationGatewayRewriteRuleSetPropertiesFormat - Properties of rewrite rule set of the application gateway. +type ApplicationGatewayRewriteRuleSetPropertiesFormat struct { + // Rewrite rules in the rewrite rule set. + RewriteRules []*ApplicationGatewayRewriteRule `json:"rewriteRules,omitempty"` + + // READ-ONLY; The provisioning state of the rewrite rule set resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayRoutingRule - Routing rule of an application gateway. +type ApplicationGatewayRoutingRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway routing rule. + Properties *ApplicationGatewayRoutingRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayRoutingRulePropertiesFormat - Properties of routing rule of the application gateway. +type ApplicationGatewayRoutingRulePropertiesFormat struct { + // REQUIRED; Priority of the routing rule. + Priority *int32 `json:"priority,omitempty"` + + // Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // Backend settings resource of the application gateway. + BackendSettings *SubResource `json:"backendSettings,omitempty"` + + // Listener resource of the application gateway. + Listener *SubResource `json:"listener,omitempty"` + + // Rule type. + RuleType *ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + + // READ-ONLY; The provisioning state of the request routing rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewaySKU - SKU of an application gateway. +type ApplicationGatewaySKU struct { + // Capacity (instance count) of an application gateway. + Capacity *int32 `json:"capacity,omitempty"` + + // Name of an application gateway SKU. + Name *ApplicationGatewaySKUName `json:"name,omitempty"` + + // Tier of an application gateway. + Tier *ApplicationGatewayTier `json:"tier,omitempty"` +} + +// ApplicationGatewaySSLCertificate - SSL certificates of an application gateway. +type ApplicationGatewaySSLCertificate struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the SSL certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway SSL certificate. + Properties *ApplicationGatewaySSLCertificatePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewaySSLCertificatePropertiesFormat - Properties of SSL certificates of an application gateway. +type ApplicationGatewaySSLCertificatePropertiesFormat struct { + // Base-64 encoded pfx certificate. Only applicable in PUT Request. + Data *string `json:"data,omitempty"` + + // Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + + // Password for the pfx file specified in data. Only applicable in PUT request. + Password *string `json:"password,omitempty"` + + // READ-ONLY; The provisioning state of the SSL certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. + PublicCertData *string `json:"publicCertData,omitempty" azure:"ro"` +} + +// ApplicationGatewaySSLPolicy - Application Gateway Ssl policy. +type ApplicationGatewaySSLPolicy struct { + // Ssl cipher suites to be enabled in the specified order to application gateway. + CipherSuites []*ApplicationGatewaySSLCipherSuite `json:"cipherSuites,omitempty"` + + // Ssl protocols to be disabled on application gateway. + DisabledSSLProtocols []*ApplicationGatewaySSLProtocol `json:"disabledSslProtocols,omitempty"` + + // Minimum version of Ssl protocol to be supported on application gateway. + MinProtocolVersion *ApplicationGatewaySSLProtocol `json:"minProtocolVersion,omitempty"` + + // Name of Ssl predefined policy. + PolicyName *ApplicationGatewaySSLPolicyName `json:"policyName,omitempty"` + + // Type of Ssl Policy. + PolicyType *ApplicationGatewaySSLPolicyType `json:"policyType,omitempty"` +} + +// ApplicationGatewaySSLPredefinedPolicy - An Ssl predefined policy. +type ApplicationGatewaySSLPredefinedPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the Ssl predefined policy. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway SSL predefined policy. + Properties *ApplicationGatewaySSLPredefinedPolicyPropertiesFormat `json:"properties,omitempty"` +} + +// ApplicationGatewaySSLPredefinedPolicyPropertiesFormat - Properties of ApplicationGatewaySslPredefinedPolicy. +type ApplicationGatewaySSLPredefinedPolicyPropertiesFormat struct { + // Ssl cipher suites to be enabled in the specified order for application gateway. + CipherSuites []*ApplicationGatewaySSLCipherSuite `json:"cipherSuites,omitempty"` + + // Minimum version of Ssl protocol to be supported on application gateway. + MinProtocolVersion *ApplicationGatewaySSLProtocol `json:"minProtocolVersion,omitempty"` +} + +// ApplicationGatewaySSLProfile - SSL profile of an application gateway. +type ApplicationGatewaySSLProfile struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the SSL profile that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway SSL profile. + Properties *ApplicationGatewaySSLProfilePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewaySSLProfilePropertiesFormat - Properties of SSL profile of an application gateway. +type ApplicationGatewaySSLProfilePropertiesFormat struct { + // Client authentication configuration of the application gateway resource. + ClientAuthConfiguration *ApplicationGatewayClientAuthConfiguration `json:"clientAuthConfiguration,omitempty"` + + // SSL policy of the application gateway resource. + SSLPolicy *ApplicationGatewaySSLPolicy `json:"sslPolicy,omitempty"` + + // Array of references to application gateway trusted client certificates. + TrustedClientCertificates []*SubResource `json:"trustedClientCertificates,omitempty"` + + // READ-ONLY; The provisioning state of the HTTP listener resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayTrustedClientCertificate - Trusted client certificates of an application gateway. +type ApplicationGatewayTrustedClientCertificate struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the trusted client certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway trusted client certificate. + Properties *ApplicationGatewayTrustedClientCertificatePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayTrustedClientCertificatePropertiesFormat - Trusted client certificates properties of an application gateway. +type ApplicationGatewayTrustedClientCertificatePropertiesFormat struct { + // Certificate public data. + Data *string `json:"data,omitempty"` + + // READ-ONLY; Distinguished name of client certificate issuer. + ClientCertIssuerDN *string `json:"clientCertIssuerDN,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the trusted client certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Validated certificate data. + ValidatedCertData *string `json:"validatedCertData,omitempty" azure:"ro"` +} + +// ApplicationGatewayTrustedRootCertificate - Trusted Root certificates of an application gateway. +type ApplicationGatewayTrustedRootCertificate struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the trusted root certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway trusted root certificate. + Properties *ApplicationGatewayTrustedRootCertificatePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayTrustedRootCertificatePropertiesFormat - Trusted Root certificates properties of an application gateway. +type ApplicationGatewayTrustedRootCertificatePropertiesFormat struct { + // Certificate public data. + Data *string `json:"data,omitempty"` + + // Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + + // READ-ONLY; The provisioning state of the trusted root certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayURLConfiguration - Url configuration of the Actions set in Application Gateway. +type ApplicationGatewayURLConfiguration struct { + // Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null. + ModifiedPath *string `json:"modifiedPath,omitempty"` + + // Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. + ModifiedQueryString *string `json:"modifiedQueryString,omitempty"` + + // If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path. + // Default value is false. + Reroute *bool `json:"reroute,omitempty"` +} + +// ApplicationGatewayURLPathMap - UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. +type ApplicationGatewayURLPathMap struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the URL path map that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + + // Properties of the application gateway URL path map. + Properties *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayURLPathMapPropertiesFormat - Properties of UrlPathMap of the application gateway. +type ApplicationGatewayURLPathMapPropertiesFormat struct { + // Default backend address pool resource of URL path map. + DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` + + // Default backend http settings resource of URL path map. + DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` + + // Default Load Distribution Policy resource of URL path map. + DefaultLoadDistributionPolicy *SubResource `json:"defaultLoadDistributionPolicy,omitempty"` + + // Default redirect configuration resource of URL path map. + DefaultRedirectConfiguration *SubResource `json:"defaultRedirectConfiguration,omitempty"` + + // Default Rewrite rule set resource of URL path map. + DefaultRewriteRuleSet *SubResource `json:"defaultRewriteRuleSet,omitempty"` + + // Path rule of URL path map resource. + PathRules []*ApplicationGatewayPathRule `json:"pathRules,omitempty"` + + // READ-ONLY; The provisioning state of the URL path map resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ApplicationGatewayWafDynamicManifestPropertiesResult - Properties of ApplicationGatewayWafDynamicManifest. +type ApplicationGatewayWafDynamicManifestPropertiesResult struct { + // The available rulesets. + AvailableRuleSets []*ApplicationGatewayFirewallManifestRuleSet `json:"availableRuleSets,omitempty"` + + // The default ruleset. + DefaultRuleSet *DefaultRuleSetPropertyFormat `json:"defaultRuleSet,omitempty"` +} + +// ApplicationGatewayWafDynamicManifestResult - Response for ApplicationGatewayWafDynamicManifest API service call. +type ApplicationGatewayWafDynamicManifestResult struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the ApplicationGatewayWafDynamicManifest . + Properties *ApplicationGatewayWafDynamicManifestPropertiesResult `json:"properties,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationGatewayWafDynamicManifestResultList - Response for ApplicationGatewayWafDynamicManifests API service call. +type ApplicationGatewayWafDynamicManifestResultList struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of application gateway waf manifest. + Value []*ApplicationGatewayWafDynamicManifestResult `json:"value,omitempty"` +} + +// ApplicationGatewayWafDynamicManifestsClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsClient.Get +// method. +type ApplicationGatewayWafDynamicManifestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions contains the optional parameters for the ApplicationGatewayWafDynamicManifestsDefaultClient.Get +// method. +type ApplicationGatewayWafDynamicManifestsDefaultClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewayWebApplicationFirewallConfiguration - Application gateway web application firewall configuration. +type ApplicationGatewayWebApplicationFirewallConfiguration struct { + // REQUIRED; Whether the web application firewall is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + + // REQUIRED; Web application firewall mode. + FirewallMode *ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` + + // REQUIRED; The type of the web application firewall rule set. Possible values are: 'OWASP'. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; The version of the rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // The disabled rule groups. + DisabledRuleGroups []*ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` + + // The exclusion list. + Exclusions []*ApplicationGatewayFirewallExclusion `json:"exclusions,omitempty"` + + // Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` + + // Maximum request body size for WAF. + MaxRequestBodySize *int32 `json:"maxRequestBodySize,omitempty"` + + // Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + + // Whether allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` +} + +// ApplicationGatewaysClientBeginBackendHealthOnDemandOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealthOnDemand +// method. +type ApplicationGatewaysClientBeginBackendHealthOnDemandOptions struct { + // Expands BackendAddressPool and BackendHttpSettings referenced in backend health. + Expand *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientBeginBackendHealthOptions contains the optional parameters for the ApplicationGatewaysClient.BeginBackendHealth +// method. +type ApplicationGatewaysClientBeginBackendHealthOptions struct { + // Expands BackendAddressPool and BackendHttpSettings referenced in backend health. + Expand *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationGatewaysClient.BeginCreateOrUpdate +// method. +type ApplicationGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientBeginDeleteOptions contains the optional parameters for the ApplicationGatewaysClient.BeginDelete +// method. +type ApplicationGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientBeginStartOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStart +// method. +type ApplicationGatewaysClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientBeginStopOptions contains the optional parameters for the ApplicationGatewaysClient.BeginStop +// method. +type ApplicationGatewaysClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationGatewaysClientGetOptions contains the optional parameters for the ApplicationGatewaysClient.Get method. +type ApplicationGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientGetSSLPredefinedPolicyOptions contains the optional parameters for the ApplicationGatewaysClient.GetSSLPredefinedPolicy +// method. +type ApplicationGatewaysClientGetSSLPredefinedPolicyOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAllOptions contains the optional parameters for the ApplicationGatewaysClient.ListAll method. +type ApplicationGatewaysClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableRequestHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableRequestHeaders +// method. +type ApplicationGatewaysClientListAvailableRequestHeadersOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableResponseHeadersOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableResponseHeaders +// method. +type ApplicationGatewaysClientListAvailableResponseHeadersOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableSSLOptionsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLOptions +// method. +type ApplicationGatewaysClientListAvailableSSLOptionsOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableSSLPredefinedPolicies +// method. +type ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableServerVariablesOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableServerVariables +// method. +type ApplicationGatewaysClientListAvailableServerVariablesOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListAvailableWafRuleSetsOptions contains the optional parameters for the ApplicationGatewaysClient.ListAvailableWafRuleSets +// method. +type ApplicationGatewaysClientListAvailableWafRuleSetsOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientListOptions contains the optional parameters for the ApplicationGatewaysClient.List method. +type ApplicationGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationGatewaysClientUpdateTagsOptions contains the optional parameters for the ApplicationGatewaysClient.UpdateTags +// method. +type ApplicationGatewaysClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ApplicationRule - Rule of type application. +type ApplicationRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType `json:"ruleType,omitempty"` + + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of FQDN Tags for this rule. + FqdnTags []*string `json:"fqdnTags,omitempty"` + + // Name of the rule. + Name *string `json:"name,omitempty"` + + // Array of Application Protocols. + Protocols []*FirewallPolicyRuleApplicationProtocol `json:"protocols,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` + + // List of FQDNs for this rule. + TargetFqdns []*string `json:"targetFqdns,omitempty"` + + // List of Urls for this rule condition. + TargetUrls []*string `json:"targetUrls,omitempty"` + + // Terminate TLS connections for this rule. + TerminateTLS *bool `json:"terminateTLS,omitempty"` + + // List of destination azure web categories. + WebCategories []*string `json:"webCategories,omitempty"` +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type ApplicationRule. +func (a *ApplicationRule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Name: a.Name, + Description: a.Description, + RuleType: a.RuleType, + } +} + +// ApplicationSecurityGroup - An application security group in a resource group. +type ApplicationSecurityGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the application security group. + Properties *ApplicationSecurityGroupPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationSecurityGroupListResult - A list of application security groups. +type ApplicationSecurityGroupListResult struct { + // A list of application security groups. + Value []*ApplicationSecurityGroup `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ApplicationSecurityGroupPropertiesFormat - Application security group properties. +type ApplicationSecurityGroupPropertiesFormat struct { + // READ-ONLY; The provisioning state of the application security group resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the application security group resource. It uniquely identifies a resource, even + // if the user changes its name or migrate the resource across subscriptions or resource + // groups. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ApplicationSecurityGroupsClient.BeginCreateOrUpdate +// method. +type ApplicationSecurityGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationSecurityGroupsClientBeginDeleteOptions contains the optional parameters for the ApplicationSecurityGroupsClient.BeginDelete +// method. +type ApplicationSecurityGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ApplicationSecurityGroupsClientGetOptions contains the optional parameters for the ApplicationSecurityGroupsClient.Get +// method. +type ApplicationSecurityGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationSecurityGroupsClientListAllOptions contains the optional parameters for the ApplicationSecurityGroupsClient.ListAll +// method. +type ApplicationSecurityGroupsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ApplicationSecurityGroupsClientListOptions contains the optional parameters for the ApplicationSecurityGroupsClient.List +// method. +type ApplicationSecurityGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationSecurityGroupsClientUpdateTagsOptions contains the optional parameters for the ApplicationSecurityGroupsClient.UpdateTags +// method. +type ApplicationSecurityGroupsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// AuthorizationListResult - Response for ListAuthorizations API service call retrieves all authorizations that belongs to +// an ExpressRouteCircuit. +type AuthorizationListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The authorizations in an ExpressRoute Circuit. + Value []*ExpressRouteCircuitAuthorization `json:"value,omitempty"` +} + +// AuthorizationPropertiesFormat - Properties of ExpressRouteCircuitAuthorization. +type AuthorizationPropertiesFormat struct { + // The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // The authorization use status. + AuthorizationUseStatus *AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + + // READ-ONLY; The provisioning state of the authorization resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AutoApprovedPrivateLinkService - The information of an AutoApprovedPrivateLinkService. +type AutoApprovedPrivateLinkService struct { + // The id of the private link service resource. + PrivateLinkService *string `json:"privateLinkService,omitempty"` +} + +// AutoApprovedPrivateLinkServicesResult - An array of private link service id that can be linked to a private end point with +// auto approved. +type AutoApprovedPrivateLinkServicesResult struct { + // An array of auto approved private link service. + Value []*AutoApprovedPrivateLinkService `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// Availability of the metric. +type Availability struct { + // Duration of the availability blob. + BlobDuration *string `json:"blobDuration,omitempty"` + + // The retention of the availability. + Retention *string `json:"retention,omitempty"` + + // The time grain of the availability. + TimeGrain *string `json:"timeGrain,omitempty"` +} + +// AvailableDelegation - The serviceName of an AvailableDelegation indicates a possible delegation for a subnet. +type AvailableDelegation struct { + // The actions permitted to the service upon delegation. + Actions []*string `json:"actions,omitempty"` + + // A unique identifier of the AvailableDelegation resource. + ID *string `json:"id,omitempty"` + + // The name of the AvailableDelegation resource. + Name *string `json:"name,omitempty"` + + // The name of the service and resource. + ServiceName *string `json:"serviceName,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` +} + +// AvailableDelegationsClientListOptions contains the optional parameters for the AvailableDelegationsClient.List method. +type AvailableDelegationsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableDelegationsResult - An array of available delegations. +type AvailableDelegationsResult struct { + // An array of available delegations. + Value []*AvailableDelegation `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// AvailableEndpointServicesClientListOptions contains the optional parameters for the AvailableEndpointServicesClient.List +// method. +type AvailableEndpointServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailablePrivateEndpointType - The information of an AvailablePrivateEndpointType. +type AvailablePrivateEndpointType struct { + // Display name of the resource. + DisplayName *string `json:"displayName,omitempty"` + + // A unique identifier of the AvailablePrivateEndpoint Type resource. + ID *string `json:"id,omitempty"` + + // The name of the service and resource. + Name *string `json:"name,omitempty"` + + // The name of the service and resource. + ResourceName *string `json:"resourceName,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` +} + +// AvailablePrivateEndpointTypesClientListByResourceGroupOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.ListByResourceGroup +// method. +type AvailablePrivateEndpointTypesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AvailablePrivateEndpointTypesClientListOptions contains the optional parameters for the AvailablePrivateEndpointTypesClient.List +// method. +type AvailablePrivateEndpointTypesClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailablePrivateEndpointTypesResult - An array of available PrivateEndpoint types. +type AvailablePrivateEndpointTypesResult struct { + // An array of available privateEndpoint type. + Value []*AvailablePrivateEndpointType `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// AvailableProvidersList - List of available countries with details. +type AvailableProvidersList struct { + // REQUIRED; List of available countries. + Countries []*AvailableProvidersListCountry `json:"countries,omitempty"` +} + +// AvailableProvidersListCity - City or town details. +type AvailableProvidersListCity struct { + // The city or town name. + CityName *string `json:"cityName,omitempty"` + + // A list of Internet service providers. + Providers []*string `json:"providers,omitempty"` +} + +// AvailableProvidersListCountry - Country details. +type AvailableProvidersListCountry struct { + // The country name. + CountryName *string `json:"countryName,omitempty"` + + // A list of Internet service providers. + Providers []*string `json:"providers,omitempty"` + + // List of available states in the country. + States []*AvailableProvidersListState `json:"states,omitempty"` +} + +// AvailableProvidersListParameters - Constraints that determine the list of available Internet service providers. +type AvailableProvidersListParameters struct { + // A list of Azure regions. + AzureLocations []*string `json:"azureLocations,omitempty"` + + // The city or town for available providers list. + City *string `json:"city,omitempty"` + + // The country for available providers list. + Country *string `json:"country,omitempty"` + + // The state for available providers list. + State *string `json:"state,omitempty"` +} + +// AvailableProvidersListState - State details. +type AvailableProvidersListState struct { + // List of available cities or towns in the state. + Cities []*AvailableProvidersListCity `json:"cities,omitempty"` + + // A list of Internet service providers. + Providers []*string `json:"providers,omitempty"` + + // The state name. + StateName *string `json:"stateName,omitempty"` +} + +// AvailableResourceGroupDelegationsClientListOptions contains the optional parameters for the AvailableResourceGroupDelegationsClient.List +// method. +type AvailableResourceGroupDelegationsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableServiceAlias - The available service alias. +type AvailableServiceAlias struct { + // The ID of the service alias. + ID *string `json:"id,omitempty"` + + // The name of the service alias. + Name *string `json:"name,omitempty"` + + // The resource name of the service alias. + ResourceName *string `json:"resourceName,omitempty"` + + // The type of the resource. + Type *string `json:"type,omitempty"` +} + +// AvailableServiceAliasesClientListByResourceGroupOptions contains the optional parameters for the AvailableServiceAliasesClient.ListByResourceGroup +// method. +type AvailableServiceAliasesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AvailableServiceAliasesClientListOptions contains the optional parameters for the AvailableServiceAliasesClient.List method. +type AvailableServiceAliasesClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableServiceAliasesResult - An array of available service aliases. +type AvailableServiceAliasesResult struct { + // An array of available service aliases. + Value []*AvailableServiceAlias `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// AzureAsyncOperationResult - The response body contains the status of the specified asynchronous operation, indicating whether +// it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP +// status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response +// body includes the HTTP status code for the successful request. If the +// asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information +// regarding the failure. +type AzureAsyncOperationResult struct { + // Details of the error occurred during specified asynchronous operation. + Error *Error `json:"error,omitempty"` + + // Status of the Azure async operation. + Status *NetworkOperationStatus `json:"status,omitempty"` +} + +// AzureFirewall - Azure Firewall resource. +type AzureFirewall struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the azure firewall. + Properties *AzureFirewallPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting where the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AzureFirewallApplicationRule - Properties of an application rule. +type AzureFirewallApplicationRule struct { + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of FQDN Tags for this rule. + FqdnTags []*string `json:"fqdnTags,omitempty"` + + // Name of the application rule. + Name *string `json:"name,omitempty"` + + // Array of ApplicationRuleProtocols. + Protocols []*AzureFirewallApplicationRuleProtocol `json:"protocols,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` + + // List of FQDNs for this rule. + TargetFqdns []*string `json:"targetFqdns,omitempty"` +} + +// AzureFirewallApplicationRuleCollection - Application rule collection resource. +type AzureFirewallApplicationRuleCollection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the azure firewall application rule collection. + Properties *AzureFirewallApplicationRuleCollectionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// AzureFirewallApplicationRuleCollectionPropertiesFormat - Properties of the application rule collection. +type AzureFirewallApplicationRuleCollectionPropertiesFormat struct { + // The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + + // Priority of the application rule collection resource. + Priority *int32 `json:"priority,omitempty"` + + // Collection of rules used by a application rule collection. + Rules []*AzureFirewallApplicationRule `json:"rules,omitempty"` + + // READ-ONLY; The provisioning state of the application rule collection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallApplicationRuleProtocol - Properties of the application rule protocol. +type AzureFirewallApplicationRuleProtocol struct { + // Port number for the protocol, cannot be greater than 64000. This field is optional. + Port *int32 `json:"port,omitempty"` + + // Protocol type. + ProtocolType *AzureFirewallApplicationRuleProtocolType `json:"protocolType,omitempty"` +} + +// AzureFirewallFqdnTag - Azure Firewall FQDN Tag Resource. +type AzureFirewallFqdnTag struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the azure firewall FQDN tag. + Properties *AzureFirewallFqdnTagPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AzureFirewallFqdnTagListResult - Response for ListAzureFirewallFqdnTags API service call. +type AzureFirewallFqdnTagListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Azure Firewall FQDN Tags in a resource group. + Value []*AzureFirewallFqdnTag `json:"value,omitempty"` +} + +// AzureFirewallFqdnTagPropertiesFormat - Azure Firewall FQDN Tag Properties. +type AzureFirewallFqdnTagPropertiesFormat struct { + // READ-ONLY; The name of this FQDN Tag. + FqdnTagName *string `json:"fqdnTagName,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Azure firewall FQDN tag resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallFqdnTagsClientListAllOptions contains the optional parameters for the AzureFirewallFqdnTagsClient.ListAll +// method. +type AzureFirewallFqdnTagsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// AzureFirewallIPConfiguration - IP configuration of an Azure Firewall. +type AzureFirewallIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the azure firewall IP configuration. + Properties *AzureFirewallIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AzureFirewallIPConfigurationPropertiesFormat - Properties of IP configuration of an Azure Firewall. +type AzureFirewallIPConfigurationPropertiesFormat struct { + // Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + + // Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + Subnet *SubResource `json:"subnet,omitempty"` + + // READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. + PrivateIPAddress *string `json:"privateIPAddress,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Azure firewall IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallIPGroups - IpGroups associated with azure firewall. +type AzureFirewallIPGroups struct { + // READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// AzureFirewallListResult - Response for ListAzureFirewalls API service call. +type AzureFirewallListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Azure Firewalls in a resource group. + Value []*AzureFirewall `json:"value,omitempty"` +} + +// AzureFirewallNatRCAction - AzureFirewall NAT Rule Collection Action. +type AzureFirewallNatRCAction struct { + // The type of action. + Type *AzureFirewallNatRCActionType `json:"type,omitempty"` +} + +// AzureFirewallNatRule - Properties of a NAT rule. +type AzureFirewallNatRule struct { + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of destination ports. + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Name of the NAT rule. + Name *string `json:"name,omitempty"` + + // Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + Protocols []*AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` + + // The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + + // The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + + // The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` +} + +// AzureFirewallNatRuleCollection - NAT rule collection resource. +type AzureFirewallNatRuleCollection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the azure firewall NAT rule collection. + Properties *AzureFirewallNatRuleCollectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// AzureFirewallNatRuleCollectionProperties - Properties of the NAT rule collection. +type AzureFirewallNatRuleCollectionProperties struct { + // The action type of a NAT rule collection. + Action *AzureFirewallNatRCAction `json:"action,omitempty"` + + // Priority of the NAT rule collection resource. + Priority *int32 `json:"priority,omitempty"` + + // Collection of rules used by a NAT rule collection. + Rules []*AzureFirewallNatRule `json:"rules,omitempty"` + + // READ-ONLY; The provisioning state of the NAT rule collection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallNetworkRule - Properties of the network rule. +type AzureFirewallNetworkRule struct { + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of destination FQDNs. + DestinationFqdns []*string `json:"destinationFqdns,omitempty"` + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string `json:"destinationIpGroups,omitempty"` + + // List of destination ports. + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Name of the network rule. + Name *string `json:"name,omitempty"` + + // Array of AzureFirewallNetworkRuleProtocols. + Protocols []*AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` +} + +// AzureFirewallNetworkRuleCollection - Network rule collection resource. +type AzureFirewallNetworkRuleCollection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the azure firewall network rule collection. + Properties *AzureFirewallNetworkRuleCollectionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the network rule collection. +type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { + // The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + + // Priority of the network rule collection resource. + Priority *int32 `json:"priority,omitempty"` + + // Collection of rules used by a network rule collection. + Rules []*AzureFirewallNetworkRule `json:"rules,omitempty"` + + // READ-ONLY; The provisioning state of the network rule collection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallPropertiesFormat - Properties of the Azure Firewall. +type AzureFirewallPropertiesFormat struct { + // The additional properties used to further config this azure firewall. + AdditionalProperties map[string]*string `json:"additionalProperties,omitempty"` + + // Collection of application rule collections used by Azure Firewall. + ApplicationRuleCollections []*AzureFirewallApplicationRuleCollection `json:"applicationRuleCollections,omitempty"` + + // The firewallPolicy associated with this azure firewall. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + + // IP addresses associated with AzureFirewall. + HubIPAddresses *HubIPAddresses `json:"hubIPAddresses,omitempty"` + + // IP configuration of the Azure Firewall resource. + IPConfigurations []*AzureFirewallIPConfiguration `json:"ipConfigurations,omitempty"` + + // IP configuration of the Azure Firewall used for management traffic. + ManagementIPConfiguration *AzureFirewallIPConfiguration `json:"managementIpConfiguration,omitempty"` + + // Collection of NAT rule collections used by Azure Firewall. + NatRuleCollections []*AzureFirewallNatRuleCollection `json:"natRuleCollections,omitempty"` + + // Collection of network rule collections used by Azure Firewall. + NetworkRuleCollections []*AzureFirewallNetworkRuleCollection `json:"networkRuleCollections,omitempty"` + + // The Azure Firewall Resource SKU. + SKU *AzureFirewallSKU `json:"sku,omitempty"` + + // The operation mode for Threat Intelligence. + ThreatIntelMode *AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + + // The virtualHub to which the firewall belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + + // READ-ONLY; IpGroups associated with AzureFirewall. + IPGroups []*AzureFirewallIPGroups `json:"ipGroups,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Azure firewall resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureFirewallPublicIPAddress - Public IP Address associated with azure firewall. +type AzureFirewallPublicIPAddress struct { + // Public IP Address value. + Address *string `json:"address,omitempty"` +} + +// AzureFirewallRCAction - Properties of the AzureFirewallRCAction. +type AzureFirewallRCAction struct { + // The type of action. + Type *AzureFirewallRCActionType `json:"type,omitempty"` +} + +// AzureFirewallSKU - SKU of an Azure Firewall. +type AzureFirewallSKU struct { + // Name of an Azure Firewall SKU. + Name *AzureFirewallSKUName `json:"name,omitempty"` + + // Tier of an Azure Firewall. + Tier *AzureFirewallSKUTier `json:"tier,omitempty"` +} + +// AzureFirewallsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureFirewallsClient.BeginCreateOrUpdate +// method. +type AzureFirewallsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureFirewallsClientBeginDeleteOptions contains the optional parameters for the AzureFirewallsClient.BeginDelete method. +type AzureFirewallsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureFirewallsClientBeginListLearnedPrefixesOptions contains the optional parameters for the AzureFirewallsClient.BeginListLearnedPrefixes +// method. +type AzureFirewallsClientBeginListLearnedPrefixesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureFirewallsClientBeginUpdateTagsOptions contains the optional parameters for the AzureFirewallsClient.BeginUpdateTags +// method. +type AzureFirewallsClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureFirewallsClientGetOptions contains the optional parameters for the AzureFirewallsClient.Get method. +type AzureFirewallsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureFirewallsClientListAllOptions contains the optional parameters for the AzureFirewallsClient.ListAll method. +type AzureFirewallsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// AzureFirewallsClientListOptions contains the optional parameters for the AzureFirewallsClient.List method. +type AzureFirewallsClientListOptions struct { + // placeholder for future optional parameters +} + +// AzureReachabilityReport - Azure reachability report details. +type AzureReachabilityReport struct { + // REQUIRED; The aggregation level of Azure reachability report. Can be Country, State or City. + AggregationLevel *string `json:"aggregationLevel,omitempty"` + + // REQUIRED; Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + + // REQUIRED; List of Azure reachability report items. + ReachabilityReport []*AzureReachabilityReportItem `json:"reachabilityReport,omitempty"` +} + +// AzureReachabilityReportItem - Azure reachability report details for a given provider location. +type AzureReachabilityReportItem struct { + // The Azure region. + AzureLocation *string `json:"azureLocation,omitempty"` + + // List of latency details for each of the time series. + Latencies []*AzureReachabilityReportLatencyInfo `json:"latencies,omitempty"` + + // The Internet service provider. + Provider *string `json:"provider,omitempty"` +} + +// AzureReachabilityReportLatencyInfo - Details on latency for a time series. +type AzureReachabilityReportLatencyInfo struct { + // The relative latency score between 1 and 100, higher values indicating a faster connection. + Score *int32 `json:"score,omitempty"` + + // The time stamp. + TimeStamp *time.Time `json:"timeStamp,omitempty"` +} + +// AzureReachabilityReportLocation - Parameters that define a geographic location. +type AzureReachabilityReportLocation struct { + // REQUIRED; The name of the country. + Country *string `json:"country,omitempty"` + + // The name of the city or town. + City *string `json:"city,omitempty"` + + // The name of the state. + State *string `json:"state,omitempty"` +} + +// AzureReachabilityReportParameters - Geographic and time constraints for Azure reachability report. +type AzureReachabilityReportParameters struct { + // REQUIRED; The end time for the Azure reachability report. + EndTime *time.Time `json:"endTime,omitempty"` + + // REQUIRED; Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + + // REQUIRED; The start time for the Azure reachability report. + StartTime *time.Time `json:"startTime,omitempty"` + + // Optional Azure regions to scope the query to. + AzureLocations []*string `json:"azureLocations,omitempty"` + + // List of Internet service providers. + Providers []*string `json:"providers,omitempty"` +} + +// AzureWebCategory - Azure Web Category Resource. +type AzureWebCategory struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the Azure Web Category. + Properties *AzureWebCategoryPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AzureWebCategoryListResult - Response for ListAzureWebCategories API service call. +type AzureWebCategoryListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Azure Web Categories for a given Subscription. + Value []*AzureWebCategory `json:"value,omitempty"` +} + +// AzureWebCategoryPropertiesFormat - Azure Web Category Properties. +type AzureWebCategoryPropertiesFormat struct { + // READ-ONLY; The name of the group that the category belongs to. + Group *string `json:"group,omitempty" azure:"ro"` +} + +// BGPCommunity - Contains bgp community information offered in Service Community resources. +type BGPCommunity struct { + // The name of the bgp community. e.g. Skype. + CommunityName *string `json:"communityName,omitempty"` + + // The prefixes that the bgp community contains. + CommunityPrefixes []*string `json:"communityPrefixes,omitempty"` + + // The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + CommunityValue *string `json:"communityValue,omitempty"` + + // Customer is authorized to use bgp community or not. + IsAuthorizedToUse *bool `json:"isAuthorizedToUse,omitempty"` + + // The service group of the bgp community contains. + ServiceGroup *string `json:"serviceGroup,omitempty"` + + // The region which the service support. e.g. For O365, region is Global. + ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` +} + +// BackendAddressInboundNatRulePortMappings - The response for a QueryInboundNatRulePortMapping API. +type BackendAddressInboundNatRulePortMappings struct { + // Collection of inbound NAT rule port mappings. + InboundNatRulePortMappings []*InboundNatRulePortMapping `json:"inboundNatRulePortMappings,omitempty"` +} + +// BackendAddressPool - Pool of backend IP addresses. +type BackendAddressPool struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can + // be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer backend address pool. + Properties *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BackendAddressPoolPropertiesFormat - Properties of the backend address pool. +type BackendAddressPoolPropertiesFormat struct { + // Amount of seconds Load Balancer waits for before sending RESET to client and backend address. + DrainPeriodInSeconds *int32 `json:"drainPeriodInSeconds,omitempty"` + + // An array of backend addresses. + LoadBalancerBackendAddresses []*LoadBalancerBackendAddress `json:"loadBalancerBackendAddresses,omitempty"` + + // The location of the backend address pool. + Location *string `json:"location,omitempty"` + + // An array of gateway load balancer tunnel interfaces. + TunnelInterfaces []*GatewayLoadBalancerTunnelInterface `json:"tunnelInterfaces,omitempty"` + + // READ-ONLY; An array of references to IP addresses defined in network interfaces. + BackendIPConfigurations []*InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. + InboundNatRules []*SubResource `json:"inboundNatRules,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to load balancing rules that use this backend address pool. + LoadBalancingRules []*SubResource `json:"loadBalancingRules,omitempty" azure:"ro"` + + // READ-ONLY; A reference to an outbound rule that uses this backend address pool. + OutboundRule *SubResource `json:"outboundRule,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to outbound rules that use this backend address pool. + OutboundRules []*SubResource `json:"outboundRules,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the backend address pool resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// BaseAdminRuleClassification provides polymorphic access to related types. +// Call the interface's GetBaseAdminRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AdminRule, *BaseAdminRule, *DefaultAdminRule +type BaseAdminRuleClassification interface { + // GetBaseAdminRule returns the BaseAdminRule content of the underlying type. + GetBaseAdminRule() *BaseAdminRule +} + +// BaseAdminRule - Network base admin rule. +type BaseAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind `json:"kind,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GetBaseAdminRule implements the BaseAdminRuleClassification interface for type BaseAdminRule. +func (b *BaseAdminRule) GetBaseAdminRule() *BaseAdminRule { return b } + +// BastionActiveSession - The session detail for a target. +type BastionActiveSession struct { + // READ-ONLY; The protocol used to connect to the target. + Protocol *BastionConnectProtocol `json:"protocol,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + + // READ-ONLY; Duration in mins the session has been active. + SessionDurationInMins *float32 `json:"sessionDurationInMins,omitempty" azure:"ro"` + + // READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty" azure:"ro"` + + // READ-ONLY; The time when the session started. + StartTime interface{} `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The host name of the target. + TargetHostName *string `json:"targetHostName,omitempty" azure:"ro"` + + // READ-ONLY; The IP Address of the target. + TargetIPAddress *string `json:"targetIpAddress,omitempty" azure:"ro"` + + // READ-ONLY; The resource group of the target. + TargetResourceGroup *string `json:"targetResourceGroup,omitempty" azure:"ro"` + + // READ-ONLY; The resource id of the target. + TargetResourceID *string `json:"targetResourceId,omitempty" azure:"ro"` + + // READ-ONLY; The subscription id for the target virtual machine. + TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty" azure:"ro"` + + // READ-ONLY; The user name who is active on this session. + UserName *string `json:"userName,omitempty" azure:"ro"` +} + +// BastionActiveSessionListResult - Response for GetActiveSessions. +type BastionActiveSessionListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of active sessions on the bastion. + Value []*BastionActiveSession `json:"value,omitempty"` +} + +// BastionHost - Bastion Host resource. +type BastionHost struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Represents the bastion host resource. + Properties *BastionHostPropertiesFormat `json:"properties,omitempty"` + + // The sku of this Bastion Host. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BastionHostIPConfiguration - IP configuration of an Bastion Host. +type BastionHostIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Represents the ip configuration associated with the resource. + Properties *BastionHostIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Ip configuration type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BastionHostIPConfigurationPropertiesFormat - Properties of IP configuration of an Bastion Host. +type BastionHostIPConfigurationPropertiesFormat struct { + // REQUIRED; Reference of the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + + // REQUIRED; Reference of the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + + // Private IP allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // READ-ONLY; The provisioning state of the bastion host IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// BastionHostListResult - Response for ListBastionHosts API service call. +type BastionHostListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Bastion Hosts in a resource group. + Value []*BastionHost `json:"value,omitempty"` +} + +// BastionHostPropertiesFormat - Properties of the Bastion Host. +type BastionHostPropertiesFormat struct { + // FQDN for the endpoint on which bastion host is accessible. + DNSName *string `json:"dnsName,omitempty"` + + // Enable/Disable Copy/Paste feature of the Bastion Host resource. + DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"` + + // Enable/Disable File Copy feature of the Bastion Host resource. + EnableFileCopy *bool `json:"enableFileCopy,omitempty"` + + // Enable/Disable IP Connect feature of the Bastion Host resource. + EnableIPConnect *bool `json:"enableIpConnect,omitempty"` + + // Enable/Disable Shareable Link of the Bastion Host resource. + EnableShareableLink *bool `json:"enableShareableLink,omitempty"` + + // Enable/Disable Tunneling feature of the Bastion Host resource. + EnableTunneling *bool `json:"enableTunneling,omitempty"` + + // IP configuration of the Bastion Host resource. + IPConfigurations []*BastionHostIPConfiguration `json:"ipConfigurations,omitempty"` + + // The scale units for the Bastion Host resource. + ScaleUnits *int32 `json:"scaleUnits,omitempty"` + + // READ-ONLY; The provisioning state of the bastion host resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// BastionHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the BastionHostsClient.BeginCreateOrUpdate +// method. +type BastionHostsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BastionHostsClientBeginDeleteOptions contains the optional parameters for the BastionHostsClient.BeginDelete method. +type BastionHostsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BastionHostsClientBeginUpdateTagsOptions contains the optional parameters for the BastionHostsClient.BeginUpdateTags method. +type BastionHostsClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BastionHostsClientGetOptions contains the optional parameters for the BastionHostsClient.Get method. +type BastionHostsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BastionHostsClientListByResourceGroupOptions contains the optional parameters for the BastionHostsClient.ListByResourceGroup +// method. +type BastionHostsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// BastionHostsClientListOptions contains the optional parameters for the BastionHostsClient.List method. +type BastionHostsClientListOptions struct { + // placeholder for future optional parameters +} + +// BastionSessionDeleteResult - Response for DisconnectActiveSessions. +type BastionSessionDeleteResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of sessions with their corresponding state. + Value []*BastionSessionState `json:"value,omitempty"` +} + +// BastionSessionState - The session state detail for a target. +type BastionSessionState struct { + // READ-ONLY; Used for extra information. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty" azure:"ro"` + + // READ-ONLY; The state of the session. Disconnected/Failed/NotFound. + State *string `json:"state,omitempty" azure:"ro"` +} + +// BastionShareableLink - Bastion Shareable Link. +type BastionShareableLink struct { + // REQUIRED; Reference of the virtual machine resource. + VM *VM `json:"vm,omitempty"` + + // READ-ONLY; The unique Bastion Shareable Link to the virtual machine. + Bsl *string `json:"bsl,omitempty" azure:"ro"` + + // READ-ONLY; The time when the link was created. + CreatedAt *string `json:"createdAt,omitempty" azure:"ro"` + + // READ-ONLY; Optional field indicating the warning or error message related to the vm in case of partial failure. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// BastionShareableLinkListRequest - Post request for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListRequest struct { + // List of VM references. + VMs []*BastionShareableLink `json:"vms,omitempty"` +} + +// BastionShareableLinkListResult - Response for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Bastion Shareable Links for the request. + Value []*BastionShareableLink `json:"value,omitempty"` +} + +// BgpConnection - Virtual Appliance Site resource. +type BgpConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the connection. + Name *string `json:"name,omitempty"` + + // The properties of the Bgp connections. + Properties *BgpConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Connection type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BgpConnectionProperties - Properties of the bgp connection. +type BgpConnectionProperties struct { + // The reference to the HubVirtualNetworkConnection resource. + HubVirtualNetworkConnection *SubResource `json:"hubVirtualNetworkConnection,omitempty"` + + // Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + + // Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + + // READ-ONLY; The current state of the VirtualHub to Peer. + ConnectionState *HubBgpConnectionStatus `json:"connectionState,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// BgpPeerStatus - BGP peer status details. +type BgpPeerStatus struct { + // READ-ONLY; The autonomous system number of the remote BGP peer. + Asn *int64 `json:"asn,omitempty" azure:"ro"` + + // READ-ONLY; For how long the peering has been up. + ConnectedDuration *string `json:"connectedDuration,omitempty" azure:"ro"` + + // READ-ONLY; The virtual network gateway's local address. + LocalAddress *string `json:"localAddress,omitempty" azure:"ro"` + + // READ-ONLY; The number of BGP messages received. + MessagesReceived *int64 `json:"messagesReceived,omitempty" azure:"ro"` + + // READ-ONLY; The number of BGP messages sent. + MessagesSent *int64 `json:"messagesSent,omitempty" azure:"ro"` + + // READ-ONLY; The remote BGP peer. + Neighbor *string `json:"neighbor,omitempty" azure:"ro"` + + // READ-ONLY; The number of routes learned from this peer. + RoutesReceived *int64 `json:"routesReceived,omitempty" azure:"ro"` + + // READ-ONLY; The BGP peer state. + State *BgpPeerState `json:"state,omitempty" azure:"ro"` +} + +// BgpPeerStatusListResult - Response for list BGP peer status API service call. +type BgpPeerStatusListResult struct { + // List of BGP peers. + Value []*BgpPeerStatus `json:"value,omitempty"` +} + +// BgpServiceCommunitiesClientListOptions contains the optional parameters for the BgpServiceCommunitiesClient.List method. +type BgpServiceCommunitiesClientListOptions struct { + // placeholder for future optional parameters +} + +// BgpServiceCommunity - Service Community Properties. +type BgpServiceCommunity struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the BGP service community. + Properties *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// BgpServiceCommunityListResult - Response for the ListServiceCommunity API service call. +type BgpServiceCommunityListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of service community resources. + Value []*BgpServiceCommunity `json:"value,omitempty"` +} + +// BgpServiceCommunityPropertiesFormat - Properties of Service Community. +type BgpServiceCommunityPropertiesFormat struct { + // A list of bgp communities. + BgpCommunities []*BGPCommunity `json:"bgpCommunities,omitempty"` + + // The name of the bgp community. e.g. Skype. + ServiceName *string `json:"serviceName,omitempty"` +} + +// BgpSettings - BGP settings details. +type BgpSettings struct { + // The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + + // The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` + + // BGP peering address with IP configuration ID for virtual network gateway. + BgpPeeringAddresses []*IPConfigurationBgpPeeringAddress `json:"bgpPeeringAddresses,omitempty"` + + // The weight added to routes learned from this BGP speaker. + PeerWeight *int32 `json:"peerWeight,omitempty"` +} + +// BreakOutCategoryPolicies - Network Virtual Appliance Sku Properties. +type BreakOutCategoryPolicies struct { + // Flag to control breakout of o365 allow category. + Allow *bool `json:"allow,omitempty"` + + // Flag to control breakout of o365 default category. + Default *bool `json:"default,omitempty"` + + // Flag to control breakout of o365 optimize category. + Optimize *bool `json:"optimize,omitempty"` +} + +// CheckPrivateLinkServiceVisibilityRequest - Request body of the CheckPrivateLinkServiceVisibility API service call. +type CheckPrivateLinkServiceVisibilityRequest struct { + // The alias of the private link service. + PrivateLinkServiceAlias *string `json:"privateLinkServiceAlias,omitempty"` +} + +// ChildResource - Proxy resource representation. +type ChildResource struct { + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +// ConfigurationDiagnosticParameters - Parameters to get network configuration diagnostic. +type ConfigurationDiagnosticParameters struct { + // REQUIRED; List of network configuration diagnostic profiles. + Profiles []*ConfigurationDiagnosticProfile `json:"profiles,omitempty"` + + // REQUIRED; The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, + // VMSS/NetworkInterface and Application Gateway. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // Verbosity level. + VerbosityLevel *VerbosityLevel `json:"verbosityLevel,omitempty"` +} + +// ConfigurationDiagnosticProfile - Parameters to compare with network configuration. +type ConfigurationDiagnosticProfile struct { + // REQUIRED; Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. + Destination *string `json:"destination,omitempty"` + + // REQUIRED; Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). + DestinationPort *string `json:"destinationPort,omitempty"` + + // REQUIRED; The direction of the traffic. + Direction *Direction `json:"direction,omitempty"` + + // REQUIRED; Protocol to be verified on. Accepted values are '*', TCP, UDP. + Protocol *string `json:"protocol,omitempty"` + + // REQUIRED; Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. + Source *string `json:"source,omitempty"` +} + +// ConfigurationDiagnosticResponse - Results of network configuration diagnostic on the target resource. +type ConfigurationDiagnosticResponse struct { + // READ-ONLY; List of network configuration diagnostic results. + Results []*ConfigurationDiagnosticResult `json:"results,omitempty" azure:"ro"` +} + +// ConfigurationDiagnosticResult - Network configuration diagnostic result corresponded to provided traffic query. +type ConfigurationDiagnosticResult struct { + // Network security group result. + NetworkSecurityGroupResult *SecurityGroupResult `json:"networkSecurityGroupResult,omitempty"` + + // Network configuration diagnostic profile. + Profile *ConfigurationDiagnosticProfile `json:"profile,omitempty"` +} + +// ConfigurationGroup - The network configuration group resource +type ConfigurationGroup struct { + // Network group ID. + ID *string `json:"id,omitempty"` + + // The network configuration group properties + Properties *GroupProperties `json:"properties,omitempty"` +} + +// ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.BeginCreateOrUpdate +// method. +type ConfigurationPolicyGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationPolicyGroupsClientBeginDeleteOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.BeginDelete +// method. +type ConfigurationPolicyGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationPolicyGroupsClientGetOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.Get +// method. +type ConfigurationPolicyGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions contains the optional parameters for the ConfigurationPolicyGroupsClient.ListByVPNServerConfiguration +// method. +type ConfigurationPolicyGroupsClientListByVPNServerConfigurationOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitor - Parameters that define the operation to create a connection monitor. +type ConnectionMonitor struct { + // REQUIRED; Properties of the connection monitor. + Properties *ConnectionMonitorParameters `json:"properties,omitempty"` + + // Connection monitor location. + Location *string `json:"location,omitempty"` + + // Connection monitor tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// ConnectionMonitorDestination - Describes the destination of connection monitor. +type ConnectionMonitorDestination struct { + // Address of the connection monitor destination (IP or domain name). + Address *string `json:"address,omitempty"` + + // The destination port used by connection monitor. + Port *int32 `json:"port,omitempty"` + + // The ID of the resource used as the destination by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` +} + +// ConnectionMonitorEndpoint - Describes the connection monitor endpoint. +type ConnectionMonitorEndpoint struct { + // REQUIRED; The name of the connection monitor endpoint. + Name *string `json:"name,omitempty"` + + // Address of the connection monitor endpoint (IP or domain name). + Address *string `json:"address,omitempty"` + + // Test coverage for the endpoint. + CoverageLevel *CoverageLevel `json:"coverageLevel,omitempty"` + + // Filter for sub-items within the endpoint. + Filter *ConnectionMonitorEndpointFilter `json:"filter,omitempty"` + + // Resource ID of the connection monitor endpoint. + ResourceID *string `json:"resourceId,omitempty"` + + // Endpoint scope. + Scope *ConnectionMonitorEndpointScope `json:"scope,omitempty"` + + // The endpoint type. + Type *EndpointType `json:"type,omitempty"` +} + +// ConnectionMonitorEndpointFilter - Describes the connection monitor endpoint filter. +type ConnectionMonitorEndpointFilter struct { + // List of items in the filter. + Items []*ConnectionMonitorEndpointFilterItem `json:"items,omitempty"` + + // The behavior of the endpoint filter. Currently only 'Include' is supported. + Type *ConnectionMonitorEndpointFilterType `json:"type,omitempty"` +} + +// ConnectionMonitorEndpointFilterItem - Describes the connection monitor endpoint filter item. +type ConnectionMonitorEndpointFilterItem struct { + // The address of the filter item. + Address *string `json:"address,omitempty"` + + // The type of item included in the filter. Currently only 'AgentAddress' is supported. + Type *ConnectionMonitorEndpointFilterItemType `json:"type,omitempty"` +} + +// ConnectionMonitorEndpointScope - Describes the connection monitor endpoint scope. +type ConnectionMonitorEndpointScope struct { + // List of items which needs to be excluded from the endpoint scope. + Exclude []*ConnectionMonitorEndpointScopeItem `json:"exclude,omitempty"` + + // List of items which needs to be included to the endpoint scope. + Include []*ConnectionMonitorEndpointScopeItem `json:"include,omitempty"` +} + +// ConnectionMonitorEndpointScopeItem - Describes the connection monitor endpoint scope item. +type ConnectionMonitorEndpointScopeItem struct { + // The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address. + Address *string `json:"address,omitempty"` +} + +// ConnectionMonitorHTTPConfiguration - Describes the HTTP configuration. +type ConnectionMonitorHTTPConfiguration struct { + // The HTTP method to use. + Method *HTTPConfigurationMethod `json:"method,omitempty"` + + // The path component of the URI. For instance, "/dir1/dir2". + Path *string `json:"path,omitempty"` + + // The port to connect to. + Port *int32 `json:"port,omitempty"` + + // Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. + PreferHTTPS *bool `json:"preferHTTPS,omitempty"` + + // The HTTP headers to transmit with the request. + RequestHeaders []*HTTPHeader `json:"requestHeaders,omitempty"` + + // HTTP status codes to consider successful. For instance, "2xx,301-304,418". + ValidStatusCodeRanges []*string `json:"validStatusCodeRanges,omitempty"` +} + +// ConnectionMonitorIcmpConfiguration - Describes the ICMP configuration. +type ConnectionMonitorIcmpConfiguration struct { + // Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` +} + +// ConnectionMonitorListResult - List of connection monitors. +type ConnectionMonitorListResult struct { + // Information about connection monitors. + Value []*ConnectionMonitorResult `json:"value,omitempty"` +} + +// ConnectionMonitorOutput - Describes a connection monitor output destination. +type ConnectionMonitorOutput struct { + // Connection monitor output destination type. Currently, only "Workspace" is supported. + Type *OutputType `json:"type,omitempty"` + + // Describes the settings for producing output into a log analytics workspace. + WorkspaceSettings *ConnectionMonitorWorkspaceSettings `json:"workspaceSettings,omitempty"` +} + +// ConnectionMonitorParameters - Parameters that define the operation to create a connection monitor. +type ConnectionMonitorParameters struct { + // Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + + // Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + + // List of connection monitor endpoints. + Endpoints []*ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + + // Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + + // Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` + + // List of connection monitor outputs. + Outputs []*ConnectionMonitorOutput `json:"outputs,omitempty"` + + // Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + + // List of connection monitor test configurations. + TestConfigurations []*ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + + // List of connection monitor test groups. + TestGroups []*ConnectionMonitorTestGroup `json:"testGroups,omitempty"` +} + +// ConnectionMonitorQueryResult - List of connection states snapshots. +type ConnectionMonitorQueryResult struct { + // Status of connection monitor source. + SourceStatus *ConnectionMonitorSourceStatus `json:"sourceStatus,omitempty"` + + // Information about connection states. + States []*ConnectionStateSnapshot `json:"states,omitempty"` +} + +// ConnectionMonitorResult - Information about the connection monitor. +type ConnectionMonitorResult struct { + // Connection monitor location. + Location *string `json:"location,omitempty"` + + // Properties of the connection monitor result. + Properties *ConnectionMonitorResultProperties `json:"properties,omitempty"` + + // Connection monitor tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; ID of the connection monitor. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the connection monitor. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Connection monitor type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConnectionMonitorResultProperties - Describes the properties of a connection monitor. +type ConnectionMonitorResultProperties struct { + // Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + + // Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + + // List of connection monitor endpoints. + Endpoints []*ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + + // Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + + // Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` + + // List of connection monitor outputs. + Outputs []*ConnectionMonitorOutput `json:"outputs,omitempty"` + + // Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + + // List of connection monitor test configurations. + TestConfigurations []*ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + + // List of connection monitor test groups. + TestGroups []*ConnectionMonitorTestGroup `json:"testGroups,omitempty"` + + // READ-ONLY; Type of connection monitor. + ConnectionMonitorType *ConnectionMonitorType `json:"connectionMonitorType,omitempty" azure:"ro"` + + // READ-ONLY; The monitoring status of the connection monitor. + MonitoringStatus *string `json:"monitoringStatus,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the connection monitor. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The date and time when the connection monitor was started. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` +} + +// ConnectionMonitorSource - Describes the source of connection monitor. +type ConnectionMonitorSource struct { + // REQUIRED; The ID of the resource used as the source by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` + + // The source port used by connection monitor. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorSuccessThreshold - Describes the threshold for declaring a test successful. +type ConnectionMonitorSuccessThreshold struct { + // The maximum percentage of failed checks permitted for a test to evaluate as successful. + ChecksFailedPercent *int32 `json:"checksFailedPercent,omitempty"` + + // The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. + RoundTripTimeMs *float32 `json:"roundTripTimeMs,omitempty"` +} + +// ConnectionMonitorTCPConfiguration - Describes the TCP configuration. +type ConnectionMonitorTCPConfiguration struct { + // Destination port behavior. + DestinationPortBehavior *DestinationPortBehavior `json:"destinationPortBehavior,omitempty"` + + // Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` + + // The port to connect to. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorTestConfiguration - Describes a connection monitor test configuration. +type ConnectionMonitorTestConfiguration struct { + // REQUIRED; The name of the connection monitor test configuration. + Name *string `json:"name,omitempty"` + + // REQUIRED; The protocol to use in test evaluation. + Protocol *ConnectionMonitorTestConfigurationProtocol `json:"protocol,omitempty"` + + // The parameters used to perform test evaluation over HTTP. + HTTPConfiguration *ConnectionMonitorHTTPConfiguration `json:"httpConfiguration,omitempty"` + + // The parameters used to perform test evaluation over ICMP. + IcmpConfiguration *ConnectionMonitorIcmpConfiguration `json:"icmpConfiguration,omitempty"` + + // The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending + // on other parameters. + PreferredIPVersion *PreferredIPVersion `json:"preferredIPVersion,omitempty"` + + // The threshold for declaring a test successful. + SuccessThreshold *ConnectionMonitorSuccessThreshold `json:"successThreshold,omitempty"` + + // The parameters used to perform test evaluation over TCP. + TCPConfiguration *ConnectionMonitorTCPConfiguration `json:"tcpConfiguration,omitempty"` + + // The frequency of test evaluation, in seconds. + TestFrequencySec *int32 `json:"testFrequencySec,omitempty"` +} + +// ConnectionMonitorTestGroup - Describes the connection monitor test group. +type ConnectionMonitorTestGroup struct { + // REQUIRED; List of destination endpoint names. + Destinations []*string `json:"destinations,omitempty"` + + // REQUIRED; The name of the connection monitor test group. + Name *string `json:"name,omitempty"` + + // REQUIRED; List of source endpoint names. + Sources []*string `json:"sources,omitempty"` + + // REQUIRED; List of test configuration names. + TestConfigurations []*string `json:"testConfigurations,omitempty"` + + // Value indicating whether test group is disabled. + Disable *bool `json:"disable,omitempty"` +} + +// ConnectionMonitorWorkspaceSettings - Describes the settings for producing output into a log analytics workspace. +type ConnectionMonitorWorkspaceSettings struct { + // Log analytics workspace resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` +} + +// ConnectionMonitorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConnectionMonitorsClient.BeginCreateOrUpdate +// method. +type ConnectionMonitorsClientBeginCreateOrUpdateOptions struct { + // Value indicating whether connection monitor V1 should be migrated to V2 format. + Migrate *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectionMonitorsClientBeginDeleteOptions contains the optional parameters for the ConnectionMonitorsClient.BeginDelete +// method. +type ConnectionMonitorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectionMonitorsClientBeginQueryOptions contains the optional parameters for the ConnectionMonitorsClient.BeginQuery +// method. +type ConnectionMonitorsClientBeginQueryOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectionMonitorsClientBeginStartOptions contains the optional parameters for the ConnectionMonitorsClient.BeginStart +// method. +type ConnectionMonitorsClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectionMonitorsClientBeginStopOptions contains the optional parameters for the ConnectionMonitorsClient.BeginStop method. +type ConnectionMonitorsClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectionMonitorsClientGetOptions contains the optional parameters for the ConnectionMonitorsClient.Get method. +type ConnectionMonitorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitorsClientListOptions contains the optional parameters for the ConnectionMonitorsClient.List method. +type ConnectionMonitorsClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitorsClientUpdateTagsOptions contains the optional parameters for the ConnectionMonitorsClient.UpdateTags +// method. +type ConnectionMonitorsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ConnectionResetSharedKey - The virtual network connection reset shared key. +type ConnectionResetSharedKey struct { + // REQUIRED; The virtual network connection reset shared key length, should between 1 and 128. + KeyLength *int32 `json:"keyLength,omitempty"` +} + +// ConnectionSharedKey - Response for GetConnectionSharedKey API service call. +type ConnectionSharedKey struct { + // REQUIRED; The virtual network connection shared key value. + Value *string `json:"value,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` +} + +// ConnectionStateSnapshot - Connection state snapshot. +type ConnectionStateSnapshot struct { + // Average latency in ms. + AvgLatencyInMs *int64 `json:"avgLatencyInMs,omitempty"` + + // The connection state. + ConnectionState *ConnectionState `json:"connectionState,omitempty"` + + // The end time of the connection snapshot. + EndTime *time.Time `json:"endTime,omitempty"` + + // Connectivity analysis evaluation state. + EvaluationState *EvaluationState `json:"evaluationState,omitempty"` + + // Maximum latency in ms. + MaxLatencyInMs *int64 `json:"maxLatencyInMs,omitempty"` + + // Minimum latency in ms. + MinLatencyInMs *int64 `json:"minLatencyInMs,omitempty"` + + // The number of failed probes. + ProbesFailed *int64 `json:"probesFailed,omitempty"` + + // The number of sent probes. + ProbesSent *int64 `json:"probesSent,omitempty"` + + // The start time of the connection snapshot. + StartTime *time.Time `json:"startTime,omitempty"` + + // READ-ONLY; List of hops between the source and the destination. + Hops []*ConnectivityHop `json:"hops,omitempty" azure:"ro"` +} + +// ConnectivityConfiguration - The network manager connectivity configuration resource +type ConnectivityConfiguration struct { + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConnectivityConfigurationListResult - Result of the request to list network manager connectivity configurations. It contains +// a list of configurations and a link to get the next set of results. +type ConnectivityConfigurationListResult struct { + // Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // Gets a page of Connectivity Configurations + Value []*ConnectivityConfiguration `json:"value,omitempty"` +} + +// ConnectivityConfigurationProperties - Properties of network manager connectivity configuration +type ConnectivityConfigurationProperties struct { + // REQUIRED; Groups for configuration + AppliesToGroups []*ConnectivityGroupItem `json:"appliesToGroups,omitempty"` + + // REQUIRED; Connectivity topology type. + ConnectivityTopology *ConnectivityTopology `json:"connectivityTopology,omitempty"` + + // Flag if need to remove current existing peerings. + DeleteExistingPeering *DeleteExistingPeering `json:"deleteExistingPeering,omitempty"` + + // A description of the connectivity configuration. + Description *string `json:"description,omitempty"` + + // List of hubItems + Hubs []*Hub `json:"hubs,omitempty"` + + // Flag if global mesh is supported. + IsGlobal *IsGlobal `json:"isGlobal,omitempty"` + + // READ-ONLY; The provisioning state of the connectivity configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ConnectivityConfigurationsClientBeginDeleteOptions contains the optional parameters for the ConnectivityConfigurationsClient.BeginDelete +// method. +type ConnectivityConfigurationsClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConnectivityConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the ConnectivityConfigurationsClient.CreateOrUpdate +// method. +type ConnectivityConfigurationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectivityConfigurationsClientGetOptions contains the optional parameters for the ConnectivityConfigurationsClient.Get +// method. +type ConnectivityConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectivityConfigurationsClientListOptions contains the optional parameters for the ConnectivityConfigurationsClient.List +// method. +type ConnectivityConfigurationsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ConnectivityDestination - Parameters that define destination of connection. +type ConnectivityDestination struct { + // The IP address or URI the resource to which a connection attempt will be made. + Address *string `json:"address,omitempty"` + + // Port on which check connectivity will be performed. + Port *int32 `json:"port,omitempty"` + + // The ID of the resource to which a connection attempt will be made. + ResourceID *string `json:"resourceId,omitempty"` +} + +// ConnectivityGroupItem - Connectivity group item. +type ConnectivityGroupItem struct { + // REQUIRED; Group connectivity type. + GroupConnectivity *GroupConnectivity `json:"groupConnectivity,omitempty"` + + // REQUIRED; Network group Id. + NetworkGroupID *string `json:"networkGroupId,omitempty"` + + // Flag if global is supported. + IsGlobal *IsGlobal `json:"isGlobal,omitempty"` + + // Flag if need to use hub gateway. + UseHubGateway *UseHubGateway `json:"useHubGateway,omitempty"` +} + +// ConnectivityHop - Information about a hop between the source and the destination. +type ConnectivityHop struct { + // READ-ONLY; The IP address of the hop. + Address *string `json:"address,omitempty" azure:"ro"` + + // READ-ONLY; The ID of the hop. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; List of issues. + Issues []*ConnectivityIssue `json:"issues,omitempty" azure:"ro"` + + // READ-ONLY; List of hop links. + Links []*HopLink `json:"links,omitempty" azure:"ro"` + + // READ-ONLY; List of next hop identifiers. + NextHopIDs []*string `json:"nextHopIds,omitempty" azure:"ro"` + + // READ-ONLY; List of previous hop identifiers. + PreviousHopIDs []*string `json:"previousHopIds,omitempty" azure:"ro"` + + // READ-ONLY; List of previous hop links. + PreviousLinks []*HopLink `json:"previousLinks,omitempty" azure:"ro"` + + // READ-ONLY; The ID of the resource corresponding to this hop. + ResourceID *string `json:"resourceId,omitempty" azure:"ro"` + + // READ-ONLY; The type of the hop. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConnectivityInformation - Information on the connectivity status. +type ConnectivityInformation struct { + // READ-ONLY; Average latency in milliseconds. + AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty" azure:"ro"` + + // READ-ONLY; The connection status. + ConnectionStatus *ConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; List of hops between the source and the destination. + Hops []*ConnectivityHop `json:"hops,omitempty" azure:"ro"` + + // READ-ONLY; Maximum latency in milliseconds. + MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty" azure:"ro"` + + // READ-ONLY; Minimum latency in milliseconds. + MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty" azure:"ro"` + + // READ-ONLY; Number of failed probes. + ProbesFailed *int32 `json:"probesFailed,omitempty" azure:"ro"` + + // READ-ONLY; Total number of probes sent. + ProbesSent *int32 `json:"probesSent,omitempty" azure:"ro"` +} + +// ConnectivityIssue - Information about an issue encountered in the process of checking for connectivity. +type ConnectivityIssue struct { + // READ-ONLY; Provides additional context on the issue. + Context []map[string]*string `json:"context,omitempty" azure:"ro"` + + // READ-ONLY; The origin of the issue. + Origin *Origin `json:"origin,omitempty" azure:"ro"` + + // READ-ONLY; The severity of the issue. + Severity *Severity `json:"severity,omitempty" azure:"ro"` + + // READ-ONLY; The type of issue. + Type *IssueType `json:"type,omitempty" azure:"ro"` +} + +// ConnectivityParameters - Parameters that determine how the connectivity check will be performed. +type ConnectivityParameters struct { + // REQUIRED; The destination of connection. + Destination *ConnectivityDestination `json:"destination,omitempty"` + + // REQUIRED; The source of the connection. + Source *ConnectivitySource `json:"source,omitempty"` + + // Preferred IP version of the connection. + PreferredIPVersion *IPVersion `json:"preferredIPVersion,omitempty"` + + // Network protocol. + Protocol *Protocol `json:"protocol,omitempty"` + + // Configuration of the protocol. + ProtocolConfiguration *ProtocolConfiguration `json:"protocolConfiguration,omitempty"` +} + +// ConnectivitySource - Parameters that define the source of the connection. +type ConnectivitySource struct { + // REQUIRED; The ID of the resource from which a connectivity check will be initiated. + ResourceID *string `json:"resourceId,omitempty"` + + // The source port from which a connectivity check will be performed. + Port *int32 `json:"port,omitempty"` +} + +// Container - Reference to container resource in remote resource provider. +type Container struct { + // Resource ID. + ID *string `json:"id,omitempty"` +} + +// ContainerNetworkInterface - Container network interface child resource. +type ContainerNetworkInterface struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Container network interface properties. + Properties *ContainerNetworkInterfacePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ContainerNetworkInterfaceConfiguration - Container network interface configuration child resource. +type ContainerNetworkInterfaceConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Container network interface configuration properties. + Properties *ContainerNetworkInterfaceConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ContainerNetworkInterfaceConfigurationPropertiesFormat - Container network interface configuration properties. +type ContainerNetworkInterfaceConfigurationPropertiesFormat struct { + // A list of container network interfaces created from this container network interface configuration. + ContainerNetworkInterfaces []*SubResource `json:"containerNetworkInterfaces,omitempty"` + + // A list of ip configurations of the container network interface configuration. + IPConfigurations []*IPConfigurationProfile `json:"ipConfigurations,omitempty"` + + // READ-ONLY; The provisioning state of the container network interface configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ContainerNetworkInterfaceIPConfiguration - The ip configuration for a container network interface. +type ContainerNetworkInterfaceIPConfiguration struct { + // The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the container network interface IP configuration. + Properties *ContainerNetworkInterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ContainerNetworkInterfaceIPConfigurationPropertiesFormat - Properties of the container network interface IP configuration. +type ContainerNetworkInterfaceIPConfigurationPropertiesFormat struct { + // READ-ONLY; The provisioning state of the container network interface IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ContainerNetworkInterfacePropertiesFormat - Properties of container network interface. +type ContainerNetworkInterfacePropertiesFormat struct { + // Reference to the container to which this container network interface is attached. + Container *Container `json:"container,omitempty"` + + // READ-ONLY; Container network interface configuration from which this container network interface is created. + ContainerNetworkInterfaceConfiguration *ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; Reference to the ip configuration on this container nic. + IPConfigurations []*ContainerNetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the container network interface resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// Criterion - A matching criteria which matches routes based on route prefix, community, and AS path. +type Criterion struct { + // List of AS paths which this criteria matches. + AsPath []*string `json:"asPath,omitempty"` + + // List of BGP communities which this criteria matches. + Community []*string `json:"community,omitempty"` + + // Match condition to apply RouteMap rules. + MatchCondition *RouteMapMatchCondition `json:"matchCondition,omitempty"` + + // List of route prefixes which this criteria matches. + RoutePrefix []*string `json:"routePrefix,omitempty"` +} + +// CrossTenantScopes - Cross tenant scopes. +type CrossTenantScopes struct { + // READ-ONLY; List of management groups. + ManagementGroups []*string `json:"managementGroups,omitempty" azure:"ro"` + + // READ-ONLY; List of subscriptions. + Subscriptions []*string `json:"subscriptions,omitempty" azure:"ro"` + + // READ-ONLY; Tenant ID. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// CustomDNSConfigPropertiesFormat - Contains custom Dns resolution configuration from customer. +type CustomDNSConfigPropertiesFormat struct { + // Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + + // A list of private ip addresses of the private endpoint. + IPAddresses []*string `json:"ipAddresses,omitempty"` +} + +// CustomIPPrefix - Custom IP prefix resource. +type CustomIPPrefix struct { + // The extended location of the custom IP prefix. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Custom IP prefix properties. + Properties *CustomIPPrefixPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CustomIPPrefixListResult - Response for ListCustomIpPrefixes API service call. +type CustomIPPrefixListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of Custom IP prefixes that exists in a resource group. + Value []*CustomIPPrefix `json:"value,omitempty"` +} + +// CustomIPPrefixPropertiesFormat - Custom IP prefix properties. +type CustomIPPrefixPropertiesFormat struct { + // The ASN for CIDR advertising. Should be an integer as string. + Asn *string `json:"asn,omitempty"` + + // Authorization message for WAN validation. + AuthorizationMessage *string `json:"authorizationMessage,omitempty"` + + // The prefix range in CIDR notation. Should include the start address and the prefix length. + Cidr *string `json:"cidr,omitempty"` + + // The commissioned state of the Custom IP Prefix. + CommissionedState *CommissionedState `json:"commissionedState,omitempty"` + + // The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + CustomIPPrefixParent *SubResource `json:"customIpPrefixParent,omitempty"` + + // Whether to do express route advertise. + ExpressRouteAdvertise *bool `json:"expressRouteAdvertise,omitempty"` + + // The Geo for CIDR advertising. Should be an Geo code. + Geo *Geo `json:"geo,omitempty"` + + // Whether to Advertise the range to Internet. + NoInternetAdvertise *bool `json:"noInternetAdvertise,omitempty"` + + // Type of custom IP prefix. Should be Singular, Parent, or Child. + PrefixType *CustomIPPrefixType `json:"prefixType,omitempty"` + + // Signed message for WAN validation. + SignedMessage *string `json:"signedMessage,omitempty"` + + // READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. + ChildCustomIPPrefixes []*SubResource `json:"childCustomIpPrefixes,omitempty" azure:"ro"` + + // READ-ONLY; The reason why resource is in failed state. + FailedReason *string `json:"failedReason,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the custom IP prefix resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The list of all referenced PublicIpPrefixes. + PublicIPPrefixes []*SubResource `json:"publicIpPrefixes,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the custom IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// CustomIPPrefixesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomIPPrefixesClient.BeginCreateOrUpdate +// method. +type CustomIPPrefixesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomIPPrefixesClientBeginDeleteOptions contains the optional parameters for the CustomIPPrefixesClient.BeginDelete method. +type CustomIPPrefixesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomIPPrefixesClientGetOptions contains the optional parameters for the CustomIPPrefixesClient.Get method. +type CustomIPPrefixesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// CustomIPPrefixesClientListAllOptions contains the optional parameters for the CustomIPPrefixesClient.ListAll method. +type CustomIPPrefixesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// CustomIPPrefixesClientListOptions contains the optional parameters for the CustomIPPrefixesClient.List method. +type CustomIPPrefixesClientListOptions struct { + // placeholder for future optional parameters +} + +// CustomIPPrefixesClientUpdateTagsOptions contains the optional parameters for the CustomIPPrefixesClient.UpdateTags method. +type CustomIPPrefixesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// DNSNameAvailabilityResult - Response for the CheckDnsNameAvailability API service call. +type DNSNameAvailabilityResult struct { + // Domain availability (True/False). + Available *bool `json:"available,omitempty"` +} + +// DNSSettings - DNS Proxy Settings in Firewall Policy. +type DNSSettings struct { + // Enable DNS Proxy on Firewalls attached to the Firewall Policy. + EnableProxy *bool `json:"enableProxy,omitempty"` + + // FQDNs in Network Rules are supported when set to true. + RequireProxyForNetworkRules *bool `json:"requireProxyForNetworkRules,omitempty"` + + // List of Custom DNS Servers. + Servers []*string `json:"servers,omitempty"` +} + +// DdosCustomPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the DdosCustomPoliciesClient.BeginCreateOrUpdate +// method. +type DdosCustomPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DdosCustomPoliciesClientBeginDeleteOptions contains the optional parameters for the DdosCustomPoliciesClient.BeginDelete +// method. +type DdosCustomPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DdosCustomPoliciesClientGetOptions contains the optional parameters for the DdosCustomPoliciesClient.Get method. +type DdosCustomPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DdosCustomPoliciesClientUpdateTagsOptions contains the optional parameters for the DdosCustomPoliciesClient.UpdateTags +// method. +type DdosCustomPoliciesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// DdosCustomPolicy - A DDoS custom policy in a resource group. +type DdosCustomPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the DDoS custom policy. + Properties *DdosCustomPolicyPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DdosCustomPolicyPropertiesFormat - DDoS custom policy properties. +type DdosCustomPolicyPropertiesFormat struct { + // READ-ONLY; The provisioning state of the DDoS custom policy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the DDoS custom policy resource. It uniquely identifies the resource, even if + // the user changes its name or migrate the resource across subscriptions or resource groups. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// DdosProtectionPlan - A DDoS protection plan in a resource group. +type DdosProtectionPlan struct { + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the DDoS protection plan. + Properties *DdosProtectionPlanPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DdosProtectionPlanListResult - A list of DDoS protection plans. +type DdosProtectionPlanListResult struct { + // A list of DDoS protection plans. + Value []*DdosProtectionPlan `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DdosProtectionPlanPropertiesFormat - DDoS protection plan properties. +type DdosProtectionPlanPropertiesFormat struct { + // READ-ONLY; The provisioning state of the DDoS protection plan resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The list of public IPs associated with the DDoS protection plan resource. This list is read-only. + PublicIPAddresses []*SubResource `json:"publicIpAddresses,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the DDoS protection plan resource. It uniquely identifies the resource, even if + // the user changes its name or migrate the resource across subscriptions or resource groups. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. + VirtualNetworks []*SubResource `json:"virtualNetworks,omitempty" azure:"ro"` +} + +// DdosProtectionPlansClientBeginCreateOrUpdateOptions contains the optional parameters for the DdosProtectionPlansClient.BeginCreateOrUpdate +// method. +type DdosProtectionPlansClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DdosProtectionPlansClientBeginDeleteOptions contains the optional parameters for the DdosProtectionPlansClient.BeginDelete +// method. +type DdosProtectionPlansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DdosProtectionPlansClientGetOptions contains the optional parameters for the DdosProtectionPlansClient.Get method. +type DdosProtectionPlansClientGetOptions struct { + // placeholder for future optional parameters +} + +// DdosProtectionPlansClientListByResourceGroupOptions contains the optional parameters for the DdosProtectionPlansClient.ListByResourceGroup +// method. +type DdosProtectionPlansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DdosProtectionPlansClientListOptions contains the optional parameters for the DdosProtectionPlansClient.List method. +type DdosProtectionPlansClientListOptions struct { + // placeholder for future optional parameters +} + +// DdosProtectionPlansClientUpdateTagsOptions contains the optional parameters for the DdosProtectionPlansClient.UpdateTags +// method. +type DdosProtectionPlansClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// DdosSettings - Contains the DDoS protection settings of the public IP. +type DdosSettings struct { + // The DDoS protection plan associated with the public IP. Can only be set if ProtectionMode is Enabled + DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` + + // The DDoS protection mode of the public IP + ProtectionMode *DdosSettingsProtectionMode `json:"protectionMode,omitempty"` +} + +// DefaultAdminPropertiesFormat - Security default admin rule resource. +type DefaultAdminPropertiesFormat struct { + // Default rule flag. + Flag *string `json:"flag,omitempty"` + + // READ-ONLY; Indicates the access allowed for this particular rule + Access *SecurityConfigurationRuleAccess `json:"access,omitempty" azure:"ro"` + + // READ-ONLY; A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The destination port ranges. + DestinationPortRanges []*string `json:"destinationPortRanges,omitempty" azure:"ro"` + + // READ-ONLY; The destination address prefixes. CIDR or destination IP ranges. + Destinations []*AddressPrefixItem `json:"destinations,omitempty" azure:"ro"` + + // READ-ONLY; Indicates if the traffic matched against the rule in inbound or outbound. + Direction *SecurityConfigurationRuleDirection `json:"direction,omitempty" azure:"ro"` + + // READ-ONLY; The priority of the rule. The value can be between 1 and 4096. The priority number must be unique for each rule + // in the collection. The lower the priority number, the higher the priority of the rule. + Priority *int32 `json:"priority,omitempty" azure:"ro"` + + // READ-ONLY; Network protocol this rule applies to. + Protocol *SecurityConfigurationRuleProtocol `json:"protocol,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The source port ranges. + SourcePortRanges []*string `json:"sourcePortRanges,omitempty" azure:"ro"` + + // READ-ONLY; The CIDR or source IP ranges. + Sources []*AddressPrefixItem `json:"sources,omitempty" azure:"ro"` +} + +// DefaultAdminRule - Network default admin rule. +type DefaultAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *AdminRuleKind `json:"kind,omitempty"` + + // Indicates the properties of the security admin rule + Properties *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GetBaseAdminRule implements the BaseAdminRuleClassification interface for type DefaultAdminRule. +func (d *DefaultAdminRule) GetBaseAdminRule() *BaseAdminRule { + return &BaseAdminRule{ + Kind: d.Kind, + SystemData: d.SystemData, + ID: d.ID, + Name: d.Name, + Type: d.Type, + Etag: d.Etag, + } +} + +// DefaultRuleSetPropertyFormat - the default web application firewall rule set. +type DefaultRuleSetPropertyFormat struct { + // The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` +} + +// DefaultSecurityRulesClientGetOptions contains the optional parameters for the DefaultSecurityRulesClient.Get method. +type DefaultSecurityRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DefaultSecurityRulesClientListOptions contains the optional parameters for the DefaultSecurityRulesClient.List method. +type DefaultSecurityRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// Delegation - Details the service to which the subnet is delegated. +type Delegation struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within a subnet. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the subnet. + Properties *ServiceDelegationPropertiesFormat `json:"properties,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// DeviceProperties - List of properties of the device. +type DeviceProperties struct { + // Model of the device. + DeviceModel *string `json:"deviceModel,omitempty"` + + // Name of the device Vendor. + DeviceVendor *string `json:"deviceVendor,omitempty"` + + // Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// DhcpOptions contains an array of DNS servers available to VMs deployed in the virtual network. Standard DHCP option for +// a subnet overrides VNET DHCP options. +type DhcpOptions struct { + // The list of DNS servers IP addresses. + DNSServers []*string `json:"dnsServers,omitempty"` +} + +// Dimension of the metric. +type Dimension struct { + // The display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + + // The internal name of the dimension. + InternalName *string `json:"internalName,omitempty"` + + // The name of the dimension. + Name *string `json:"name,omitempty"` +} + +// DscpConfiguration - Differentiated Services Code Point configuration for any given network interface +type DscpConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the network interface. + Properties *DscpConfigurationPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DscpConfigurationClientBeginCreateOrUpdateOptions contains the optional parameters for the DscpConfigurationClient.BeginCreateOrUpdate +// method. +type DscpConfigurationClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DscpConfigurationClientBeginDeleteOptions contains the optional parameters for the DscpConfigurationClient.BeginDelete +// method. +type DscpConfigurationClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DscpConfigurationClientGetOptions contains the optional parameters for the DscpConfigurationClient.Get method. +type DscpConfigurationClientGetOptions struct { + // placeholder for future optional parameters +} + +// DscpConfigurationClientListAllOptions contains the optional parameters for the DscpConfigurationClient.ListAll method. +type DscpConfigurationClientListAllOptions struct { + // placeholder for future optional parameters +} + +// DscpConfigurationClientListOptions contains the optional parameters for the DscpConfigurationClient.List method. +type DscpConfigurationClientListOptions struct { + // placeholder for future optional parameters +} + +// DscpConfigurationListResult - Response for the DscpConfigurationList API service call. +type DscpConfigurationListResult struct { + // A list of dscp configurations in a resource group. + Value []*DscpConfiguration `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DscpConfigurationPropertiesFormat - Differentiated Services Code Point configuration properties. +type DscpConfigurationPropertiesFormat struct { + // Destination IP ranges. + DestinationIPRanges []*QosIPRange `json:"destinationIpRanges,omitempty"` + + // Destination port ranges. + DestinationPortRanges []*QosPortRange `json:"destinationPortRanges,omitempty"` + + // List of markings to be used in the configuration. + Markings []*int32 `json:"markings,omitempty"` + + // RNM supported protocol types. + Protocol *ProtocolType `json:"protocol,omitempty"` + + // QoS object definitions + QosDefinitionCollection []*QosDefinition `json:"qosDefinitionCollection,omitempty"` + + // Source IP ranges. + SourceIPRanges []*QosIPRange `json:"sourceIpRanges,omitempty"` + + // Sources port ranges. + SourcePortRanges []*QosPortRange `json:"sourcePortRanges,omitempty"` + + // READ-ONLY; Associated Network Interfaces to the DSCP Configuration. + AssociatedNetworkInterfaces []*Interface `json:"associatedNetworkInterfaces,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the DSCP Configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Qos Collection ID generated by RNM. + QosCollectionID *string `json:"qosCollectionId,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the DSCP Configuration resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// EffectiveBaseSecurityAdminRuleClassification provides polymorphic access to related types. +// Call the interface's GetEffectiveBaseSecurityAdminRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *EffectiveBaseSecurityAdminRule, *EffectiveDefaultSecurityAdminRule, *EffectiveSecurityAdminRule +type EffectiveBaseSecurityAdminRuleClassification interface { + // GetEffectiveBaseSecurityAdminRule returns the EffectiveBaseSecurityAdminRule content of the underlying type. + GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule +} + +// EffectiveBaseSecurityAdminRule - Network base admin rule. +type EffectiveBaseSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetEffectiveBaseSecurityAdminRule implements the EffectiveBaseSecurityAdminRuleClassification interface for type EffectiveBaseSecurityAdminRule. +func (e *EffectiveBaseSecurityAdminRule) GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule { + return e +} + +// EffectiveConnectivityConfiguration - The network manager effective connectivity configuration +type EffectiveConnectivityConfiguration struct { + // Effective configuration groups. + ConfigurationGroups []*ConfigurationGroup `json:"configurationGroups,omitempty"` + + // Connectivity configuration ID. + ID *string `json:"id,omitempty"` + + // Properties of a network manager connectivity configuration + Properties *ConnectivityConfigurationProperties `json:"properties,omitempty"` +} + +// EffectiveDefaultSecurityAdminRule - Network default admin rule. +type EffectiveDefaultSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Indicates the properties of the default security admin rule + Properties *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetEffectiveBaseSecurityAdminRule implements the EffectiveBaseSecurityAdminRuleClassification interface for type EffectiveDefaultSecurityAdminRule. +func (e *EffectiveDefaultSecurityAdminRule) GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule { + return &EffectiveBaseSecurityAdminRule{ + ID: e.ID, + ConfigurationDescription: e.ConfigurationDescription, + RuleCollectionDescription: e.RuleCollectionDescription, + RuleCollectionAppliesToGroups: e.RuleCollectionAppliesToGroups, + RuleGroups: e.RuleGroups, + Kind: e.Kind, + } +} + +// EffectiveNetworkSecurityGroup - Effective network security group. +type EffectiveNetworkSecurityGroup struct { + // Associated resources. + Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` + + // A collection of effective security rules. + EffectiveSecurityRules []*EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` + + // The ID of network security group that is applied. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + + // Mapping of tags to list of IP Addresses included within the tag. + TagMap *string `json:"tagMap,omitempty"` +} + +// EffectiveNetworkSecurityGroupAssociation - The effective network security group association. +type EffectiveNetworkSecurityGroupAssociation struct { + // The ID of the network interface if assigned. + NetworkInterface *SubResource `json:"networkInterface,omitempty"` + + // The ID of the Azure network manager if assigned. + NetworkManager *SubResource `json:"networkManager,omitempty"` + + // The ID of the subnet if assigned. + Subnet *SubResource `json:"subnet,omitempty"` +} + +// EffectiveNetworkSecurityGroupListResult - Response for list effective network security groups API service call. +type EffectiveNetworkSecurityGroupListResult struct { + // A list of effective network security groups. + Value []*EffectiveNetworkSecurityGroup `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// EffectiveNetworkSecurityRule - Effective network security rules. +type EffectiveNetworkSecurityRule struct { + // Whether network traffic is allowed or denied. + Access *SecurityRuleAccess `json:"access,omitempty"` + + // The destination address prefix. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + + // The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, + // Internet), System Tags, and the asterisk (*). + DestinationAddressPrefixes []*string `json:"destinationAddressPrefixes,omitempty"` + + // The destination port or range. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + + // The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator + // (e.g. 100-400), or an asterisk (*). + DestinationPortRanges []*string `json:"destinationPortRanges,omitempty"` + + // The direction of the rule. + Direction *SecurityRuleDirection `json:"direction,omitempty"` + + // Expanded destination address prefix. + ExpandedDestinationAddressPrefix []*string `json:"expandedDestinationAddressPrefix,omitempty"` + + // The expanded source address prefix. + ExpandedSourceAddressPrefix []*string `json:"expandedSourceAddressPrefix,omitempty"` + + // The name of the security rule specified by the user (if created by the user). + Name *string `json:"name,omitempty"` + + // The priority of the rule. + Priority *int32 `json:"priority,omitempty"` + + // The network protocol this rule applies to. + Protocol *EffectiveSecurityRuleProtocol `json:"protocol,omitempty"` + + // The source address prefix. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + + // The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), + // System Tags, and the asterisk (*). + SourceAddressPrefixes []*string `json:"sourceAddressPrefixes,omitempty"` + + // The source port or range. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + + // The source port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. + // 100-400), or an asterisk (*). + SourcePortRanges []*string `json:"sourcePortRanges,omitempty"` +} + +// EffectiveRoute - Effective Route. +type EffectiveRoute struct { + // The address prefixes of the effective routes in CIDR notation. + AddressPrefix []*string `json:"addressPrefix,omitempty"` + + // If true, on-premises routes are not propagated to the network interfaces in the subnet. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + + // The name of the user defined route. This is optional. + Name *string `json:"name,omitempty"` + + // The IP address of the next hop of the effective route. + NextHopIPAddress []*string `json:"nextHopIpAddress,omitempty"` + + // The type of Azure hop the packet should be sent to. + NextHopType *RouteNextHopType `json:"nextHopType,omitempty"` + + // Who created the route. + Source *EffectiveRouteSource `json:"source,omitempty"` + + // The value of effective route. + State *EffectiveRouteState `json:"state,omitempty"` +} + +// EffectiveRouteListResult - Response for list effective route API service call. +type EffectiveRouteListResult struct { + // A list of effective routes. + Value []*EffectiveRoute `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// EffectiveRouteMapRoute - The effective RouteMap route configured on the connection resource. +type EffectiveRouteMapRoute struct { + // The ASPath of this route. + AsPath *string `json:"asPath,omitempty"` + + // BGP communities of the route. + BgpCommunities *string `json:"bgpCommunities,omitempty"` + + // The address prefix of the route. + Prefix []*string `json:"prefix,omitempty"` +} + +// EffectiveRoutesParameters - The parameters specifying the resource whose effective routes are being requested. +type EffectiveRoutesParameters struct { + // The resource whose effective routes are being requested. + ResourceID *string `json:"resourceId,omitempty"` + + // The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection + // and P2SConnection. + VirtualWanResourceType *string `json:"virtualWanResourceType,omitempty"` +} + +// EffectiveSecurityAdminRule - Network admin rule. +type EffectiveSecurityAdminRule struct { + // REQUIRED; Whether the rule is custom or default. + Kind *EffectiveAdminRuleKind `json:"kind,omitempty"` + + // A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Indicates the properties of the security admin rule + Properties *AdminPropertiesFormat `json:"properties,omitempty"` + + // Groups for rule collection + RuleCollectionAppliesToGroups []*ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + + // A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + + // Effective configuration groups. + RuleGroups []*ConfigurationGroup `json:"ruleGroups,omitempty"` +} + +// GetEffectiveBaseSecurityAdminRule implements the EffectiveBaseSecurityAdminRuleClassification interface for type EffectiveSecurityAdminRule. +func (e *EffectiveSecurityAdminRule) GetEffectiveBaseSecurityAdminRule() *EffectiveBaseSecurityAdminRule { + return &EffectiveBaseSecurityAdminRule{ + ID: e.ID, + ConfigurationDescription: e.ConfigurationDescription, + RuleCollectionDescription: e.RuleCollectionDescription, + RuleCollectionAppliesToGroups: e.RuleCollectionAppliesToGroups, + RuleGroups: e.RuleGroups, + Kind: e.Kind, + } +} + +// EndpointServiceResult - Endpoint service. +type EndpointServiceResult struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // READ-ONLY; Name of the endpoint service. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the endpoint service. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// EndpointServicesListResult - Response for the ListAvailableEndpointServices API service call. +type EndpointServicesListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of available endpoint services in a region. + Value []*EndpointServiceResult `json:"value,omitempty"` +} + +// Error - Common error representation. +type Error struct { + // Error code. + Code *string `json:"code,omitempty"` + + // Error details. + Details []*ErrorDetails `json:"details,omitempty"` + + // Inner error message. + InnerError *string `json:"innerError,omitempty"` + + // Error message. + Message *string `json:"message,omitempty"` + + // Error target. + Target *string `json:"target,omitempty"` +} + +// ErrorDetails - Common error details representation. +type ErrorDetails struct { + // Error code. + Code *string `json:"code,omitempty"` + + // Error message. + Message *string `json:"message,omitempty"` + + // Error target. + Target *string `json:"target,omitempty"` +} + +// ErrorResponse - The error object. +type ErrorResponse struct { + // The error details object. + Error *ErrorDetails `json:"error,omitempty"` +} + +// EvaluatedNetworkSecurityGroup - Results of network security group evaluation. +type EvaluatedNetworkSecurityGroup struct { + // Resource ID of nic or subnet to which network security group is applied. + AppliedTo *string `json:"appliedTo,omitempty"` + + // Matched network security rule. + MatchedRule *MatchedRule `json:"matchedRule,omitempty"` + + // Network security group ID. + NetworkSecurityGroupID *string `json:"networkSecurityGroupId,omitempty"` + + // READ-ONLY; List of network security rules evaluation results. + RulesEvaluationResult []*SecurityRulesEvaluationResult `json:"rulesEvaluationResult,omitempty" azure:"ro"` +} + +// ExclusionManagedRule - Defines a managed rule to use for exclusion. +type ExclusionManagedRule struct { + // REQUIRED; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` +} + +// ExclusionManagedRuleGroup - Defines a managed rule group to use for exclusion. +type ExclusionManagedRuleGroup struct { + // REQUIRED; The managed rule group for exclusion. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + + // List of rules that will be excluded. If none specified, all rules in the group will be excluded. + Rules []*ExclusionManagedRule `json:"rules,omitempty"` +} + +// ExclusionManagedRuleSet - Defines a managed rule set for Exclusions. +type ExclusionManagedRuleSet struct { + // REQUIRED; Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // Defines the rule groups to apply to the rule set. + RuleGroups []*ExclusionManagedRuleGroup `json:"ruleGroups,omitempty"` +} + +// ExplicitProxySettings - Explicit Proxy Settings in Firewall Policy. +type ExplicitProxySettings struct { + // When set to true, explicit proxy mode is enabled. + EnableExplicitProxy *bool `json:"enableExplicitProxy,omitempty"` + + // When set to true, pac file port and url needs to be provided. + EnablePacFile *bool `json:"enablePacFile,omitempty"` + + // Port number for explicit proxy http protocol, cannot be greater than 64000. + HTTPPort *int32 `json:"httpPort,omitempty"` + + // Port number for explicit proxy https protocol, cannot be greater than 64000. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + + // SAS URL for PAC file. + PacFile *string `json:"pacFile,omitempty"` + + // Port number for firewall to serve PAC file. + PacFilePort *int32 `json:"pacFilePort,omitempty"` +} + +// ExpressRouteCircuit resource. +type ExpressRouteCircuit struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the express route circuit. + Properties *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` + + // The SKU. + SKU *ExpressRouteCircuitSKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitArpTable - The ARP table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitArpTable struct { + // Entry age in minutes. + Age *int32 `json:"age,omitempty"` + + // The IP address. + IPAddress *string `json:"ipAddress,omitempty"` + + // Interface address. + Interface *string `json:"interface,omitempty"` + + // The MAC address. + MacAddress *string `json:"macAddress,omitempty"` +} + +// ExpressRouteCircuitAuthorization - Authorization in an ExpressRouteCircuit resource. +type ExpressRouteCircuitAuthorization struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the express route circuit authorization. + Properties *AuthorizationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCircuitAuthorizationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.BeginDelete +// method. +type ExpressRouteCircuitAuthorizationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitAuthorizationsClientGetOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.Get +// method. +type ExpressRouteCircuitAuthorizationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitAuthorizationsClientListOptions contains the optional parameters for the ExpressRouteCircuitAuthorizationsClient.List +// method. +type ExpressRouteCircuitAuthorizationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitConnection - Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. +type ExpressRouteCircuitConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the express route circuit connection. + Properties *ExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitConnectionListResult - Response for ListConnections API service call retrieves all global reach connections +// that belongs to a Private Peering for an ExpressRouteCircuit. +type ExpressRouteCircuitConnectionListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The global reach connection associated with Private Peering in an ExpressRoute Circuit. + Value []*ExpressRouteCircuitConnection `json:"value,omitempty"` +} + +// ExpressRouteCircuitConnectionPropertiesFormat - Properties of the express route circuit connection. +type ExpressRouteCircuitConnectionPropertiesFormat struct { + // /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + + // IPv6 Address PrefixProperties of the express route circuit connection. + IPv6CircuitConnectionConfig *IPv6CircuitConnectionConfig `json:"ipv6CircuitConnectionConfig,omitempty"` + + // Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route circuit connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCircuitConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitConnectionsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.BeginDelete +// method. +type ExpressRouteCircuitConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitConnectionsClientGetOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.Get +// method. +type ExpressRouteCircuitConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitConnectionsClientListOptions contains the optional parameters for the ExpressRouteCircuitConnectionsClient.List +// method. +type ExpressRouteCircuitConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitListResult - Response for ListExpressRouteCircuit API service call. +type ExpressRouteCircuitListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of ExpressRouteCircuits in a resource group. + Value []*ExpressRouteCircuit `json:"value,omitempty"` +} + +// ExpressRouteCircuitPeering - Peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the express route circuit peering. + Properties *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitPeeringConfig - Specifies the peering configuration. +type ExpressRouteCircuitPeeringConfig struct { + // The communities of bgp peering. Specified for microsoft peering. + AdvertisedCommunities []*string `json:"advertisedCommunities,omitempty"` + + // The reference to AdvertisedPublicPrefixes. + AdvertisedPublicPrefixes []*string `json:"advertisedPublicPrefixes,omitempty"` + + // The CustomerASN of the peering. + CustomerASN *int32 `json:"customerASN,omitempty"` + + // The legacy mode of the peering. + LegacyMode *int32 `json:"legacyMode,omitempty"` + + // The RoutingRegistryName of the configuration. + RoutingRegistryName *string `json:"routingRegistryName,omitempty"` + + // READ-ONLY; The advertised public prefix state of the Peering resource. + AdvertisedPublicPrefixesState *ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitPeeringID - ExpressRoute circuit peering identifier. +type ExpressRouteCircuitPeeringID struct { + // The ID of the ExpressRoute circuit peering. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitPeeringListResult - Response for ListPeering API service call retrieves all peerings that belong to +// an ExpressRouteCircuit. +type ExpressRouteCircuitPeeringListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The peerings in an express route circuit. + Value []*ExpressRouteCircuitPeering `json:"value,omitempty"` +} + +// ExpressRouteCircuitPeeringPropertiesFormat - Properties of the express route circuit peering. +type ExpressRouteCircuitPeeringPropertiesFormat struct { + // The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty"` + + // The list of circuit connections associated with Azure Private Peering for this circuit. + Connections []*ExpressRouteCircuitConnection `json:"connections,omitempty"` + + // The ExpressRoute connection. + ExpressRouteConnection *ExpressRouteConnectionID `json:"expressRouteConnection,omitempty"` + + // The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + + // The IPv6 peering configuration. + IPv6PeeringConfig *IPv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` + + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + + // The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + + // The peering type. + PeeringType *ExpressRoutePeeringType `json:"peeringType,omitempty"` + + // The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + + // The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + + // The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + + // The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + + // The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + + // The peering state. + State *ExpressRoutePeeringState `json:"state,omitempty"` + + // The peering stats of express route circuit. + Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` + + // The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + + // READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty" azure:"ro"` + + // READ-ONLY; The list of peered circuit connections associated with Azure Private Peering for this circuit. + PeeredConnections []*PeerExpressRouteCircuitConnection `json:"peeredConnections,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route circuit peering resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCircuitPeeringsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitPeeringsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.BeginDelete +// method. +type ExpressRouteCircuitPeeringsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitPeeringsClientGetOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.Get +// method. +type ExpressRouteCircuitPeeringsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitPeeringsClientListOptions contains the optional parameters for the ExpressRouteCircuitPeeringsClient.List +// method. +type ExpressRouteCircuitPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitPropertiesFormat - Properties of ExpressRouteCircuit. +type ExpressRouteCircuitPropertiesFormat struct { + // Allow classic operations. + AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` + + // The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // The list of authorizations. + Authorizations []*ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` + + // The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. + BandwidthInGbps *float32 `json:"bandwidthInGbps,omitempty"` + + // The CircuitProvisioningState state of the resource. + CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` + + // The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. + ExpressRoutePort *SubResource `json:"expressRoutePort,omitempty"` + + // The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + + // Flag denoting global reach status. + GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"` + + // The list of peerings. + Peerings []*ExpressRouteCircuitPeering `json:"peerings,omitempty"` + + // The ServiceKey. + ServiceKey *string `json:"serviceKey,omitempty"` + + // The ServiceProviderNotes. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + + // The ServiceProviderProperties. + ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` + + // The ServiceProviderProvisioningState state of the resource. + ServiceProviderProvisioningState *ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + + // READ-ONLY; The provisioning state of the express route circuit resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The identifier of the circuit traffic. Outer tag for QinQ encapsulation. + Stag *int32 `json:"stag,omitempty" azure:"ro"` +} + +// ExpressRouteCircuitReference - Reference to an express route circuit. +type ExpressRouteCircuitReference struct { + // Corresponding Express Route Circuit Id. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitRoutesTable - The routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTable struct { + // Local preference value as set with the set local-preference route-map configuration command. + LocPrf *string `json:"locPrf,omitempty"` + + // IP address of a network entity. + Network *string `json:"network,omitempty"` + + // NextHop address. + NextHop *string `json:"nextHop,omitempty"` + + // Autonomous system paths to the destination network. + Path *string `json:"path,omitempty"` + + // Route Weight. + Weight *int32 `json:"weight,omitempty"` +} + +// ExpressRouteCircuitRoutesTableSummary - The routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTableSummary struct { + // Autonomous system number. + As *int32 `json:"as,omitempty"` + + // IP address of the neighbor. + Neighbor *string `json:"neighbor,omitempty"` + + // Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StatePfxRcd *string `json:"statePfxRcd,omitempty"` + + // The length of time that the BGP session has been in the Established state, or the current status if not in the Established + // state. + UpDown *string `json:"upDown,omitempty"` + + // BGP version number spoken to the neighbor. + V *int32 `json:"v,omitempty"` +} + +// ExpressRouteCircuitSKU - Contains SKU in an ExpressRouteCircuit. +type ExpressRouteCircuitSKU struct { + // The family of the SKU. + Family *ExpressRouteCircuitSKUFamily `json:"family,omitempty"` + + // The name of the SKU. + Name *string `json:"name,omitempty"` + + // The tier of the SKU. + Tier *ExpressRouteCircuitSKUTier `json:"tier,omitempty"` +} + +// ExpressRouteCircuitServiceProviderProperties - Contains ServiceProviderProperties in an ExpressRouteCircuit. +type ExpressRouteCircuitServiceProviderProperties struct { + // The BandwidthInMbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` + + // The peering location. + PeeringLocation *string `json:"peeringLocation,omitempty"` + + // The serviceProviderName. + ServiceProviderName *string `json:"serviceProviderName,omitempty"` +} + +// ExpressRouteCircuitStats - Contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + // The Primary BytesIn of the peering. + PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` + + // The primary BytesOut of the peering. + PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` + + // The secondary BytesIn of the peering. + SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` + + // The secondary BytesOut of the peering. + SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` +} + +// ExpressRouteCircuitsArpTableListResult - Response for ListArpTable associated with the Express Route Circuits API. +type ExpressRouteCircuitsArpTableListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of the ARP tables. + Value []*ExpressRouteCircuitArpTable `json:"value,omitempty"` +} + +// ExpressRouteCircuitsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCircuitsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginDelete +// method. +type ExpressRouteCircuitsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitsClientBeginListArpTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListArpTable +// method. +type ExpressRouteCircuitsClientBeginListArpTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitsClientBeginListRoutesTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTable +// method. +type ExpressRouteCircuitsClientBeginListRoutesTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTableSummary +// method. +type ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCircuitsClientGetOptions contains the optional parameters for the ExpressRouteCircuitsClient.Get method. +type ExpressRouteCircuitsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientGetPeeringStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetPeeringStats +// method. +type ExpressRouteCircuitsClientGetPeeringStatsOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientGetStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetStats +// method. +type ExpressRouteCircuitsClientGetStatsOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientListAllOptions contains the optional parameters for the ExpressRouteCircuitsClient.ListAll method. +type ExpressRouteCircuitsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientListOptions contains the optional parameters for the ExpressRouteCircuitsClient.List method. +type ExpressRouteCircuitsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsClientUpdateTagsOptions contains the optional parameters for the ExpressRouteCircuitsClient.UpdateTags +// method. +type ExpressRouteCircuitsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCircuitsRoutesTableListResult - Response for ListRoutesTable associated with the Express Route Circuits API. +type ExpressRouteCircuitsRoutesTableListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of routes table. + Value []*ExpressRouteCircuitRoutesTable `json:"value,omitempty"` +} + +// ExpressRouteCircuitsRoutesTableSummaryListResult - Response for ListRoutesTable associated with the Express Route Circuits +// API. +type ExpressRouteCircuitsRoutesTableSummaryListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of the routes table. + Value []*ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` +} + +// ExpressRouteConnection resource. +type ExpressRouteConnection struct { + // REQUIRED; The name of the resource. + Name *string `json:"name,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the express route connection. + Properties *ExpressRouteConnectionProperties `json:"properties,omitempty"` +} + +// ExpressRouteConnectionID - The ID of the ExpressRouteConnection. +type ExpressRouteConnectionID struct { + // READ-ONLY; The ID of the ExpressRouteConnection. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// ExpressRouteConnectionList - ExpressRouteConnection list. +type ExpressRouteConnectionList struct { + // The list of ExpressRoute connections. + Value []*ExpressRouteConnection `json:"value,omitempty"` +} + +// ExpressRouteConnectionProperties - Properties of the ExpressRouteConnection subresource. +type ExpressRouteConnectionProperties struct { + // REQUIRED; The ExpressRoute circuit peering. + ExpressRouteCircuitPeering *ExpressRouteCircuitPeeringID `json:"expressRouteCircuitPeering,omitempty"` + + // Authorization key to establish the connection. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` + + // Enable FastPath to vWan Firewall hub. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + + // The routing weight associated to the connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + + // READ-ONLY; The provisioning state of the express route connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRouteConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteConnectionsClient.BeginCreateOrUpdate +// method. +type ExpressRouteConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteConnectionsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteConnectionsClient.BeginDelete +// method. +type ExpressRouteConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteConnectionsClientGetOptions contains the optional parameters for the ExpressRouteConnectionsClient.Get method. +type ExpressRouteConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteConnectionsClientListOptions contains the optional parameters for the ExpressRouteConnectionsClient.List method. +type ExpressRouteConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnection resource. +type ExpressRouteCrossConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the express route cross connection. + Properties *ExpressRouteCrossConnectionProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionListResult - Response for ListExpressRouteCrossConnection API service call. +type ExpressRouteCrossConnectionListResult struct { + // A list of ExpressRouteCrossConnection resources. + Value []*ExpressRouteCrossConnection `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionPeering - Peering in an ExpressRoute Cross Connection resource. +type ExpressRouteCrossConnectionPeering struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the express route cross connection peering. + Properties *ExpressRouteCrossConnectionPeeringProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionPeeringList - Response for ListPeering API service call retrieves all peerings that belong to +// an ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionPeeringList struct { + // The peerings in an express route cross connection. + Value []*ExpressRouteCrossConnectionPeering `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionPeeringProperties - Properties of express route cross connection peering. +type ExpressRouteCrossConnectionPeeringProperties struct { + // The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + + // The IPv6 peering configuration. + IPv6PeeringConfig *IPv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` + + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + + // The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + + // The peering type. + PeeringType *ExpressRoutePeeringType `json:"peeringType,omitempty"` + + // The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + + // The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + + // The peering state. + State *ExpressRoutePeeringState `json:"state,omitempty"` + + // The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + + // READ-ONLY; The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty" azure:"ro"` + + // READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty" azure:"ro"` + + // READ-ONLY; The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route cross connection peering resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCrossConnectionPeeringsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.BeginDelete +// method. +type ExpressRouteCrossConnectionPeeringsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionPeeringsClientGetOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.Get +// method. +type ExpressRouteCrossConnectionPeeringsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionPeeringsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionPeeringsClient.List +// method. +type ExpressRouteCrossConnectionPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionProperties - Properties of ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionProperties struct { + // The ExpressRouteCircuit. + ExpressRouteCircuit *ExpressRouteCircuitReference `json:"expressRouteCircuit,omitempty"` + + // The list of peerings. + Peerings []*ExpressRouteCrossConnectionPeering `json:"peerings,omitempty"` + + // Additional read only notes set by the connectivity provider. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + + // The provisioning state of the circuit in the connectivity provider system. + ServiceProviderProvisioningState *ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + + // READ-ONLY; The circuit bandwidth In Mbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty" azure:"ro"` + + // READ-ONLY; The peering location of the ExpressRoute circuit. + PeeringLocation *string `json:"peeringLocation,omitempty" azure:"ro"` + + // READ-ONLY; The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route cross connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The identifier of the circuit traffic. + STag *int32 `json:"sTag,omitempty" azure:"ro"` + + // READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty" azure:"ro"` +} + +// ExpressRouteCrossConnectionRoutesTableSummary - The routes table associated with the ExpressRouteCircuit. +type ExpressRouteCrossConnectionRoutesTableSummary struct { + // Autonomous system number. + Asn *int32 `json:"asn,omitempty"` + + // IP address of Neighbor router. + Neighbor *string `json:"neighbor,omitempty"` + + // Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StateOrPrefixesReceived *string `json:"stateOrPrefixesReceived,omitempty"` + + // The length of time that the BGP session has been in the Established state, or the current status if not in the Established + // state. + UpDown *string `json:"upDown,omitempty"` +} + +// ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginCreateOrUpdate +// method. +type ExpressRouteCrossConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionsClientBeginListArpTableOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginListArpTable +// method. +type ExpressRouteCrossConnectionsClientBeginListArpTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginListRoutesTable +// method. +type ExpressRouteCrossConnectionsClientBeginListRoutesTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.BeginListRoutesTableSummary +// method. +type ExpressRouteCrossConnectionsClientBeginListRoutesTableSummaryOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteCrossConnectionsClientGetOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.Get +// method. +type ExpressRouteCrossConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionsClientListByResourceGroupOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.ListByResourceGroup +// method. +type ExpressRouteCrossConnectionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionsClientListOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.List +// method. +type ExpressRouteCrossConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionsClientUpdateTagsOptions contains the optional parameters for the ExpressRouteCrossConnectionsClient.UpdateTags +// method. +type ExpressRouteCrossConnectionsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteCrossConnectionsRoutesTableSummaryListResult - Response for ListRoutesTable associated with the Express Route +// Cross Connections. +type ExpressRouteCrossConnectionsRoutesTableSummaryListResult struct { + // A list of the routes table. + Value []*ExpressRouteCrossConnectionRoutesTableSummary `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ExpressRouteGateway - ExpressRoute gateway resource. +type ExpressRouteGateway struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the express route gateway. + Properties *ExpressRouteGatewayProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteGatewayList - List of ExpressRoute gateways. +type ExpressRouteGatewayList struct { + // List of ExpressRoute gateways. + Value []*ExpressRouteGateway `json:"value,omitempty"` +} + +// ExpressRouteGatewayProperties - ExpressRoute gateway resource properties. +type ExpressRouteGatewayProperties struct { + // REQUIRED; The Virtual Hub where the ExpressRoute gateway is or will be deployed. + VirtualHub *VirtualHubID `json:"virtualHub,omitempty"` + + // Configures this gateway to accept traffic from non Virtual WAN networks. + AllowNonVirtualWanTraffic *bool `json:"allowNonVirtualWanTraffic,omitempty"` + + // Configuration for auto scaling. + AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration `json:"autoScaleConfiguration,omitempty"` + + // List of ExpressRoute connections to the ExpressRoute gateway. + ExpressRouteConnections []*ExpressRouteConnection `json:"expressRouteConnections,omitempty"` + + // READ-ONLY; The provisioning state of the express route gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRouteGatewayPropertiesAutoScaleConfiguration - Configuration for auto scaling. +type ExpressRouteGatewayPropertiesAutoScaleConfiguration struct { + // Minimum and maximum number of scale units to deploy. + Bounds *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds `json:"bounds,omitempty"` +} + +// ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds - Minimum and maximum number of scale units to deploy. +type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds struct { + // Maximum number of scale units deployed for ExpressRoute gateway. + Max *int32 `json:"max,omitempty"` + + // Minimum number of scale units deployed for ExpressRoute gateway. + Min *int32 `json:"min,omitempty"` +} + +// ExpressRouteGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginCreateOrUpdate +// method. +type ExpressRouteGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteGatewaysClientBeginDeleteOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginDelete +// method. +type ExpressRouteGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the ExpressRouteGatewaysClient.BeginUpdateTags +// method. +type ExpressRouteGatewaysClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRouteGatewaysClientGetOptions contains the optional parameters for the ExpressRouteGatewaysClient.Get method. +type ExpressRouteGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteGatewaysClientListByResourceGroupOptions contains the optional parameters for the ExpressRouteGatewaysClient.ListByResourceGroup +// method. +type ExpressRouteGatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteGatewaysClientListBySubscriptionOptions contains the optional parameters for the ExpressRouteGatewaysClient.ListBySubscription +// method. +type ExpressRouteGatewaysClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteLink child resource definition. +type ExpressRouteLink struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of child port resource that is unique among child port resources of the parent. + Name *string `json:"name,omitempty"` + + // ExpressRouteLink properties. + Properties *ExpressRouteLinkPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// ExpressRouteLinkListResult - Response for ListExpressRouteLinks API service call. +type ExpressRouteLinkListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of ExpressRouteLink sub-resources. + Value []*ExpressRouteLink `json:"value,omitempty"` +} + +// ExpressRouteLinkMacSecConfig - ExpressRouteLink Mac Security Configuration. +type ExpressRouteLinkMacSecConfig struct { + // Keyvault Secret Identifier URL containing Mac security CAK key. + CakSecretIdentifier *string `json:"cakSecretIdentifier,omitempty"` + + // Mac security cipher. + Cipher *ExpressRouteLinkMacSecCipher `json:"cipher,omitempty"` + + // Keyvault Secret Identifier URL containing Mac security CKN key. + CknSecretIdentifier *string `json:"cknSecretIdentifier,omitempty"` + + // Sci mode enabled/disabled. + SciState *ExpressRouteLinkMacSecSciState `json:"sciState,omitempty"` +} + +// ExpressRouteLinkPropertiesFormat - Properties specific to ExpressRouteLink resources. +type ExpressRouteLinkPropertiesFormat struct { + // Administrative state of the physical port. + AdminState *ExpressRouteLinkAdminState `json:"adminState,omitempty"` + + // MacSec configuration. + MacSecConfig *ExpressRouteLinkMacSecConfig `json:"macSecConfig,omitempty"` + + // READ-ONLY; Cololocation for ExpressRoute Hybrid Direct. + ColoLocation *string `json:"coloLocation,omitempty" azure:"ro"` + + // READ-ONLY; Physical fiber port type. + ConnectorType *ExpressRouteLinkConnectorType `json:"connectorType,omitempty" azure:"ro"` + + // READ-ONLY; Name of Azure router interface. + InterfaceName *string `json:"interfaceName,omitempty" azure:"ro"` + + // READ-ONLY; Mapping between physical port to patch panel port. + PatchPanelID *string `json:"patchPanelId,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route link resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Mapping of physical patch panel to rack. + RackID *string `json:"rackId,omitempty" azure:"ro"` + + // READ-ONLY; Name of Azure router associated with physical port. + RouterName *string `json:"routerName,omitempty" azure:"ro"` +} + +// ExpressRouteLinksClientGetOptions contains the optional parameters for the ExpressRouteLinksClient.Get method. +type ExpressRouteLinksClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteLinksClientListOptions contains the optional parameters for the ExpressRouteLinksClient.List method. +type ExpressRouteLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePort resource definition. +type ExpressRoutePort struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The identity of ExpressRoutePort, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // ExpressRoutePort properties. + Properties *ExpressRoutePortPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRoutePortAuthorization - ExpressRoutePort Authorization resource definition. +type ExpressRoutePortAuthorization struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // ExpressRoutePort properties. + Properties *ExpressRoutePortAuthorizationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRoutePortAuthorizationListResult - Response for ListExpressRoutePortAuthorizations API service call. +type ExpressRoutePortAuthorizationListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The authorizations in an ExpressRoute Port. + Value []*ExpressRoutePortAuthorization `json:"value,omitempty"` +} + +// ExpressRoutePortAuthorizationPropertiesFormat - Properties of ExpressRoutePort Authorization. +type ExpressRoutePortAuthorizationPropertiesFormat struct { + // READ-ONLY; The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty" azure:"ro"` + + // READ-ONLY; The authorization use status. + AuthorizationUseStatus *ExpressRoutePortAuthorizationUseStatus `json:"authorizationUseStatus,omitempty" azure:"ro"` + + // READ-ONLY; The reference to the ExpressRoute circuit resource using the authorization. + CircuitResourceURI *string `json:"circuitResourceUri,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the authorization resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.BeginCreateOrUpdate +// method. +type ExpressRoutePortAuthorizationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRoutePortAuthorizationsClientBeginDeleteOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.BeginDelete +// method. +type ExpressRoutePortAuthorizationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRoutePortAuthorizationsClientGetOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.Get +// method. +type ExpressRoutePortAuthorizationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortAuthorizationsClientListOptions contains the optional parameters for the ExpressRoutePortAuthorizationsClient.List +// method. +type ExpressRoutePortAuthorizationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortListResult - Response for ListExpressRoutePorts API service call. +type ExpressRoutePortListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of ExpressRoutePort resources. + Value []*ExpressRoutePort `json:"value,omitempty"` +} + +// ExpressRoutePortPropertiesFormat - Properties specific to ExpressRoutePort resources. +type ExpressRoutePortPropertiesFormat struct { + // Bandwidth of procured ports in Gbps. + BandwidthInGbps *int32 `json:"bandwidthInGbps,omitempty"` + + // The billing type of the ExpressRoutePort resource. + BillingType *ExpressRoutePortsBillingType `json:"billingType,omitempty"` + + // Encapsulation method on physical ports. + Encapsulation *ExpressRoutePortsEncapsulation `json:"encapsulation,omitempty"` + + // The set of physical links of the ExpressRoutePort resource. + Links []*ExpressRouteLink `json:"links,omitempty"` + + // The name of the peering location that the ExpressRoutePort is mapped to physically. + PeeringLocation *string `json:"peeringLocation,omitempty"` + + // READ-ONLY; Date of the physical port allocation to be used in Letter of Authorization. + AllocationDate *string `json:"allocationDate,omitempty" azure:"ro"` + + // READ-ONLY; Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. + Circuits []*SubResource `json:"circuits,omitempty" azure:"ro"` + + // READ-ONLY; Ether type of the physical port. + EtherType *string `json:"etherType,omitempty" azure:"ro"` + + // READ-ONLY; Maximum transmission unit of the physical port pair(s). + Mtu *string `json:"mtu,omitempty" azure:"ro"` + + // READ-ONLY; Aggregate Gbps of associated circuit bandwidths. + ProvisionedBandwidthInGbps *float32 `json:"provisionedBandwidthInGbps,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route port resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the express route port resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// ExpressRoutePortsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRoutePortsClient.BeginCreateOrUpdate +// method. +type ExpressRoutePortsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRoutePortsClientBeginDeleteOptions contains the optional parameters for the ExpressRoutePortsClient.BeginDelete +// method. +type ExpressRoutePortsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExpressRoutePortsClientGenerateLOAOptions contains the optional parameters for the ExpressRoutePortsClient.GenerateLOA +// method. +type ExpressRoutePortsClientGenerateLOAOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsClientGetOptions contains the optional parameters for the ExpressRoutePortsClient.Get method. +type ExpressRoutePortsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsClientListByResourceGroupOptions contains the optional parameters for the ExpressRoutePortsClient.ListByResourceGroup +// method. +type ExpressRoutePortsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsClientListOptions contains the optional parameters for the ExpressRoutePortsClient.List method. +type ExpressRoutePortsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsClientUpdateTagsOptions contains the optional parameters for the ExpressRoutePortsClient.UpdateTags method. +type ExpressRoutePortsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsLocation - Definition of the ExpressRoutePorts peering location resource. +type ExpressRoutePortsLocation struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // ExpressRoutePort peering location properties. + Properties *ExpressRoutePortsLocationPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRoutePortsLocationBandwidths - Real-time inventory of available ExpressRoute port bandwidths. +type ExpressRoutePortsLocationBandwidths struct { + // READ-ONLY; Bandwidth descriptive name. + OfferName *string `json:"offerName,omitempty" azure:"ro"` + + // READ-ONLY; Bandwidth value in Gbps. + ValueInGbps *int32 `json:"valueInGbps,omitempty" azure:"ro"` +} + +// ExpressRoutePortsLocationListResult - Response for ListExpressRoutePortsLocations API service call. +type ExpressRoutePortsLocationListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of all ExpressRoutePort peering locations. + Value []*ExpressRoutePortsLocation `json:"value,omitempty"` +} + +// ExpressRoutePortsLocationPropertiesFormat - Properties specific to ExpressRoutePorts peering location resources. +type ExpressRoutePortsLocationPropertiesFormat struct { + // The inventory of available ExpressRoutePort bandwidths. + AvailableBandwidths []*ExpressRoutePortsLocationBandwidths `json:"availableBandwidths,omitempty"` + + // READ-ONLY; Address of peering location. + Address *string `json:"address,omitempty" azure:"ro"` + + // READ-ONLY; Contact details of peering locations. + Contact *string `json:"contact,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the express route port location resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRoutePortsLocationsClientGetOptions contains the optional parameters for the ExpressRoutePortsLocationsClient.Get +// method. +type ExpressRoutePortsLocationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExpressRoutePortsLocationsClientListOptions contains the optional parameters for the ExpressRoutePortsLocationsClient.List +// method. +type ExpressRoutePortsLocationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExpressRouteProviderPort resource. +type ExpressRouteProviderPort struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the express route Service Provider Port. + Properties *ExpressRouteProviderPortProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteProviderPortListResult - Response for ListExpressRouteProviderPort API service call. +type ExpressRouteProviderPortListResult struct { + // A list of ExpressRouteProviderPort resources. + Value []*ExpressRouteProviderPort `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ExpressRouteProviderPortProperties - Properties of ExpressRouteProviderPort. +type ExpressRouteProviderPortProperties struct { + // Overprovisioning factor for the port pair. + OverprovisionFactor *int32 `json:"overprovisionFactor,omitempty"` + + // The peering location of the port pair. + PeeringLocation *string `json:"peeringLocation,omitempty"` + + // Bandwidth of the port in Mbps + PortBandwidthInMbps *int32 `json:"portBandwidthInMbps,omitempty"` + + // Remaining Bandwidth of the port in Mbps + RemainingBandwidthInMbps *int32 `json:"remainingBandwidthInMbps,omitempty"` + + // Used Bandwidth of the port in Mbps + UsedBandwidthInMbps *int32 `json:"usedBandwidthInMbps,omitempty"` + + // READ-ONLY; The name of the port pair. + PortPairDescriptor *string `json:"portPairDescriptor,omitempty" azure:"ro"` + + // READ-ONLY; The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty" azure:"ro"` + + // READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty" azure:"ro"` +} + +// ExpressRouteProviderPortsLocationClientListOptions contains the optional parameters for the ExpressRouteProviderPortsLocationClient.List +// method. +type ExpressRouteProviderPortsLocationClientListOptions struct { + // The filter to apply on the operation. For example, you can use $filter=location eq '{state}'. + Filter *string +} + +// ExpressRouteServiceProvider - A ExpressRouteResourceProvider object. +type ExpressRouteServiceProvider struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the express route service provider. + Properties *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExpressRouteServiceProviderBandwidthsOffered - Contains bandwidths offered in ExpressRouteServiceProvider resources. +type ExpressRouteServiceProviderBandwidthsOffered struct { + // The OfferName. + OfferName *string `json:"offerName,omitempty"` + + // The ValueInMbps. + ValueInMbps *int32 `json:"valueInMbps,omitempty"` +} + +// ExpressRouteServiceProviderListResult - Response for the ListExpressRouteServiceProvider API service call. +type ExpressRouteServiceProviderListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of ExpressRouteResourceProvider resources. + Value []*ExpressRouteServiceProvider `json:"value,omitempty"` +} + +// ExpressRouteServiceProviderPropertiesFormat - Properties of ExpressRouteServiceProvider. +type ExpressRouteServiceProviderPropertiesFormat struct { + // A list of bandwidths offered. + BandwidthsOffered []*ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` + + // A list of peering locations. + PeeringLocations []*string `json:"peeringLocations,omitempty"` + + // READ-ONLY; The provisioning state of the express route service provider resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ExpressRouteServiceProvidersClientListOptions contains the optional parameters for the ExpressRouteServiceProvidersClient.List +// method. +type ExpressRouteServiceProvidersClientListOptions struct { + // placeholder for future optional parameters +} + +// ExtendedLocation complex type. +type ExtendedLocation struct { + // The name of the extended location. + Name *string `json:"name,omitempty"` + + // The type of the extended location. + Type *ExtendedLocationTypes `json:"type,omitempty"` +} + +// FilterItems - Will contain the filter name and values to operate on +type FilterItems struct { + // The name of the field we would like to filter + Field *string `json:"field,omitempty"` + + // List of values to filter the current field by + Values []*string `json:"values,omitempty"` +} + +// FirewallPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallPoliciesClient.BeginCreateOrUpdate +// method. +type FirewallPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallPoliciesClientBeginDeleteOptions contains the optional parameters for the FirewallPoliciesClient.BeginDelete method. +type FirewallPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallPoliciesClientGetOptions contains the optional parameters for the FirewallPoliciesClient.Get method. +type FirewallPoliciesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// FirewallPoliciesClientListAllOptions contains the optional parameters for the FirewallPoliciesClient.ListAll method. +type FirewallPoliciesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// FirewallPoliciesClientListOptions contains the optional parameters for the FirewallPoliciesClient.List method. +type FirewallPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPoliciesClientUpdateTagsOptions contains the optional parameters for the FirewallPoliciesClient.UpdateTags method. +type FirewallPoliciesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicy Resource. +type FirewallPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The identity of the firewall policy. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the firewall policy. + Properties *FirewallPolicyPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FirewallPolicyCertificateAuthority - Trusted Root certificates properties for tls. +type FirewallPolicyCertificateAuthority struct { + // Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + + // Name of the CA certificate. + Name *string `json:"name,omitempty"` +} + +// FirewallPolicyFilterRuleCollection - Firewall Policy Filter Rule Collection. +type FirewallPolicyFilterRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType `json:"ruleCollectionType,omitempty"` + + // The action type of a Filter rule collection. + Action *FirewallPolicyFilterRuleCollectionAction `json:"action,omitempty"` + + // The name of the rule collection. + Name *string `json:"name,omitempty"` + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + + // List of rules included in a rule collection. + Rules []FirewallPolicyRuleClassification `json:"rules,omitempty"` +} + +// GetFirewallPolicyRuleCollection implements the FirewallPolicyRuleCollectionClassification interface for type FirewallPolicyFilterRuleCollection. +func (f *FirewallPolicyFilterRuleCollection) GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection { + return &FirewallPolicyRuleCollection{ + RuleCollectionType: f.RuleCollectionType, + Name: f.Name, + Priority: f.Priority, + } +} + +// FirewallPolicyFilterRuleCollectionAction - Properties of the FirewallPolicyFilterRuleCollectionAction. +type FirewallPolicyFilterRuleCollectionAction struct { + // The type of action. + Type *FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyIdpsSignaturesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesClient.List +// method. +type FirewallPolicyIdpsSignaturesClientListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesFilterValuesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesFilterValuesClient.List +// method. +type FirewallPolicyIdpsSignaturesFilterValuesClientListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesClientGetOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Get +// method. +type FirewallPolicyIdpsSignaturesOverridesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesClientListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.List +// method. +type FirewallPolicyIdpsSignaturesOverridesClientListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesClientPatchOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Patch +// method. +type FirewallPolicyIdpsSignaturesOverridesClientPatchOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesClientPutOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverridesClient.Put +// method. +type FirewallPolicyIdpsSignaturesOverridesClientPutOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyInsights - Firewall Policy Insights. +type FirewallPolicyInsights struct { + // A flag to indicate if the insights are enabled on the policy. + IsEnabled *bool `json:"isEnabled,omitempty"` + + // Workspaces needed to configure the Firewall Policy Insights. + LogAnalyticsResources *FirewallPolicyLogAnalyticsResources `json:"logAnalyticsResources,omitempty"` + + // Number of days the insights should be enabled on the policy. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + +// FirewallPolicyIntrusionDetection - Configuration for intrusion detection mode and rules. +type FirewallPolicyIntrusionDetection struct { + // Intrusion detection configuration properties. + Configuration *FirewallPolicyIntrusionDetectionConfiguration `json:"configuration,omitempty"` + + // Intrusion detection general state. + Mode *FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` +} + +// FirewallPolicyIntrusionDetectionBypassTrafficSpecifications - Intrusion detection bypass traffic specification. +type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct { + // Description of the bypass traffic rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses or ranges for this rule. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string `json:"destinationIpGroups,omitempty"` + + // List of destination ports or ranges. + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Name of the bypass traffic rule. + Name *string `json:"name,omitempty"` + + // The rule bypass protocol. + Protocol *FirewallPolicyIntrusionDetectionProtocol `json:"protocol,omitempty"` + + // List of source IP addresses or ranges for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` +} + +// FirewallPolicyIntrusionDetectionConfiguration - The operation for configuring intrusion detection. +type FirewallPolicyIntrusionDetectionConfiguration struct { + // List of rules for traffic to bypass. + BypassTrafficSettings []*FirewallPolicyIntrusionDetectionBypassTrafficSpecifications `json:"bypassTrafficSettings,omitempty"` + + // IDPS Private IP address ranges are used to identify traffic direction (i.e. inbound, outbound, etc.). By default, only + // ranges defined by IANA RFC 1918 are considered private IP addresses. To modify + // default ranges, specify your Private IP address ranges with this property + PrivateRanges []*string `json:"privateRanges,omitempty"` + + // List of specific signatures states. + SignatureOverrides []*FirewallPolicyIntrusionDetectionSignatureSpecification `json:"signatureOverrides,omitempty"` +} + +// FirewallPolicyIntrusionDetectionSignatureSpecification - Intrusion detection signatures specification states. +type FirewallPolicyIntrusionDetectionSignatureSpecification struct { + // Signature id. + ID *string `json:"id,omitempty"` + + // The signature state. + Mode *FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` +} + +// FirewallPolicyListResult - Response for ListFirewallPolicies API service call. +type FirewallPolicyListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Firewall Policies in a resource group. + Value []*FirewallPolicy `json:"value,omitempty"` +} + +// FirewallPolicyLogAnalyticsResources - Log Analytics Resources for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsResources struct { + // The default workspace Id for Firewall Policy Insights. + DefaultWorkspaceID *SubResource `json:"defaultWorkspaceId,omitempty"` + + // List of workspaces for Firewall Policy Insights. + Workspaces []*FirewallPolicyLogAnalyticsWorkspace `json:"workspaces,omitempty"` +} + +// FirewallPolicyLogAnalyticsWorkspace - Log Analytics Workspace for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsWorkspace struct { + // Region to configure the Workspace. + Region *string `json:"region,omitempty"` + + // The workspace Id for Firewall Policy Insights. + WorkspaceID *SubResource `json:"workspaceId,omitempty"` +} + +// FirewallPolicyNatRuleCollection - Firewall Policy NAT Rule Collection. +type FirewallPolicyNatRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType `json:"ruleCollectionType,omitempty"` + + // The action type of a Nat rule collection. + Action *FirewallPolicyNatRuleCollectionAction `json:"action,omitempty"` + + // The name of the rule collection. + Name *string `json:"name,omitempty"` + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + + // List of rules included in a rule collection. + Rules []FirewallPolicyRuleClassification `json:"rules,omitempty"` +} + +// GetFirewallPolicyRuleCollection implements the FirewallPolicyRuleCollectionClassification interface for type FirewallPolicyNatRuleCollection. +func (f *FirewallPolicyNatRuleCollection) GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection { + return &FirewallPolicyRuleCollection{ + RuleCollectionType: f.RuleCollectionType, + Name: f.Name, + Priority: f.Priority, + } +} + +// FirewallPolicyNatRuleCollectionAction - Properties of the FirewallPolicyNatRuleCollectionAction. +type FirewallPolicyNatRuleCollectionAction struct { + // The type of action. + Type *FirewallPolicyNatRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyPropertiesFormat - Firewall Policy definition. +type FirewallPolicyPropertiesFormat struct { + // The parent firewall policy from which rules are inherited. + BasePolicy *SubResource `json:"basePolicy,omitempty"` + + // DNS Proxy Settings definition. + DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` + + // Explicit Proxy Settings definition. + ExplicitProxySettings *ExplicitProxySettings `json:"explicitProxySettings,omitempty"` + + // Insights on Firewall Policy. + Insights *FirewallPolicyInsights `json:"insights,omitempty"` + + // The configuration for Intrusion detection. + IntrusionDetection *FirewallPolicyIntrusionDetection `json:"intrusionDetection,omitempty"` + + // The Firewall Policy SKU. + SKU *FirewallPolicySKU `json:"sku,omitempty"` + + // SQL Settings definition. + SQL *FirewallPolicySQL `json:"sql,omitempty"` + + // The private IP addresses/IP ranges to which traffic will not be SNAT. + Snat *FirewallPolicySNAT `json:"snat,omitempty"` + + // The operation mode for Threat Intelligence. + ThreatIntelMode *AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + + // ThreatIntel Whitelist for Firewall Policy. + ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist `json:"threatIntelWhitelist,omitempty"` + + // TLS Configuration definition. + TransportSecurity *FirewallPolicyTransportSecurity `json:"transportSecurity,omitempty"` + + // READ-ONLY; List of references to Child Firewall Policies. + ChildPolicies []*SubResource `json:"childPolicies,omitempty" azure:"ro"` + + // READ-ONLY; List of references to Azure Firewalls that this Firewall Policy is associated with. + Firewalls []*SubResource `json:"firewalls,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the firewall policy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; List of references to FirewallPolicyRuleCollectionGroups. + RuleCollectionGroups []*SubResource `json:"ruleCollectionGroups,omitempty" azure:"ro"` +} + +// FirewallPolicyRuleClassification provides polymorphic access to related types. +// Call the interface's GetFirewallPolicyRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ApplicationRule, *FirewallPolicyRule, *NatRule, *Rule +type FirewallPolicyRuleClassification interface { + // GetFirewallPolicyRule returns the FirewallPolicyRule content of the underlying type. + GetFirewallPolicyRule() *FirewallPolicyRule +} + +// FirewallPolicyRule - Properties of a rule. +type FirewallPolicyRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType `json:"ruleType,omitempty"` + + // Description of the rule. + Description *string `json:"description,omitempty"` + + // Name of the rule. + Name *string `json:"name,omitempty"` +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type FirewallPolicyRule. +func (f *FirewallPolicyRule) GetFirewallPolicyRule() *FirewallPolicyRule { return f } + +// FirewallPolicyRuleApplicationProtocol - Properties of the application rule protocol. +type FirewallPolicyRuleApplicationProtocol struct { + // Port number for the protocol, cannot be greater than 64000. + Port *int32 `json:"port,omitempty"` + + // Protocol type. + ProtocolType *FirewallPolicyRuleApplicationProtocolType `json:"protocolType,omitempty"` +} + +// FirewallPolicyRuleCollectionClassification provides polymorphic access to related types. +// Call the interface's GetFirewallPolicyRuleCollection() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FirewallPolicyFilterRuleCollection, *FirewallPolicyNatRuleCollection, *FirewallPolicyRuleCollection +type FirewallPolicyRuleCollectionClassification interface { + // GetFirewallPolicyRuleCollection returns the FirewallPolicyRuleCollection content of the underlying type. + GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection +} + +// FirewallPolicyRuleCollection - Properties of the rule collection. +type FirewallPolicyRuleCollection struct { + // REQUIRED; The type of the rule collection. + RuleCollectionType *FirewallPolicyRuleCollectionType `json:"ruleCollectionType,omitempty"` + + // The name of the rule collection. + Name *string `json:"name,omitempty"` + + // Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` +} + +// GetFirewallPolicyRuleCollection implements the FirewallPolicyRuleCollectionClassification interface for type FirewallPolicyRuleCollection. +func (f *FirewallPolicyRuleCollection) GetFirewallPolicyRuleCollection() *FirewallPolicyRuleCollection { + return f +} + +// FirewallPolicyRuleCollectionGroup - Rule Collection Group resource. +type FirewallPolicyRuleCollectionGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // The properties of the firewall policy rule collection group. + Properties *FirewallPolicyRuleCollectionGroupProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Rule Group type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FirewallPolicyRuleCollectionGroupListResult - Response for ListFirewallPolicyRuleCollectionGroups API service call. +type FirewallPolicyRuleCollectionGroupListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + Value []*FirewallPolicyRuleCollectionGroup `json:"value,omitempty"` +} + +// FirewallPolicyRuleCollectionGroupProperties - Properties of the rule collection group. +type FirewallPolicyRuleCollectionGroupProperties struct { + // Priority of the Firewall Policy Rule Collection Group resource. + Priority *int32 `json:"priority,omitempty"` + + // Group of Firewall Policy rule collections. + RuleCollections []FirewallPolicyRuleCollectionClassification `json:"ruleCollections,omitempty"` + + // READ-ONLY; The provisioning state of the firewall policy rule collection group resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.BeginCreateOrUpdate +// method. +type FirewallPolicyRuleCollectionGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.BeginDelete +// method. +type FirewallPolicyRuleCollectionGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallPolicyRuleCollectionGroupsClientGetOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.Get +// method. +type FirewallPolicyRuleCollectionGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyRuleCollectionGroupsClientListOptions contains the optional parameters for the FirewallPolicyRuleCollectionGroupsClient.List +// method. +type FirewallPolicyRuleCollectionGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicySKU - SKU of Firewall policy. +type FirewallPolicySKU struct { + // Tier of Firewall Policy. + Tier *FirewallPolicySKUTier `json:"tier,omitempty"` +} + +// FirewallPolicySNAT - The private IP addresses/IP ranges to which traffic will not be SNAT. +type FirewallPolicySNAT struct { + // The operation mode for automatically learning private ranges to not be SNAT + AutoLearnPrivateRanges *AutoLearnPrivateRangesMode `json:"autoLearnPrivateRanges,omitempty"` + + // List of private IP addresses/IP address ranges to not be SNAT. + PrivateRanges []*string `json:"privateRanges,omitempty"` +} + +// FirewallPolicySQL - SQL Settings in Firewall Policy. +type FirewallPolicySQL struct { + // A flag to indicate if SQL Redirect traffic filtering is enabled. Turning on the flag requires no rule using port 11000-11999. + AllowSQLRedirect *bool `json:"allowSqlRedirect,omitempty"` +} + +// FirewallPolicyThreatIntelWhitelist - ThreatIntel Whitelist for Firewall Policy. +type FirewallPolicyThreatIntelWhitelist struct { + // List of FQDNs for the ThreatIntel Whitelist. + Fqdns []*string `json:"fqdns,omitempty"` + + // List of IP addresses for the ThreatIntel Whitelist. + IPAddresses []*string `json:"ipAddresses,omitempty"` +} + +// FirewallPolicyTransportSecurity - Configuration needed to perform TLS termination & initiation. +type FirewallPolicyTransportSecurity struct { + // The CA used for intermediate CA generation. + CertificateAuthority *FirewallPolicyCertificateAuthority `json:"certificateAuthority,omitempty"` +} + +// FlowLog - A flow log resource. +type FlowLog struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the flow log. + Properties *FlowLogPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FlowLogFormatParameters - Parameters that define the flow log format. +type FlowLogFormatParameters struct { + // The file type of flow log. + Type *FlowLogFormatType `json:"type,omitempty"` + + // The version (revision) of the flow log. + Version *int32 `json:"version,omitempty"` +} + +// FlowLogInformation - Information on the configuration of flow log and traffic analytics (optional) . +type FlowLogInformation struct { + // REQUIRED; Properties of the flow log. + Properties *FlowLogProperties `json:"properties,omitempty"` + + // REQUIRED; The ID of the resource to configure for flow log and traffic analytics (optional) . + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` +} + +// FlowLogListResult - List of flow logs. +type FlowLogListResult struct { + // Information about flow log resource. + Value []*FlowLog `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// FlowLogProperties - Parameters that define the configuration of flow log. +type FlowLogProperties struct { + // REQUIRED; Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + + // REQUIRED; ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + + // Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` + + // Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` +} + +// FlowLogPropertiesFormat - Parameters that define the configuration of flow log. +type FlowLogPropertiesFormat struct { + // REQUIRED; ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + + // REQUIRED; ID of network security group to which flow log will be applied. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + + // Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` + + // Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` + + // Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` + + // READ-ONLY; The provisioning state of the flow log. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Guid of network security group to which flow log will be applied. + TargetResourceGUID *string `json:"targetResourceGuid,omitempty" azure:"ro"` +} + +// FlowLogStatusParameters - Parameters that define a resource to query flow log and traffic analytics (optional) status. +type FlowLogStatusParameters struct { + // REQUIRED; The target resource where getting the flow log and traffic analytics (optional) status. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// FlowLogsClientBeginCreateOrUpdateOptions contains the optional parameters for the FlowLogsClient.BeginCreateOrUpdate method. +type FlowLogsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FlowLogsClientBeginDeleteOptions contains the optional parameters for the FlowLogsClient.BeginDelete method. +type FlowLogsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FlowLogsClientGetOptions contains the optional parameters for the FlowLogsClient.Get method. +type FlowLogsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FlowLogsClientListOptions contains the optional parameters for the FlowLogsClient.List method. +type FlowLogsClientListOptions struct { + // placeholder for future optional parameters +} + +// FlowLogsClientUpdateTagsOptions contains the optional parameters for the FlowLogsClient.UpdateTags method. +type FlowLogsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// FrontendIPConfiguration - Frontend IP address of the load balancer. +type FrontendIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name + // can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the load balancer probe. + Properties *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FrontendIPConfigurationPropertiesFormat - Properties of Frontend IP Configuration of the load balancer. +type FrontendIPConfigurationPropertiesFormat struct { + // The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + + // The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + + // The Private IP allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // The reference to the Public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + + // The reference to the Public IP Prefix resource. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + + // The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; An array of references to inbound pools that use this frontend IP. + InboundNatPools []*SubResource `json:"inboundNatPools,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to inbound rules that use this frontend IP. + InboundNatRules []*SubResource `json:"inboundNatRules,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to load balancing rules that use this frontend IP. + LoadBalancingRules []*SubResource `json:"loadBalancingRules,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to outbound rules that use this frontend IP. + OutboundRules []*SubResource `json:"outboundRules,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the frontend IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// GatewayCustomBgpIPAddressIPConfiguration - GatewayCustomBgpIpAddressIpConfiguration for a virtual network gateway connection. +type GatewayCustomBgpIPAddressIPConfiguration struct { + // REQUIRED; The custom BgpPeeringAddress which belongs to IpconfigurationId. + CustomBgpIPAddress *string `json:"customBgpIpAddress,omitempty"` + + // REQUIRED; The IpconfigurationId of ipconfiguration which belongs to gateway. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` +} + +// GatewayLoadBalancerTunnelInterface - Gateway load balancer tunnel interface of a load balancer backend address pool. +type GatewayLoadBalancerTunnelInterface struct { + // Identifier of gateway load balancer tunnel interface. + Identifier *int32 `json:"identifier,omitempty"` + + // Port of gateway load balancer tunnel interface. + Port *int32 `json:"port,omitempty"` + + // Protocol of gateway load balancer tunnel interface. + Protocol *GatewayLoadBalancerTunnelProtocol `json:"protocol,omitempty"` + + // Traffic type of gateway load balancer tunnel interface. + Type *GatewayLoadBalancerTunnelInterfaceType `json:"type,omitempty"` +} + +// GatewayRoute - Gateway routing details. +type GatewayRoute struct { + // READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty" azure:"ro"` + + // READ-ONLY; The gateway's local address. + LocalAddress *string `json:"localAddress,omitempty" azure:"ro"` + + // READ-ONLY; The route's network prefix. + Network *string `json:"network,omitempty" azure:"ro"` + + // READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty" azure:"ro"` + + // READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty" azure:"ro"` + + // READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty" azure:"ro"` + + // READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty" azure:"ro"` +} + +// GatewayRouteListResult - List of virtual network gateway routes. +type GatewayRouteListResult struct { + // List of gateway routes. + Value []*GatewayRoute `json:"value,omitempty"` +} + +// GenerateExpressRoutePortsLOARequest - The customer name to be printed on a letter of authorization. +type GenerateExpressRoutePortsLOARequest struct { + // REQUIRED; The customer name. + CustomerName *string `json:"customerName,omitempty"` +} + +// GenerateExpressRoutePortsLOAResult - Response for GenerateExpressRoutePortsLOA API service call. +type GenerateExpressRoutePortsLOAResult struct { + // The content as a base64 encoded string. + EncodedContent *string `json:"encodedContent,omitempty"` +} + +// GetInboundRoutesParameters - The parameters specifying the connection resource whose inbound routes are being requested. +type GetInboundRoutesParameters struct { + // The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and + // P2SConnection. + ConnectionType *string `json:"connectionType,omitempty"` + + // The connection resource whose inbound routes are being requested. + ResourceURI *string `json:"resourceUri,omitempty"` +} + +// GetOutboundRoutesParameters - The parameters specifying the connection resource whose outbound routes are being requested. +type GetOutboundRoutesParameters struct { + // The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and + // P2SConnection. + ConnectionType *string `json:"connectionType,omitempty"` + + // The connection resource whose outbound routes are being requested. + ResourceURI *string `json:"resourceUri,omitempty"` +} + +// GetVPNSitesConfigurationRequest - List of Vpn-Sites. +type GetVPNSitesConfigurationRequest struct { + // REQUIRED; The sas-url to download the configurations for vpn-sites. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` + + // List of resource-ids of the vpn-sites for which config is to be downloaded. + VPNSites []*string `json:"vpnSites,omitempty"` +} + +// Group - The network group resource +type Group struct { + // The Network Group properties + Properties *GroupProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GroupListResult - Result of the request to list NetworkGroup. It contains a list of groups and a URL link to get the next +// set of results. +type GroupListResult struct { + // Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // Gets a page of NetworkGroup + Value []*Group `json:"value,omitempty"` +} + +// GroupProperties - Properties of network group +type GroupProperties struct { + // A description of the network group. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The provisioning state of the scope assignment resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// GroupsClientBeginDeleteOptions contains the optional parameters for the GroupsClient.BeginDelete method. +type GroupsClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GroupsClientCreateOrUpdateOptions contains the optional parameters for the GroupsClient.CreateOrUpdate method. +type GroupsClientCreateOrUpdateOptions struct { + // The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value + // to prevent accidentally overwriting concurrent changes. + IfMatch *string +} + +// GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. +type GroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. +type GroupsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// HTTPConfiguration - HTTP configuration of the connectivity check. +type HTTPConfiguration struct { + // List of HTTP headers. + Headers []*HTTPHeader `json:"headers,omitempty"` + + // HTTP method. + Method *HTTPMethod `json:"method,omitempty"` + + // Valid status codes. + ValidStatusCodes []*int32 `json:"validStatusCodes,omitempty"` +} + +// HTTPHeader - The HTTP header. +type HTTPHeader struct { + // The name in HTTP header. + Name *string `json:"name,omitempty"` + + // The value in HTTP header. + Value *string `json:"value,omitempty"` +} + +// HopLink - Hop link. +type HopLink struct { + // Hop link properties. + Properties *HopLinkProperties `json:"properties,omitempty"` + + // READ-ONLY; Provides additional context on links. + Context map[string]*string `json:"context,omitempty" azure:"ro"` + + // READ-ONLY; List of issues. + Issues []*ConnectivityIssue `json:"issues,omitempty" azure:"ro"` + + // READ-ONLY; Link type. + LinkType *string `json:"linkType,omitempty" azure:"ro"` + + // READ-ONLY; The ID of the next hop. + NextHopID *string `json:"nextHopId,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ResourceID *string `json:"resourceId,omitempty" azure:"ro"` +} + +// HopLinkProperties - Hop link properties. +type HopLinkProperties struct { + // READ-ONLY; Average roundtrip time in milliseconds. + RoundTripTimeAvg *int64 `json:"roundTripTimeAvg,omitempty" azure:"ro"` + + // READ-ONLY; Maximum roundtrip time in milliseconds. + RoundTripTimeMax *int64 `json:"roundTripTimeMax,omitempty" azure:"ro"` + + // READ-ONLY; Minimum roundtrip time in milliseconds. + RoundTripTimeMin *int64 `json:"roundTripTimeMin,omitempty" azure:"ro"` +} + +// Hub Item. +type Hub struct { + // Resource Id. + ResourceID *string `json:"resourceId,omitempty"` + + // Resource Type. + ResourceType *string `json:"resourceType,omitempty"` +} + +// HubIPAddresses - IP addresses associated with azure firewall. +type HubIPAddresses struct { + // Private IP Address associated with azure firewall. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // Public IP addresses associated with azure firewall. + PublicIPs *HubPublicIPAddresses `json:"publicIPs,omitempty"` +} + +// HubIPConfiguration - IpConfigurations. +type HubIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the Ip Configuration. + Name *string `json:"name,omitempty"` + + // The properties of the Virtual Hub IPConfigurations. + Properties *HubIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Ipconfiguration type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// HubIPConfigurationPropertiesFormat - Properties of IP configuration. +type HubIPConfigurationPropertiesFormat struct { + // The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + + // The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// HubPublicIPAddresses - Public IP addresses associated with azure firewall. +type HubPublicIPAddresses struct { + // The list of Public IP addresses associated with azure firewall or IP addresses to be retained. + Addresses []*AzureFirewallPublicIPAddress `json:"addresses,omitempty"` + + // The number of Public IP addresses associated with azure firewall. + Count *int32 `json:"count,omitempty"` +} + +// HubRoute - RouteTable route. +type HubRoute struct { + // REQUIRED; The type of destinations (eg: CIDR, ResourceId, Service). + DestinationType *string `json:"destinationType,omitempty"` + + // REQUIRED; List of all destinations. + Destinations []*string `json:"destinations,omitempty"` + + // REQUIRED; The name of the Route that is unique within a RouteTable. This name can be used to access this route. + Name *string `json:"name,omitempty"` + + // REQUIRED; NextHop resource ID. + NextHop *string `json:"nextHop,omitempty"` + + // REQUIRED; The type of next hop (eg: ResourceId). + NextHopType *string `json:"nextHopType,omitempty"` +} + +// HubRouteTable - RouteTable resource in a virtual hub. +type HubRouteTable struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the RouteTable resource. + Properties *HubRouteTableProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// HubRouteTableProperties - Parameters for RouteTable. +type HubRouteTableProperties struct { + // List of labels associated with this route table. + Labels []*string `json:"labels,omitempty"` + + // List of all routes. + Routes []*HubRoute `json:"routes,omitempty"` + + // READ-ONLY; List of all connections associated with this route table. + AssociatedConnections []*string `json:"associatedConnections,omitempty" azure:"ro"` + + // READ-ONLY; List of all connections that advertise to this route table. + PropagatingConnections []*string `json:"propagatingConnections,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the RouteTable resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// HubRouteTablesClientBeginCreateOrUpdateOptions contains the optional parameters for the HubRouteTablesClient.BeginCreateOrUpdate +// method. +type HubRouteTablesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HubRouteTablesClientBeginDeleteOptions contains the optional parameters for the HubRouteTablesClient.BeginDelete method. +type HubRouteTablesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HubRouteTablesClientGetOptions contains the optional parameters for the HubRouteTablesClient.Get method. +type HubRouteTablesClientGetOptions struct { + // placeholder for future optional parameters +} + +// HubRouteTablesClientListOptions contains the optional parameters for the HubRouteTablesClient.List method. +type HubRouteTablesClientListOptions struct { + // placeholder for future optional parameters +} + +// HubVirtualNetworkConnection Resource. +type HubVirtualNetworkConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the hub virtual network connection. + Properties *HubVirtualNetworkConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// HubVirtualNetworkConnectionProperties - Parameters for HubVirtualNetworkConnection. +type HubVirtualNetworkConnectionProperties struct { + // Deprecated: VirtualHub to RemoteVnet transit to enabled or not. + AllowHubToRemoteVnetTransit *bool `json:"allowHubToRemoteVnetTransit,omitempty"` + + // Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. + AllowRemoteVnetToUseHubVnetGateways *bool `json:"allowRemoteVnetToUseHubVnetGateways,omitempty"` + + // Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + + // Reference to the remote virtual network. + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + + // READ-ONLY; The provisioning state of the hub virtual network connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.BeginCreateOrUpdate +// method. +type HubVirtualNetworkConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HubVirtualNetworkConnectionsClientBeginDeleteOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.BeginDelete +// method. +type HubVirtualNetworkConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HubVirtualNetworkConnectionsClientGetOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.Get +// method. +type HubVirtualNetworkConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HubVirtualNetworkConnectionsClientListOptions contains the optional parameters for the HubVirtualNetworkConnectionsClient.List +// method. +type HubVirtualNetworkConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// IDPSQueryObject - Will describe the query to run against the IDPS signatures DB +type IDPSQueryObject struct { + // Contain all filters names and values + Filters []*FilterItems `json:"filters,omitempty"` + + // Column to sort response by + OrderBy *OrderBy `json:"orderBy,omitempty"` + + // The number of the results to return in each page + ResultsPerPage *int32 `json:"resultsPerPage,omitempty"` + + // Search term in all columns + Search *string `json:"search,omitempty"` + + // The number of records matching the filter to skip + Skip *int32 `json:"skip,omitempty"` +} + +// IPAddressAvailabilityResult - Response for CheckIPAddressAvailability API service call. +type IPAddressAvailabilityResult struct { + // Private IP address availability. + Available *bool `json:"available,omitempty"` + + // Contains other available private IP addresses if the asked for address is taken. + AvailableIPAddresses []*string `json:"availableIPAddresses,omitempty"` + + // Private IP address platform reserved. + IsPlatformReserved *bool `json:"isPlatformReserved,omitempty"` +} + +// IPAllocation - IpAllocation resource. +type IPAllocation struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the IpAllocation. + Properties *IPAllocationPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// IPAllocationListResult - Response for the ListIpAllocations API service call. +type IPAllocationListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of IpAllocation resources. + Value []*IPAllocation `json:"value,omitempty"` +} + +// IPAllocationPropertiesFormat - Properties of the IpAllocation. +type IPAllocationPropertiesFormat struct { + // IpAllocation tags. + AllocationTags map[string]*string `json:"allocationTags,omitempty"` + + // The IPAM allocation ID. + IpamAllocationID *string `json:"ipamAllocationId,omitempty"` + + // The address prefix for the IpAllocation. + Prefix *string `json:"prefix,omitempty"` + + // The address prefix length for the IpAllocation. + PrefixLength *int32 `json:"prefixLength,omitempty"` + + // The address prefix Type for the IpAllocation. + PrefixType *IPVersion `json:"prefixType,omitempty"` + + // The type for the IpAllocation. + Type *IPAllocationType `json:"type,omitempty"` + + // READ-ONLY; The Subnet that using the prefix of this IpAllocation resource. + Subnet *SubResource `json:"subnet,omitempty" azure:"ro"` + + // READ-ONLY; The VirtualNetwork that using the prefix of this IpAllocation resource. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty" azure:"ro"` +} + +// IPAllocationsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPAllocationsClient.BeginCreateOrUpdate +// method. +type IPAllocationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IPAllocationsClientBeginDeleteOptions contains the optional parameters for the IPAllocationsClient.BeginDelete method. +type IPAllocationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IPAllocationsClientGetOptions contains the optional parameters for the IPAllocationsClient.Get method. +type IPAllocationsClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// IPAllocationsClientListByResourceGroupOptions contains the optional parameters for the IPAllocationsClient.ListByResourceGroup +// method. +type IPAllocationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IPAllocationsClientListOptions contains the optional parameters for the IPAllocationsClient.List method. +type IPAllocationsClientListOptions struct { + // placeholder for future optional parameters +} + +// IPAllocationsClientUpdateTagsOptions contains the optional parameters for the IPAllocationsClient.UpdateTags method. +type IPAllocationsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// IPConfiguration - IP configuration. +type IPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the IP configuration. + Properties *IPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// IPConfigurationBgpPeeringAddress - Properties of IPConfigurationBgpPeeringAddress. +type IPConfigurationBgpPeeringAddress struct { + // The list of custom BGP peering addresses which belong to IP configuration. + CustomBgpIPAddresses []*string `json:"customBgpIpAddresses,omitempty"` + + // The ID of IP configuration which belongs to gateway. + IPConfigurationID *string `json:"ipconfigurationId,omitempty"` + + // READ-ONLY; The list of default BGP peering addresses which belong to IP configuration. + DefaultBgpIPAddresses []*string `json:"defaultBgpIpAddresses,omitempty" azure:"ro"` + + // READ-ONLY; The list of tunnel public IP addresses which belong to IP configuration. + TunnelIPAddresses []*string `json:"tunnelIpAddresses,omitempty" azure:"ro"` +} + +// IPConfigurationProfile - IP configuration profile child resource. +type IPConfigurationProfile struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the IP configuration profile. + Properties *IPConfigurationProfilePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// IPConfigurationProfilePropertiesFormat - IP configuration profile properties. +type IPConfigurationProfilePropertiesFormat struct { + // The reference to the subnet resource to create a container network interface ip configuration. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the IP configuration profile resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// IPConfigurationPropertiesFormat - Properties of IP configuration. +type IPConfigurationPropertiesFormat struct { + // The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + + // The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// IPGroup - The IpGroups resource information. +type IPGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the IpGroups. + Properties *IPGroupPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// IPGroupListResult - Response for the ListIpGroups API service call. +type IPGroupListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of IpGroups information resources. + Value []*IPGroup `json:"value,omitempty"` +} + +// IPGroupPropertiesFormat - The IpGroups property information. +type IPGroupPropertiesFormat struct { + // IpAddresses/IpAddressPrefixes in the IpGroups resource. + IPAddresses []*string `json:"ipAddresses,omitempty"` + + // READ-ONLY; List of references to Firewall Policies resources that this IpGroups is associated with. + FirewallPolicies []*SubResource `json:"firewallPolicies,omitempty" azure:"ro"` + + // READ-ONLY; List of references to Firewall resources that this IpGroups is associated with. + Firewalls []*SubResource `json:"firewalls,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the IpGroups resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// IPGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the IPGroupsClient.BeginCreateOrUpdate method. +type IPGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IPGroupsClientBeginDeleteOptions contains the optional parameters for the IPGroupsClient.BeginDelete method. +type IPGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// IPGroupsClientGetOptions contains the optional parameters for the IPGroupsClient.Get method. +type IPGroupsClientGetOptions struct { + // Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. + Expand *string +} + +// IPGroupsClientListByResourceGroupOptions contains the optional parameters for the IPGroupsClient.ListByResourceGroup method. +type IPGroupsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// IPGroupsClientListOptions contains the optional parameters for the IPGroupsClient.List method. +type IPGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// IPGroupsClientUpdateGroupsOptions contains the optional parameters for the IPGroupsClient.UpdateGroups method. +type IPGroupsClientUpdateGroupsOptions struct { + // placeholder for future optional parameters +} + +// IPPrefixesList - List of SNAT IP Prefixes learnt by firewall to not SNAT +type IPPrefixesList struct { + // IP Prefix value. + IPPrefixes []*string `json:"ipPrefixes,omitempty"` +} + +// IPSecPolicy - An IPSec Policy configuration for a virtual network gateway connection. +type IPSecPolicy struct { + // REQUIRED; The DH Group used in IKE Phase 1 for initial SA. + DhGroup *DhGroup `json:"dhGroup,omitempty"` + + // REQUIRED; The IPSec encryption algorithm (IKE phase 1). + IPSecEncryption *IPSecEncryption `json:"ipsecEncryption,omitempty"` + + // REQUIRED; The IPSec integrity algorithm (IKE phase 1). + IPSecIntegrity *IPSecIntegrity `json:"ipsecIntegrity,omitempty"` + + // REQUIRED; The IKE encryption algorithm (IKE phase 2). + IkeEncryption *IkeEncryption `json:"ikeEncryption,omitempty"` + + // REQUIRED; The IKE integrity algorithm (IKE phase 2). + IkeIntegrity *IkeIntegrity `json:"ikeIntegrity,omitempty"` + + // REQUIRED; The Pfs Group used in IKE Phase 2 for new child SA. + PfsGroup *PfsGroup `json:"pfsGroup,omitempty"` + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN + // tunnel. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site + // VPN tunnel. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` +} + +// IPTag - Contains the IpTag associated with the object. +type IPTag struct { + // The IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + + // The value of the IP tag associated with the public IP. Example: SQL. + Tag *string `json:"tag,omitempty"` +} + +// IPv6CircuitConnectionConfig - IPv6 Circuit Connection properties for global reach. +type IPv6CircuitConnectionConfig struct { + // /125 IP address space to carve out customer addresses for global reach. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty" azure:"ro"` +} + +// IPv6ExpressRouteCircuitPeeringConfig - Contains IPv6 peering config. +type IPv6ExpressRouteCircuitPeeringConfig struct { + // The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + + // The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + + // The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + + // The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + + // The state of peering. + State *ExpressRouteCircuitPeeringState `json:"state,omitempty"` +} + +// InboundNatPool - Inbound NAT pool of the load balancer. +type InboundNatPool struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be + // used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer inbound nat pool. + Properties *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// InboundNatPoolPropertiesFormat - Properties of Inbound NAT pool. +type InboundNatPoolPropertiesFormat struct { + // REQUIRED; The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + + // REQUIRED; The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated + // with a load balancer. Acceptable values range between 1 and 65535. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + + // REQUIRED; The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated + // with a load balancer. Acceptable values range between 1 and 65534. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + + // REQUIRED; The reference to the transport protocol used by the inbound NAT pool. + Protocol *TransportProtocol `json:"protocol,omitempty"` + + // Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability + // Group. This setting is required when using the SQL AlwaysOn Availability Groups + // in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + + // Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used + // when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + + // The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. + // This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // READ-ONLY; The provisioning state of the inbound NAT pool resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// InboundNatRule - Inbound NAT rule of the load balancer. +type InboundNatRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be + // used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer inbound NAT rule. + Properties *InboundNatRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// InboundNatRuleListResult - Response for ListInboundNatRule API service call. +type InboundNatRuleListResult struct { + // A list of inbound NAT rules in a load balancer. + Value []*InboundNatRule `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// InboundNatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type InboundNatRulePortMapping struct { + // READ-ONLY; Backend port. + BackendPort *int32 `json:"backendPort,omitempty" azure:"ro"` + + // READ-ONLY; Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty" azure:"ro"` + + // READ-ONLY; Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty" azure:"ro"` + + // READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. + Protocol *TransportProtocol `json:"protocol,omitempty" azure:"ro"` +} + +// InboundNatRulePropertiesFormat - Properties of the inbound NAT rule. +type InboundNatRulePropertiesFormat struct { + // A reference to backendAddressPool resource. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // The port used for the internal endpoint. Acceptable values range from 1 to 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + + // Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability + // Group. This setting is required when using the SQL AlwaysOn Availability Groups + // in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + + // Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used + // when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + + // The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values + // range from 1 to 65534. + FrontendPort *int32 `json:"frontendPort,omitempty"` + + // The port range end for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeStart. + // Individual inbound NAT rule port mappings will be created for each + // backend address from BackendAddressPool. Acceptable values range from 1 to 65534. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + + // The port range start for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeEnd. + // Individual inbound NAT rule port mappings will be created for each + // backend address from BackendAddressPool. Acceptable values range from 1 to 65534. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + + // The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. + // This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // The reference to the transport protocol used by the load balancing rule. + Protocol *TransportProtocol `json:"protocol,omitempty"` + + // READ-ONLY; A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port + // of each of the frontend IP configurations is forwarded to the backend IP. + BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the inbound NAT rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// InboundNatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the InboundNatRulesClient.BeginCreateOrUpdate +// method. +type InboundNatRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InboundNatRulesClientBeginDeleteOptions contains the optional parameters for the InboundNatRulesClient.BeginDelete method. +type InboundNatRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InboundNatRulesClientGetOptions contains the optional parameters for the InboundNatRulesClient.Get method. +type InboundNatRulesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// InboundNatRulesClientListOptions contains the optional parameters for the InboundNatRulesClient.List method. +type InboundNatRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// InboundSecurityRule - NVA Inbound Security Rule resource. +type InboundSecurityRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of security rule collection. + Name *string `json:"name,omitempty"` + + // The properties of the Inbound Security Rules. + Properties *InboundSecurityRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; NVA inbound security rule type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// InboundSecurityRuleClientBeginCreateOrUpdateOptions contains the optional parameters for the InboundSecurityRuleClient.BeginCreateOrUpdate +// method. +type InboundSecurityRuleClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InboundSecurityRuleProperties - Properties of the Inbound Security Rules resource. +type InboundSecurityRuleProperties struct { + // List of allowed rules. + Rules []*InboundSecurityRules `json:"rules,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// InboundSecurityRules - Properties of the Inbound Security Rules resource. +type InboundSecurityRules struct { + // NVA port ranges to be opened up. One needs to provide specific ports. + DestinationPortRange *int32 `json:"destinationPortRange,omitempty"` + + // Protocol. This should be either TCP or UDP. + Protocol *InboundSecurityRulesProtocol `json:"protocol,omitempty"` + + // The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` +} + +// IntentPolicy - Network Intent Policy resource. +type IntentPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// IntentPolicyConfiguration - Details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. +type IntentPolicyConfiguration struct { + // The name of the Network Intent Policy for storing in target subscription. + NetworkIntentPolicyName *string `json:"networkIntentPolicyName,omitempty"` + + // Source network intent policy. + SourceNetworkIntentPolicy *IntentPolicy `json:"sourceNetworkIntentPolicy,omitempty"` +} + +// Interface - A network interface in a resource group. +type Interface struct { + // The extended location of the network interface. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the network interface. + Properties *InterfacePropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// InterfaceAssociation - Network interface and its custom security rules. +type InterfaceAssociation struct { + // Collection of custom security rules. + SecurityRules []*SecurityRule `json:"securityRules,omitempty"` + + // READ-ONLY; Network interface ID. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// InterfaceDNSSettings - DNS settings of a network interface. +type InterfaceDNSSettings struct { + // List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. 'AzureProvidedDNS' + // value cannot be combined with other IPs, it must be the only value in dnsServers + // collection. + DNSServers []*string `json:"dnsServers,omitempty"` + + // Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. + InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` + + // READ-ONLY; If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers + // from all NICs that are part of the Availability Set. This property is what is + // configured on each of those VMs. + AppliedDNSServers []*string `json:"appliedDnsServers,omitempty" azure:"ro"` + + // READ-ONLY; Even if internalDnsNameLabel is not specified, a DNS entry is created for the primary NIC of the VM. This DNS + // name can be constructed by concatenating the VM name with the value of + // internalDomainNameSuffix. + InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified DNS name supporting internal communications between VMs in the same virtual network. + InternalFqdn *string `json:"internalFqdn,omitempty" azure:"ro"` +} + +// InterfaceIPConfiguration - IPConfiguration in a network interface. +type InterfaceIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Network interface IP configuration properties. + Properties *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// InterfaceIPConfigurationListResult - Response for list ip configurations API service call. +type InterfaceIPConfigurationListResult struct { + // A list of ip configurations. + Value []*InterfaceIPConfiguration `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// InterfaceIPConfigurationPrivateLinkConnectionProperties - PrivateLinkConnection properties for the network interface. +type InterfaceIPConfigurationPrivateLinkConnectionProperties struct { + // READ-ONLY; List of FQDNs for current private link connection. + Fqdns []*string `json:"fqdns,omitempty" azure:"ro"` + + // READ-ONLY; The group ID for current private link connection. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; The required member name for current private link connection. + RequiredMemberName *string `json:"requiredMemberName,omitempty" azure:"ro"` +} + +// InterfaceIPConfigurationPropertiesFormat - Properties of IP configuration. +type InterfaceIPConfigurationPropertiesFormat struct { + // The reference to ApplicationGatewayBackendAddressPool resource. + ApplicationGatewayBackendAddressPools []*ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` + + // Application security groups in which the IP configuration is included. + ApplicationSecurityGroups []*ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + + // The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + + // The reference to LoadBalancerBackendAddressPool resource. + LoadBalancerBackendAddressPools []*BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` + + // A list of references of LoadBalancerInboundNatRules. + LoadBalancerInboundNatRules []*InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` + + // Whether this is a primary customer address on the network interface. + Primary *bool `json:"primary,omitempty"` + + // Private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // Public IP address bound to the IP configuration. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + + // Subnet bound to the IP configuration. + Subnet *Subnet `json:"subnet,omitempty"` + + // The reference to Virtual Network Taps. + VirtualNetworkTaps []*VirtualNetworkTap `json:"virtualNetworkTaps,omitempty"` + + // READ-ONLY; PrivateLinkConnection properties for the network interface. + PrivateLinkConnectionProperties *InterfaceIPConfigurationPrivateLinkConnectionProperties `json:"privateLinkConnectionProperties,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the network interface IP configuration. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// InterfaceIPConfigurationsClientGetOptions contains the optional parameters for the InterfaceIPConfigurationsClient.Get +// method. +type InterfaceIPConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// InterfaceIPConfigurationsClientListOptions contains the optional parameters for the InterfaceIPConfigurationsClient.List +// method. +type InterfaceIPConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfaceListResult - Response for the ListNetworkInterface API service call. +type InterfaceListResult struct { + // A list of network interfaces in a resource group. + Value []*Interface `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// InterfaceLoadBalancerListResult - Response for list ip configurations API service call. +type InterfaceLoadBalancerListResult struct { + // A list of load balancers. + Value []*LoadBalancer `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// InterfaceLoadBalancersClientListOptions contains the optional parameters for the InterfaceLoadBalancersClient.List method. +type InterfaceLoadBalancersClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfacePropertiesFormat - NetworkInterface properties. +type InterfacePropertiesFormat struct { + // Auxiliary mode of Network Interface resource. + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + + // The DNS settings in network interface. + DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` + + // Indicates whether to disable tcp state tracking. + DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + + // If the network interface is configured for accelerated networking. Not applicable to VM sizes which require accelerated + // networking. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + + // Indicates whether IP forwarding is enabled on this network interface. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + + // A list of IPConfigurations of the network interface. + IPConfigurations []*InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + + // Migration phase of Network Interface resource. + MigrationPhase *NetworkInterfaceMigrationPhase `json:"migrationPhase,omitempty"` + + // The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + + // Type of Network Interface resource. + NicType *NetworkInterfaceNicType `json:"nicType,omitempty"` + + // Privatelinkservice of the network interface resource. + PrivateLinkService *PrivateLinkService `json:"privateLinkService,omitempty"` + + // WorkloadType of the NetworkInterface for BareMetal resources + WorkloadType *string `json:"workloadType,omitempty"` + + // READ-ONLY; A reference to the dscp configuration to which the network interface is linked. + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to linked BareMetal resources. + HostedWorkloads []*string `json:"hostedWorkloads,omitempty" azure:"ro"` + + // READ-ONLY; The MAC address of the network interface. + MacAddress *string `json:"macAddress,omitempty" azure:"ro"` + + // READ-ONLY; Whether this is a primary network interface on a virtual machine. + Primary *bool `json:"primary,omitempty" azure:"ro"` + + // READ-ONLY; A reference to the private endpoint to which the network interface is linked. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the network interface resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the network interface resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; A list of TapConfigurations of the network interface. + TapConfigurations []*InterfaceTapConfiguration `json:"tapConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The reference to a virtual machine. + VirtualMachine *SubResource `json:"virtualMachine,omitempty" azure:"ro"` + + // READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. + VnetEncryptionSupported *bool `json:"vnetEncryptionSupported,omitempty" azure:"ro"` +} + +// InterfaceTapConfiguration - Tap configuration in a Network Interface. +type InterfaceTapConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the Virtual Network Tap configuration. + Properties *InterfaceTapConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// InterfaceTapConfigurationListResult - Response for list tap configurations API service call. +type InterfaceTapConfigurationListResult struct { + // A list of tap configurations. + Value []*InterfaceTapConfiguration `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// InterfaceTapConfigurationPropertiesFormat - Properties of Virtual Network Tap configuration. +type InterfaceTapConfigurationPropertiesFormat struct { + // The reference to the Virtual Network Tap resource. + VirtualNetworkTap *VirtualNetworkTap `json:"virtualNetworkTap,omitempty"` + + // READ-ONLY; The provisioning state of the network interface tap configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the InterfaceTapConfigurationsClient.BeginCreateOrUpdate +// method. +type InterfaceTapConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfaceTapConfigurationsClientBeginDeleteOptions contains the optional parameters for the InterfaceTapConfigurationsClient.BeginDelete +// method. +type InterfaceTapConfigurationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfaceTapConfigurationsClientGetOptions contains the optional parameters for the InterfaceTapConfigurationsClient.Get +// method. +type InterfaceTapConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// InterfaceTapConfigurationsClientListOptions contains the optional parameters for the InterfaceTapConfigurationsClient.List +// method. +type InterfaceTapConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientBeginCreateOrUpdateOptions contains the optional parameters for the InterfacesClient.BeginCreateOrUpdate +// method. +type InterfacesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfacesClientBeginDeleteOptions contains the optional parameters for the InterfacesClient.BeginDelete method. +type InterfacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfacesClientBeginGetEffectiveRouteTableOptions contains the optional parameters for the InterfacesClient.BeginGetEffectiveRouteTable +// method. +type InterfacesClientBeginGetEffectiveRouteTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions contains the optional parameters for the InterfacesClient.BeginListEffectiveNetworkSecurityGroups +// method. +type InterfacesClientBeginListEffectiveNetworkSecurityGroupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InterfacesClientGetCloudServiceNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetCloudServiceNetworkInterface +// method. +type InterfacesClientGetCloudServiceNetworkInterfaceOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientGetOptions contains the optional parameters for the InterfacesClient.Get method. +type InterfacesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetIPConfiguration +// method. +type InterfacesClientGetVirtualMachineScaleSetIPConfigurationOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions contains the optional parameters for the InterfacesClient.GetVirtualMachineScaleSetNetworkInterface +// method. +type InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientListAllOptions contains the optional parameters for the InterfacesClient.ListAll method. +type InterfacesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListCloudServiceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListCloudServiceNetworkInterfaces +// method. +type InterfacesClientListCloudServiceNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListCloudServiceRoleInstanceNetworkInterfaces +// method. +type InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListOptions contains the optional parameters for the InterfacesClient.List method. +type InterfacesClientListOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions contains the optional parameters for the InterfacesClient.ListVirtualMachineScaleSetIPConfigurations +// method. +type InterfacesClientListVirtualMachineScaleSetIPConfigurationsOptions struct { + // Expands referenced resources. + Expand *string +} + +// InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListVirtualMachineScaleSetNetworkInterfaces +// method. +type InterfacesClientListVirtualMachineScaleSetNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions contains the optional parameters for the InterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfaces +// method. +type InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesOptions struct { + // placeholder for future optional parameters +} + +// InterfacesClientUpdateTagsOptions contains the optional parameters for the InterfacesClient.UpdateTags method. +type InterfacesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ListHubRouteTablesResult - List of RouteTables and a URL nextLink to get the next set of results. +type ListHubRouteTablesResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of RouteTables. + Value []*HubRouteTable `json:"value,omitempty"` +} + +// ListHubVirtualNetworkConnectionsResult - List of HubVirtualNetworkConnections and a URL nextLink to get the next set of +// results. +type ListHubVirtualNetworkConnectionsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of HubVirtualNetworkConnections. + Value []*HubVirtualNetworkConnection `json:"value,omitempty"` +} + +// ListP2SVPNGatewaysResult - Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL +// nextLink to get the next set of results. +type ListP2SVPNGatewaysResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of P2SVpnGateways. + Value []*P2SVPNGateway `json:"value,omitempty"` +} + +// ListRouteMapsResult - List of RouteMaps and a URL nextLink to get the next set of results. +type ListRouteMapsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of RouteMaps. + Value []*RouteMap `json:"value,omitempty"` +} + +// ListRoutingIntentResult - List of the routing intent result and a URL nextLink to get the next set of results. +type ListRoutingIntentResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of RoutingIntent resource. + Value []*RoutingIntent `json:"value,omitempty"` +} + +// ListVPNConnectionsResult - Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains +// a list of Vpn Connections and a URL nextLink to get the next set of results. +type ListVPNConnectionsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of Vpn Connections. + Value []*VPNConnection `json:"value,omitempty"` +} + +// ListVPNGatewayNatRulesResult - Result of the request to list all nat rules to a virtual wan vpn gateway. It contains a +// list of Nat rules and a URL nextLink to get the next set of results. +type ListVPNGatewayNatRulesResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of Nat Rules. + Value []*VPNGatewayNatRule `json:"value,omitempty"` +} + +// ListVPNGatewaysResult - Result of the request to list VpnGateways. It contains a list of VpnGateways and a URL nextLink +// to get the next set of results. +type ListVPNGatewaysResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnGateways. + Value []*VPNGateway `json:"value,omitempty"` +} + +// ListVPNServerConfigurationPolicyGroupsResult - Result of the request to list VpnServerConfigurationPolicyGroups. It contains +// a list of VpnServerConfigurationPolicyGroups and a URL nextLink to get the next set of results. +type ListVPNServerConfigurationPolicyGroupsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnServerConfigurationPolicyGroups. + Value []*VPNServerConfigurationPolicyGroup `json:"value,omitempty"` +} + +// ListVPNServerConfigurationsResult - Result of the request to list all VpnServerConfigurations. It contains a list of VpnServerConfigurations +// and a URL nextLink to get the next set of results. +type ListVPNServerConfigurationsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnServerConfigurations. + Value []*VPNServerConfiguration `json:"value,omitempty"` +} + +// ListVPNSiteLinkConnectionsResult - Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains +// a list of Vpn Connections and a URL nextLink to get the next set of results. +type ListVPNSiteLinkConnectionsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnSiteLinkConnections. + Value []*VPNSiteLinkConnection `json:"value,omitempty"` +} + +// ListVPNSiteLinksResult - Result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks and a URL nextLink +// to get the next set of results. +type ListVPNSiteLinksResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnSitesLinks. + Value []*VPNSiteLink `json:"value,omitempty"` +} + +// ListVPNSitesResult - Result of the request to list VpnSites. It contains a list of VpnSites and a URL nextLink to get the +// next set of results. +type ListVPNSitesResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VpnSites. + Value []*VPNSite `json:"value,omitempty"` +} + +// ListVirtualHubBgpConnectionResults - VirtualHubBgpConnections list. +type ListVirtualHubBgpConnectionResults struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of VirtualHubBgpConnections. + Value []*BgpConnection `json:"value,omitempty"` +} + +// ListVirtualHubIPConfigurationResults - VirtualHubIpConfigurations list. +type ListVirtualHubIPConfigurationResults struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list of VirtualHubIpConfigurations. + Value []*HubIPConfiguration `json:"value,omitempty"` +} + +// ListVirtualHubRouteTableV2SResult - List of VirtualHubRouteTableV2s and a URL nextLink to get the next set of results. +type ListVirtualHubRouteTableV2SResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VirtualHubRouteTableV2s. + Value []*VirtualHubRouteTableV2 `json:"value,omitempty"` +} + +// ListVirtualHubsResult - Result of the request to list VirtualHubs. It contains a list of VirtualHubs and a URL nextLink +// to get the next set of results. +type ListVirtualHubsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VirtualHubs. + Value []*VirtualHub `json:"value,omitempty"` +} + +// ListVirtualNetworkGatewayNatRulesResult - Result of the request to list all nat rules to a virtual network gateway. It +// contains a list of Nat rules and a URL nextLink to get the next set of results. +type ListVirtualNetworkGatewayNatRulesResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of Nat Rules. + Value []*VirtualNetworkGatewayNatRule `json:"value,omitempty"` +} + +// ListVirtualWANsResult - Result of the request to list VirtualWANs. It contains a list of VirtualWANs and a URL nextLink +// to get the next set of results. +type ListVirtualWANsResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of VirtualWANs. + Value []*VirtualWAN `json:"value,omitempty"` +} + +// LoadBalancer resource. +type LoadBalancer struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of load balancer. + Properties *LoadBalancerPropertiesFormat `json:"properties,omitempty"` + + // The load balancer SKU. + SKU *LoadBalancerSKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// LoadBalancerBackendAddress - Load balancer backend addresses. +type LoadBalancerBackendAddress struct { + // Name of the backend address. + Name *string `json:"name,omitempty"` + + // Properties of load balancer backend address pool. + Properties *LoadBalancerBackendAddressPropertiesFormat `json:"properties,omitempty"` +} + +// LoadBalancerBackendAddressPoolListResult - Response for ListBackendAddressPool API service call. +type LoadBalancerBackendAddressPoolListResult struct { + // A list of backend address pools in a load balancer. + Value []*BackendAddressPool `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.BeginCreateOrUpdate +// method. +type LoadBalancerBackendAddressPoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancerBackendAddressPoolsClientBeginDeleteOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.BeginDelete +// method. +type LoadBalancerBackendAddressPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancerBackendAddressPoolsClientGetOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.Get +// method. +type LoadBalancerBackendAddressPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerBackendAddressPoolsClientListOptions contains the optional parameters for the LoadBalancerBackendAddressPoolsClient.List +// method. +type LoadBalancerBackendAddressPoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerBackendAddressPropertiesFormat - Properties of the load balancer backend addresses. +type LoadBalancerBackendAddressPropertiesFormat struct { + // A list of administrative states which once set can override health probe so that Load Balancer will always forward new + // connections to backend, or deny new connections and reset existing connections. + AdminState *LoadBalancerBackendAddressAdminState `json:"adminState,omitempty"` + + // IP Address belonging to the referenced virtual network. + IPAddress *string `json:"ipAddress,omitempty"` + + // Reference to the frontend ip address configuration defined in regional loadbalancer. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIPConfiguration,omitempty"` + + // Reference to an existing subnet. + Subnet *SubResource `json:"subnet,omitempty"` + + // Reference to an existing virtual network. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + + // READ-ONLY; Collection of inbound NAT rule port mappings. + InboundNatRulesPortMapping []*NatRulePortMapping `json:"inboundNatRulesPortMapping,omitempty" azure:"ro"` + + // READ-ONLY; Reference to IP address defined in network interfaces. + NetworkInterfaceIPConfiguration *SubResource `json:"networkInterfaceIPConfiguration,omitempty" azure:"ro"` +} + +// LoadBalancerFrontendIPConfigurationListResult - Response for ListFrontendIPConfiguration API service call. +type LoadBalancerFrontendIPConfigurationListResult struct { + // A list of frontend IP configurations in a load balancer. + Value []*FrontendIPConfiguration `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerFrontendIPConfigurationsClientGetOptions contains the optional parameters for the LoadBalancerFrontendIPConfigurationsClient.Get +// method. +type LoadBalancerFrontendIPConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerFrontendIPConfigurationsClientListOptions contains the optional parameters for the LoadBalancerFrontendIPConfigurationsClient.List +// method. +type LoadBalancerFrontendIPConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerListResult - Response for ListLoadBalancers API service call. +type LoadBalancerListResult struct { + // A list of load balancers in a resource group. + Value []*LoadBalancer `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerLoadBalancingRuleListResult - Response for ListLoadBalancingRule API service call. +type LoadBalancerLoadBalancingRuleListResult struct { + // A list of load balancing rules in a load balancer. + Value []*LoadBalancingRule `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerLoadBalancingRulesClientGetOptions contains the optional parameters for the LoadBalancerLoadBalancingRulesClient.Get +// method. +type LoadBalancerLoadBalancingRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerLoadBalancingRulesClientListOptions contains the optional parameters for the LoadBalancerLoadBalancingRulesClient.List +// method. +type LoadBalancerLoadBalancingRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerNetworkInterfacesClientListOptions contains the optional parameters for the LoadBalancerNetworkInterfacesClient.List +// method. +type LoadBalancerNetworkInterfacesClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerOutboundRuleListResult - Response for ListOutboundRule API service call. +type LoadBalancerOutboundRuleListResult struct { + // A list of outbound rules in a load balancer. + Value []*OutboundRule `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerOutboundRulesClientGetOptions contains the optional parameters for the LoadBalancerOutboundRulesClient.Get +// method. +type LoadBalancerOutboundRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerOutboundRulesClientListOptions contains the optional parameters for the LoadBalancerOutboundRulesClient.List +// method. +type LoadBalancerOutboundRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerProbeListResult - Response for ListProbe API service call. +type LoadBalancerProbeListResult struct { + // A list of probes in a load balancer. + Value []*Probe `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LoadBalancerProbesClientGetOptions contains the optional parameters for the LoadBalancerProbesClient.Get method. +type LoadBalancerProbesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerProbesClientListOptions contains the optional parameters for the LoadBalancerProbesClient.List method. +type LoadBalancerProbesClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancerPropertiesFormat - Properties of the load balancer. +type LoadBalancerPropertiesFormat struct { + // Collection of backend address pools used by a load balancer. + BackendAddressPools []*BackendAddressPool `json:"backendAddressPools,omitempty"` + + // Object representing the frontend IPs to be used for the load balancer. + FrontendIPConfigurations []*FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + + // Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound + // NAT rules are created automatically for each NIC associated with the Load + // Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + // with defining inbound NAT rules. Inbound NAT pools are referenced from virtual + // machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They + // have to reference individual inbound NAT rules. + InboundNatPools []*InboundNatPool `json:"inboundNatPools,omitempty"` + + // Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive + // with defining an inbound NAT pool. Inbound NAT pools are referenced from + // virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. + // They have to reference individual inbound NAT rules. + InboundNatRules []*InboundNatRule `json:"inboundNatRules,omitempty"` + + // Object collection representing the load balancing rules Gets the provisioning. + LoadBalancingRules []*LoadBalancingRule `json:"loadBalancingRules,omitempty"` + + // The outbound rules. + OutboundRules []*OutboundRule `json:"outboundRules,omitempty"` + + // Collection of probe objects used in the load balancer. + Probes []*Probe `json:"probes,omitempty"` + + // READ-ONLY; The provisioning state of the load balancer resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the load balancer resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// LoadBalancerSKU - SKU of a load balancer. +type LoadBalancerSKU struct { + // Name of a load balancer SKU. + Name *LoadBalancerSKUName `json:"name,omitempty"` + + // Tier of a load balancer SKU. + Tier *LoadBalancerSKUTier `json:"tier,omitempty"` +} + +// LoadBalancerVipSwapRequest - The request for a VIP swap. +type LoadBalancerVipSwapRequest struct { + // A list of frontend IP configuration resources that should swap VIPs. + FrontendIPConfigurations []*LoadBalancerVipSwapRequestFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` +} + +// LoadBalancerVipSwapRequestFrontendIPConfiguration - VIP swap request's frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfiguration struct { + // The ID of frontend IP configuration resource. + ID *string `json:"id,omitempty"` + + // The properties of VIP swap request's frontend IP configuration object. + Properties *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties `json:"properties,omitempty"` +} + +// LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - The properties of VIP swap request's frontend IP configuration +// object. +type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties struct { + // A reference to public IP address resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` +} + +// LoadBalancersClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadBalancersClient.BeginCreateOrUpdate +// method. +type LoadBalancersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancersClientBeginDeleteOptions contains the optional parameters for the LoadBalancersClient.BeginDelete method. +type LoadBalancersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancersClientBeginListInboundNatRulePortMappingsOptions contains the optional parameters for the LoadBalancersClient.BeginListInboundNatRulePortMappings +// method. +type LoadBalancersClientBeginListInboundNatRulePortMappingsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancersClientBeginSwapPublicIPAddressesOptions contains the optional parameters for the LoadBalancersClient.BeginSwapPublicIPAddresses +// method. +type LoadBalancersClientBeginSwapPublicIPAddressesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LoadBalancersClientGetOptions contains the optional parameters for the LoadBalancersClient.Get method. +type LoadBalancersClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// LoadBalancersClientListAllOptions contains the optional parameters for the LoadBalancersClient.ListAll method. +type LoadBalancersClientListAllOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancersClientListOptions contains the optional parameters for the LoadBalancersClient.List method. +type LoadBalancersClientListOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancersClientUpdateTagsOptions contains the optional parameters for the LoadBalancersClient.UpdateTags method. +type LoadBalancersClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// LoadBalancingRule - A load balancing rule for a load balancer. +type LoadBalancingRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can + // be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer load balancing rule. + Properties *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// LoadBalancingRulePropertiesFormat - Properties of the load balancer. +type LoadBalancingRulePropertiesFormat struct { + // REQUIRED; The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable + // values are between 0 and 65534. Note that value 0 enables "Any Port". + FrontendPort *int32 `json:"frontendPort,omitempty"` + + // REQUIRED; The reference to the transport protocol used by the load balancing rule. + Protocol *TransportProtocol `json:"protocol,omitempty"` + + // A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // An array of references to pool of DIPs. + BackendAddressPools []*SubResource `json:"backendAddressPools,omitempty"` + + // The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables + // "Any Port". + BackendPort *int32 `json:"backendPort,omitempty"` + + // Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing + // rule. + DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"` + + // Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability + // Group. This setting is required when using the SQL AlwaysOn Availability Groups + // in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + + // Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used + // when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + + // A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + + // The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. + // This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // The load distribution policy for this rule. + LoadDistribution *LoadDistribution `json:"loadDistribution,omitempty"` + + // The reference to the load balancer probe used by the load balancing rule. + Probe *SubResource `json:"probe,omitempty"` + + // READ-ONLY; The provisioning state of the load balancing rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// LocalNetworkGateway - A common class for general resource information. +type LocalNetworkGateway struct { + // REQUIRED; Properties of the local network gateway. + Properties *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// LocalNetworkGatewayListResult - Response for ListLocalNetworkGateways API service call. +type LocalNetworkGatewayListResult struct { + // A list of local network gateways that exists in a resource group. + Value []*LocalNetworkGateway `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// LocalNetworkGatewayPropertiesFormat - LocalNetworkGateway properties. +type LocalNetworkGatewayPropertiesFormat struct { + // Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + + // FQDN of local network gateway. + Fqdn *string `json:"fqdn,omitempty"` + + // IP address of local network gateway. + GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` + + // Local network site address space. + LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` + + // READ-ONLY; The provisioning state of the local network gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the local network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// LocalNetworkGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalNetworkGatewaysClient.BeginCreateOrUpdate +// method. +type LocalNetworkGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalNetworkGatewaysClientBeginDeleteOptions contains the optional parameters for the LocalNetworkGatewaysClient.BeginDelete +// method. +type LocalNetworkGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalNetworkGatewaysClientGetOptions contains the optional parameters for the LocalNetworkGatewaysClient.Get method. +type LocalNetworkGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocalNetworkGatewaysClientListOptions contains the optional parameters for the LocalNetworkGatewaysClient.List method. +type LocalNetworkGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// LocalNetworkGatewaysClientUpdateTagsOptions contains the optional parameters for the LocalNetworkGatewaysClient.UpdateTags +// method. +type LocalNetworkGatewaysClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// LogSpecification - Description of logging specification. +type LogSpecification struct { + // Duration of the blob. + BlobDuration *string `json:"blobDuration,omitempty"` + + // The display name of the specification. + DisplayName *string `json:"displayName,omitempty"` + + // The name of the specification. + Name *string `json:"name,omitempty"` +} + +// ManagedRuleGroupOverride - Defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // REQUIRED; The managed rule group to override. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + + // List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules []*ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride - Defines a managed rule group override setting. +type ManagedRuleOverride struct { + // REQUIRED; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + + // Describes the override action to be applied when rule matches. + Action *ActionType `json:"action,omitempty"` + + // The state of the managed rule. Defaults to Disabled if not specified. + State *ManagedRuleEnabledState `json:"state,omitempty"` +} + +// ManagedRuleSet - Defines a managed rule set. +type ManagedRuleSet struct { + // REQUIRED; Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // Defines the rule group overrides to apply to the rule set. + RuleGroupOverrides []*ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedRulesDefinition - Allow to exclude some variable satisfy the condition for the WAF check. +type ManagedRulesDefinition struct { + // REQUIRED; The managed rule sets that are associated with the policy. + ManagedRuleSets []*ManagedRuleSet `json:"managedRuleSets,omitempty"` + + // The Exclusions that are applied on the policy. + Exclusions []*OwaspCrsExclusionEntry `json:"exclusions,omitempty"` +} + +// ManagedServiceIdentity - Identity for the resource. +type ManagedServiceIdentity struct { + // The type of identity used for the resource. 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 virtual machine. + Type *ResourceIdentityType `json:"type,omitempty"` + + // The list of user identities associated with resource. 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]*Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// ManagementClientBeginDeleteBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginDeleteBastionShareableLink +// method. +type ManagementClientBeginDeleteBastionShareableLinkOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions contains the optional parameters for the +// ManagementClient.BeginGeneratevirtualwanvpnserverconfigurationvpnprofile method. +type ManagementClientBeginGeneratevirtualwanvpnserverconfigurationvpnprofileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagementClientBeginGetActiveSessionsOptions contains the optional parameters for the ManagementClient.BeginGetActiveSessions +// method. +type ManagementClientBeginGetActiveSessionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagementClientBeginPutBastionShareableLinkOptions contains the optional parameters for the ManagementClient.BeginPutBastionShareableLink +// method. +type ManagementClientBeginPutBastionShareableLinkOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagementClientCheckDNSNameAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDNSNameAvailability +// method. +type ManagementClientCheckDNSNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientDisconnectActiveSessionsOptions contains the optional parameters for the ManagementClient.DisconnectActiveSessions +// method. +type ManagementClientDisconnectActiveSessionsOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientExpressRouteProviderPortOptions contains the optional parameters for the ManagementClient.ExpressRouteProviderPort +// method. +type ManagementClientExpressRouteProviderPortOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientGetBastionShareableLinkOptions contains the optional parameters for the ManagementClient.GetBastionShareableLink +// method. +type ManagementClientGetBastionShareableLinkOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientListActiveConnectivityConfigurationsOptions contains the optional parameters for the ManagementClient.ListActiveConnectivityConfigurations +// method. +type ManagementClientListActiveConnectivityConfigurationsOptions struct { + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagementClientListActiveSecurityAdminRulesOptions contains the optional parameters for the ManagementClient.ListActiveSecurityAdminRules +// method. +type ManagementClientListActiveSecurityAdminRulesOptions struct { + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions contains the optional parameters for the ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations +// method. +type ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsOptions struct { + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions contains the optional parameters for the ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules +// method. +type ManagementClientListNetworkManagerEffectiveSecurityAdminRulesOptions struct { + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagementClientSupportedSecurityProvidersOptions contains the optional parameters for the ManagementClient.SupportedSecurityProviders +// method. +type ManagementClientSupportedSecurityProvidersOptions struct { + // placeholder for future optional parameters +} + +// ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.CreateOrUpdate +// method. +type ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagementGroupNetworkManagerConnectionsClientDeleteOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.Delete +// method. +type ManagementGroupNetworkManagerConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagementGroupNetworkManagerConnectionsClientGetOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.Get +// method. +type ManagementGroupNetworkManagerConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagementGroupNetworkManagerConnectionsClientListOptions contains the optional parameters for the ManagementGroupNetworkManagerConnectionsClient.List +// method. +type ManagementGroupNetworkManagerConnectionsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// Manager - The Managed Network resource +type Manager struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // The network manager properties + Properties *ManagerProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagerCommit - Network Manager Commit. +type ManagerCommit struct { + // REQUIRED; Commit Type. + CommitType *ConfigurationType `json:"commitType,omitempty"` + + // REQUIRED; List of target locations. + TargetLocations []*string `json:"targetLocations,omitempty"` + + // List of configuration ids. + ConfigurationIDs []*string `json:"configurationIds,omitempty"` + + // READ-ONLY; Commit Id. + CommitID *string `json:"commitId,omitempty" azure:"ro"` +} + +// ManagerCommitsClientBeginPostOptions contains the optional parameters for the ManagerCommitsClient.BeginPost method. +type ManagerCommitsClientBeginPostOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagerConnection - The Network Manager Connection resource +type ManagerConnection struct { + // The scope connection properties + Properties *ManagerConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagerConnectionListResult - List of network manager connections. +type ManagerConnectionListResult struct { + // Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of network manager connections. + Value []*ManagerConnection `json:"value,omitempty"` +} + +// ManagerConnectionProperties - Information about the network manager connection. +type ManagerConnectionProperties struct { + // A description of the network manager connection. + Description *string `json:"description,omitempty"` + + // Network Manager Id. + NetworkManagerID *string `json:"networkManagerId,omitempty"` + + // READ-ONLY; Connection state. + ConnectionState *ScopeConnectionState `json:"connectionState,omitempty" azure:"ro"` +} + +// ManagerDeploymentStatus - Network Manager Deployment Status. +type ManagerDeploymentStatus struct { + // Commit Time. + CommitTime *time.Time `json:"commitTime,omitempty"` + + // List of configuration ids. + ConfigurationIDs []*string `json:"configurationIds,omitempty"` + + // Deployment Status. + DeploymentStatus *DeploymentStatus `json:"deploymentStatus,omitempty"` + + // Configuration Deployment Type. + DeploymentType *ConfigurationType `json:"deploymentType,omitempty"` + + // Error Message. + ErrorMessage *string `json:"errorMessage,omitempty"` + + // Region Name. + Region *string `json:"region,omitempty"` +} + +// ManagerDeploymentStatusClientListOptions contains the optional parameters for the ManagerDeploymentStatusClient.List method. +type ManagerDeploymentStatusClientListOptions struct { + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagerDeploymentStatusListResult - A list of Network Manager Deployment Status +type ManagerDeploymentStatusListResult struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` + + // Gets a page of Network Manager Deployment Status + Value []*ManagerDeploymentStatus `json:"value,omitempty"` +} + +// ManagerDeploymentStatusParameter - Network Manager Deployment Status Parameter. +type ManagerDeploymentStatusParameter struct { + // List of deployment types. + DeploymentTypes []*ConfigurationType `json:"deploymentTypes,omitempty"` + + // List of locations. + Regions []*string `json:"regions,omitempty"` + + // Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ManagerEffectiveConnectivityConfigurationListResult - Result of the request to list networkManagerEffectiveConnectivityConfiguration. +// It contains a list of groups and a skiptoken to get the next set of results. +type ManagerEffectiveConnectivityConfigurationListResult struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` + + // Gets a page of NetworkManagerEffectiveConnectivityConfiguration + Value []*EffectiveConnectivityConfiguration `json:"value,omitempty"` +} + +// ManagerEffectiveSecurityAdminRulesListResult - Result of the request to list networkManagerEffectiveSecurityAdminRules. +// It contains a list of groups and a skiptoken to get the next set of results. +type ManagerEffectiveSecurityAdminRulesListResult struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` + + // Gets a page of NetworkManagerEffectiveSecurityAdminRules + Value []EffectiveBaseSecurityAdminRuleClassification `json:"value,omitempty"` +} + +// ManagerListResult - Result of the request to list NetworkManager. It contains a list of network managers and a URL link +// to get the next set of results. +type ManagerListResult struct { + // Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // Gets a page of NetworkManager + Value []*Manager `json:"value,omitempty"` +} + +// ManagerProperties - Properties of Managed Network +type ManagerProperties struct { + // REQUIRED; Scope Access. + NetworkManagerScopeAccesses []*ConfigurationType `json:"networkManagerScopeAccesses,omitempty"` + + // REQUIRED; Scope of Network Manager. + NetworkManagerScopes *ManagerPropertiesNetworkManagerScopes `json:"networkManagerScopes,omitempty"` + + // A description of the network manager. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The provisioning state of the network manager resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ManagerPropertiesNetworkManagerScopes - Scope of Network Manager. +type ManagerPropertiesNetworkManagerScopes struct { + // List of management groups. + ManagementGroups []*string `json:"managementGroups,omitempty"` + + // List of subscriptions. + Subscriptions []*string `json:"subscriptions,omitempty"` + + // READ-ONLY; List of cross tenant scopes. + CrossTenantScopes []*CrossTenantScopes `json:"crossTenantScopes,omitempty" azure:"ro"` +} + +// ManagerSecurityGroupItem - Network manager security group item. +type ManagerSecurityGroupItem struct { + // REQUIRED; Network manager group Id. + NetworkGroupID *string `json:"networkGroupId,omitempty"` +} + +// ManagersClientBeginDeleteOptions contains the optional parameters for the ManagersClient.BeginDelete method. +type ManagersClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagersClientCreateOrUpdateOptions contains the optional parameters for the ManagersClient.CreateOrUpdate method. +type ManagersClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientGetOptions contains the optional parameters for the ManagersClient.Get method. +type ManagersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagersClientListBySubscriptionOptions contains the optional parameters for the ManagersClient.ListBySubscription method. +type ManagersClientListBySubscriptionOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagersClientListOptions contains the optional parameters for the ManagersClient.List method. +type ManagersClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// ManagersClientPatchOptions contains the optional parameters for the ManagersClient.Patch method. +type ManagersClientPatchOptions struct { + // placeholder for future optional parameters +} + +// MatchCondition - Define match conditions. +type MatchCondition struct { + // REQUIRED; Match value. + MatchValues []*string `json:"matchValues,omitempty"` + + // REQUIRED; List of match variables. + MatchVariables []*MatchVariable `json:"matchVariables,omitempty"` + + // REQUIRED; The operator to be matched. + Operator *WebApplicationFirewallOperator `json:"operator,omitempty"` + + // Whether this is negate condition or not. + NegationConditon *bool `json:"negationConditon,omitempty"` + + // List of transforms. + Transforms []*WebApplicationFirewallTransform `json:"transforms,omitempty"` +} + +// MatchVariable - Define match variables. +type MatchVariable struct { + // REQUIRED; Match Variable. + VariableName *WebApplicationFirewallMatchVariable `json:"variableName,omitempty"` + + // The selector of match variable. + Selector *string `json:"selector,omitempty"` +} + +// MatchedRule - Matched rule. +type MatchedRule struct { + // The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. + Action *string `json:"action,omitempty"` + + // Name of the matched network security rule. + RuleName *string `json:"ruleName,omitempty"` +} + +// MetricSpecification - Description of metrics specification. +type MetricSpecification struct { + // The aggregation type. + AggregationType *string `json:"aggregationType,omitempty"` + + // List of availability. + Availabilities []*Availability `json:"availabilities,omitempty"` + + // List of dimensions. + Dimensions []*Dimension `json:"dimensions,omitempty"` + + // The description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // The display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + + // Whether regional MDM account enabled. + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` + + // Whether gaps would be filled with zeros. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + + // Whether the metric is internal. + IsInternal *bool `json:"isInternal,omitempty"` + + // Pattern for the filter of the metric. + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + + // The name of the metric. + Name *string `json:"name,omitempty"` + + // The resource Id dimension name override. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` + + // The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + + // The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + + // Units the metric to be displayed in. + Unit *string `json:"unit,omitempty"` +} + +// NatGateway - Nat Gateway resource. +type NatGateway struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Nat Gateway properties. + Properties *NatGatewayPropertiesFormat `json:"properties,omitempty"` + + // The nat gateway SKU. + SKU *NatGatewaySKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting the zone in which Nat Gateway should be deployed. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// NatGatewayListResult - Response for ListNatGateways API service call. +type NatGatewayListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of Nat Gateways that exists in a resource group. + Value []*NatGateway `json:"value,omitempty"` +} + +// NatGatewayPropertiesFormat - Nat Gateway properties. +type NatGatewayPropertiesFormat struct { + // The idle timeout of the nat gateway. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // An array of public ip addresses associated with the nat gateway resource. + PublicIPAddresses []*SubResource `json:"publicIpAddresses,omitempty"` + + // An array of public ip prefixes associated with the nat gateway resource. + PublicIPPrefixes []*SubResource `json:"publicIpPrefixes,omitempty"` + + // READ-ONLY; The provisioning state of the NAT gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the NAT gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to the subnets using this nat gateway resource. + Subnets []*SubResource `json:"subnets,omitempty" azure:"ro"` +} + +// NatGatewaySKU - SKU of nat gateway. +type NatGatewaySKU struct { + // Name of Nat Gateway SKU. + Name *NatGatewaySKUName `json:"name,omitempty"` +} + +// NatGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the NatGatewaysClient.BeginCreateOrUpdate +// method. +type NatGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NatGatewaysClientBeginDeleteOptions contains the optional parameters for the NatGatewaysClient.BeginDelete method. +type NatGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NatGatewaysClientGetOptions contains the optional parameters for the NatGatewaysClient.Get method. +type NatGatewaysClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// NatGatewaysClientListAllOptions contains the optional parameters for the NatGatewaysClient.ListAll method. +type NatGatewaysClientListAllOptions struct { + // placeholder for future optional parameters +} + +// NatGatewaysClientListOptions contains the optional parameters for the NatGatewaysClient.List method. +type NatGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// NatGatewaysClientUpdateTagsOptions contains the optional parameters for the NatGatewaysClient.UpdateTags method. +type NatGatewaysClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// NatRule - Rule of type nat. +type NatRule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType `json:"ruleType,omitempty"` + + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of destination ports. + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols []*FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + + // Name of the rule. + Name *string `json:"name,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` + + // The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + + // The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + + // The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type NatRule. +func (n *NatRule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Name: n.Name, + Description: n.Description, + RuleType: n.RuleType, + } +} + +// NatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type NatRulePortMapping struct { + // Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` + + // Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + + // Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` +} + +// NatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the NatRulesClient.BeginCreateOrUpdate method. +type NatRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NatRulesClientBeginDeleteOptions contains the optional parameters for the NatRulesClient.BeginDelete method. +type NatRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NatRulesClientGetOptions contains the optional parameters for the NatRulesClient.Get method. +type NatRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// NatRulesClientListByVPNGatewayOptions contains the optional parameters for the NatRulesClient.ListByVPNGateway method. +type NatRulesClientListByVPNGatewayOptions struct { + // placeholder for future optional parameters +} + +// NextHopParameters - Parameters that define the source and destination endpoint. +type NextHopParameters struct { + // REQUIRED; The destination IP address. + DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` + + // REQUIRED; The source IP address. + SourceIPAddress *string `json:"sourceIPAddress,omitempty"` + + // REQUIRED; The resource identifier of the target resource against which the action is to be performed. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. + // Otherwise optional). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// NextHopResult - The information about next hop from the specified VM. +type NextHopResult struct { + // Next hop IP Address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + + // Next hop type. + NextHopType *NextHopType `json:"nextHopType,omitempty"` + + // The resource identifier for the route table associated with the route being returned. If the route being returned does + // not correspond to any user created routes then this field will be the string + // 'System Route'. + RouteTableID *string `json:"routeTableId,omitempty"` +} + +// O365BreakOutCategoryPolicies - Office365 breakout categories. +type O365BreakOutCategoryPolicies struct { + // Flag to control allow category. + Allow *bool `json:"allow,omitempty"` + + // Flag to control default category. + Default *bool `json:"default,omitempty"` + + // Flag to control optimize category. + Optimize *bool `json:"optimize,omitempty"` +} + +// O365PolicyProperties - The Office365 breakout policy. +type O365PolicyProperties struct { + // Office365 breakout categories. + BreakOutCategories *O365BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Office365PolicyProperties - Network Virtual Appliance Sku Properties. +type Office365PolicyProperties struct { + // Office 365 breakout categories. + BreakOutCategories *BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Operation - Network REST API operation definition. +type Operation struct { + // Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + + // Origin of the operation. + Origin *string `json:"origin,omitempty"` + + // Operation properties format. + Properties *OperationPropertiesFormat `json:"properties,omitempty"` +} + +// OperationDisplay - Display metadata associated with the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string `json:"description,omitempty"` + + // Type of the operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + + // Service provider: Microsoft Network. + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationListResult - Result of the request to list Network operations. It contains a list of operations and a URL link +// to get the next set of results. +type OperationListResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of Network operations supported by the Network resource provider. + Value []*Operation `json:"value,omitempty"` +} + +// OperationPropertiesFormat - Description of operation properties format. +type OperationPropertiesFormat struct { + // Specification of the service. + ServiceSpecification *OperationPropertiesFormatServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationPropertiesFormatServiceSpecification - Specification of the service. +type OperationPropertiesFormatServiceSpecification struct { + // Operation log specification. + LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty"` + + // Operation service specification. + MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OrderBy - Describes a column to sort +type OrderBy struct { + // Describes the actual column name to sort by + Field *string `json:"field,omitempty"` + + // Describes if results should be in ascending/descending order + Order *FirewallPolicyIDPSQuerySortOrder `json:"order,omitempty"` +} + +// OutboundRule - Outbound rule of the load balancer. +type OutboundRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used + // to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer outbound rule. + Properties *OutboundRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OutboundRulePropertiesFormat - Outbound rule of the load balancer. +type OutboundRulePropertiesFormat struct { + // REQUIRED; A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + + // REQUIRED; The Frontend IP addresses of the load balancer. + FrontendIPConfigurations []*SubResource `json:"frontendIPConfigurations,omitempty"` + + // REQUIRED; The protocol for the outbound rule in load balancer. + Protocol *LoadBalancerOutboundRuleProtocol `json:"protocol,omitempty"` + + // The number of outbound ports to be used for NAT. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + + // Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used + // when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + + // The timeout for the TCP idle connection. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // READ-ONLY; The provisioning state of the outbound rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// OwaspCrsExclusionEntry - Allow to exclude some variable satisfy the condition for the WAF check. +type OwaspCrsExclusionEntry struct { + // REQUIRED; The variable to be excluded. + MatchVariable *OwaspCrsExclusionEntryMatchVariable `json:"matchVariable,omitempty"` + + // REQUIRED; When matchVariable is a collection, operator used to specify which elements in the collection this exclusion + // applies to. + Selector *string `json:"selector,omitempty"` + + // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this + // exclusion applies to. + SelectorMatchOperator *OwaspCrsExclusionEntrySelectorMatchOperator `json:"selectorMatchOperator,omitempty"` + + // The managed rule sets that are associated with the exclusion. + ExclusionManagedRuleSets []*ExclusionManagedRuleSet `json:"exclusionManagedRuleSets,omitempty"` +} + +// P2SConnectionConfiguration Resource. +type P2SConnectionConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the P2S connection configuration. + Properties *P2SConnectionConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// P2SConnectionConfigurationProperties - Parameters for P2SConnectionConfiguration. +type P2SConnectionConfigurationProperties struct { + // Flag indicating whether the enable internet security flag is turned on for the P2S Connections or not. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + + // The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + + // READ-ONLY; List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to. + ConfigurationPolicyGroupAssociations []*SubResource `json:"configurationPolicyGroupAssociations,omitempty" azure:"ro"` + + // READ-ONLY; List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to. + PreviousConfigurationPolicyGroupAssociations []*VPNServerConfigurationPolicyGroup `json:"previousConfigurationPolicyGroupAssociations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the P2SConnectionConfiguration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// P2SVPNConnectionHealth - P2S Vpn connection detailed health written to sas url. +type P2SVPNConnectionHealth struct { + // Returned sas url of the blob to which the p2s vpn connection detailed health will be written. + SasURL *string `json:"sasUrl,omitempty"` +} + +// P2SVPNConnectionHealthRequest - List of P2S Vpn connection health request. +type P2SVPNConnectionHealthRequest struct { + // The sas-url to download the P2S Vpn connection health detail. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` + + // The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. + VPNUserNamesFilter []*string `json:"vpnUserNamesFilter,omitempty"` +} + +// P2SVPNConnectionRequest - List of p2s vpn connections to be disconnected. +type P2SVPNConnectionRequest struct { + // List of p2s vpn connection Ids. + VPNConnectionIDs []*string `json:"vpnConnectionIds,omitempty"` +} + +// P2SVPNGateway - P2SVpnGateway Resource. +type P2SVPNGateway struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the P2SVpnGateway. + Properties *P2SVPNGatewayProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// P2SVPNGatewayProperties - Parameters for P2SVpnGateway. +type P2SVPNGatewayProperties struct { + // List of all customer specified DNS servers IP addresses. + CustomDNSServers []*string `json:"customDnsServers,omitempty"` + + // Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` + + // List of all p2s connection configurations of the gateway. + P2SConnectionConfigurations []*P2SConnectionConfiguration `json:"p2SConnectionConfigurations,omitempty"` + + // The scale unit for this p2s vpn gateway. + VPNGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + + // The VpnServerConfiguration to which the p2sVpnGateway is attached to. + VPNServerConfiguration *SubResource `json:"vpnServerConfiguration,omitempty"` + + // The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + + // READ-ONLY; The provisioning state of the P2S VPN gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; All P2S VPN clients' connection health status. + VPNClientConnectionHealth *VPNClientConnectionHealth `json:"vpnClientConnectionHealth,omitempty" azure:"ro"` +} + +// P2SVPNGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginCreateOrUpdate +// method. +type P2SVPNGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginDeleteOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginDelete method. +type P2SVPNGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginDisconnectP2SVPNConnections +// method. +type P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginGenerateVPNProfileOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGenerateVPNProfile +// method. +type P2SVPNGatewaysClientBeginGenerateVPNProfileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealthDetailed +// method. +type P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealth +// method. +type P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginResetOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginReset method. +type P2SVPNGatewaysClientBeginResetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginUpdateTags +// method. +type P2SVPNGatewaysClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// P2SVPNGatewaysClientGetOptions contains the optional parameters for the P2SVPNGatewaysClient.Get method. +type P2SVPNGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// P2SVPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the P2SVPNGatewaysClient.ListByResourceGroup +// method. +type P2SVPNGatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// P2SVPNGatewaysClientListOptions contains the optional parameters for the P2SVPNGatewaysClient.List method. +type P2SVPNGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// P2SVPNProfileParameters - Vpn Client Parameters for package generation. +type P2SVPNProfileParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod `json:"authenticationMethod,omitempty"` +} + +// PacketCapture - Parameters that define the create packet capture operation. +type PacketCapture struct { + // REQUIRED; Properties of the packet capture. + Properties *PacketCaptureParameters `json:"properties,omitempty"` +} + +// PacketCaptureFilter - Filter that is applied to packet capture request. Multiple filters can be applied. +type PacketCaptureFilter struct { + // Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. + // "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not currently + // supported. Mixing ranges with multiple entries not currently supported. Default = null. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + + // Local port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple + // ranges not currently supported. Mixing ranges with multiple entries not + // currently supported. Default = null. + LocalPort *string `json:"localPort,omitempty"` + + // Protocol to be filtered on. + Protocol *PcProtocol `json:"protocol,omitempty"` + + // Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. + // "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges not currently + // supported. Mixing ranges with multiple entries not currently supported. Default = null. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + + // Remote port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. + // Multiple ranges not currently supported. Mixing ranges with multiple entries not + // currently supported. Default = null. + RemotePort *string `json:"remotePort,omitempty"` +} + +// PacketCaptureListResult - List of packet capture sessions. +type PacketCaptureListResult struct { + // Information about packet capture sessions. + Value []*PacketCaptureResult `json:"value,omitempty"` +} + +// PacketCaptureMachineScope - A list of AzureVMSS instances which can be included or excluded to run packet capture. If both +// included and excluded are empty, then the packet capture will run on all instances of AzureVMSS. +type PacketCaptureMachineScope struct { + // List of AzureVMSS instances which has to be excluded from the AzureVMSS from running packet capture. + Exclude []*string `json:"exclude,omitempty"` + + // List of AzureVMSS instances to run packet capture on. + Include []*string `json:"include,omitempty"` +} + +// PacketCaptureParameters - Parameters that define the create packet capture operation. +type PacketCaptureParameters struct { + // REQUIRED; The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + + // REQUIRED; The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string `json:"target,omitempty"` + + // Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + + // A list of packet capture filters. + Filters []*PacketCaptureFilter `json:"filters,omitempty"` + + // A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are + // empty, then the packet capture will run on all instances of AzureVMSS. + Scope *PacketCaptureMachineScope `json:"scope,omitempty"` + + // Target type of the resource provided. + TargetType *PacketCaptureTargetType `json:"targetType,omitempty"` + + // Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + + // Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` +} + +// PacketCaptureQueryStatusResult - Status of packet capture session. +type PacketCaptureQueryStatusResult struct { + // The start time of the packet capture session. + CaptureStartTime *time.Time `json:"captureStartTime,omitempty"` + + // The ID of the packet capture resource. + ID *string `json:"id,omitempty"` + + // The name of the packet capture resource. + Name *string `json:"name,omitempty"` + + // List of errors of packet capture session. + PacketCaptureError []*PcError `json:"packetCaptureError,omitempty"` + + // The status of the packet capture session. + PacketCaptureStatus *PcStatus `json:"packetCaptureStatus,omitempty"` + + // The reason the current packet capture session was stopped. + StopReason *string `json:"stopReason,omitempty"` +} + +// PacketCaptureResult - Information about packet capture session. +type PacketCaptureResult struct { + // Properties of the packet capture result. + Properties *PacketCaptureResultProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; ID of the packet capture operation. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the packet capture session. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// PacketCaptureResultProperties - The properties of a packet capture session. +type PacketCaptureResultProperties struct { + // REQUIRED; The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + + // REQUIRED; The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string `json:"target,omitempty"` + + // Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + + // A list of packet capture filters. + Filters []*PacketCaptureFilter `json:"filters,omitempty"` + + // A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are + // empty, then the packet capture will run on all instances of AzureVMSS. + Scope *PacketCaptureMachineScope `json:"scope,omitempty"` + + // Target type of the resource provided. + TargetType *PacketCaptureTargetType `json:"targetType,omitempty"` + + // Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + + // Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` + + // READ-ONLY; The provisioning state of the packet capture session. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PacketCaptureStorageLocation - The storage location for a packet capture session. +type PacketCaptureStorageLocation struct { + // A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it + // must start with /var/captures. Required if no storage ID is provided, otherwise + // optional. + FilePath *string `json:"filePath,omitempty"` + + // The ID of the storage account to save the packet capture session. Required if no local file path is provided. + StorageID *string `json:"storageId,omitempty"` + + // The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet + // capture. + StoragePath *string `json:"storagePath,omitempty"` +} + +// PacketCapturesClientBeginCreateOptions contains the optional parameters for the PacketCapturesClient.BeginCreate method. +type PacketCapturesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PacketCapturesClientBeginDeleteOptions contains the optional parameters for the PacketCapturesClient.BeginDelete method. +type PacketCapturesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PacketCapturesClientBeginGetStatusOptions contains the optional parameters for the PacketCapturesClient.BeginGetStatus +// method. +type PacketCapturesClientBeginGetStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PacketCapturesClientBeginStopOptions contains the optional parameters for the PacketCapturesClient.BeginStop method. +type PacketCapturesClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PacketCapturesClientGetOptions contains the optional parameters for the PacketCapturesClient.Get method. +type PacketCapturesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PacketCapturesClientListOptions contains the optional parameters for the PacketCapturesClient.List method. +type PacketCapturesClientListOptions struct { + // placeholder for future optional parameters +} + +// Parameters for an Action. +type Parameter struct { + // List of AS paths. + AsPath []*string `json:"asPath,omitempty"` + + // List of BGP communities. + Community []*string `json:"community,omitempty"` + + // List of route prefixes. + RoutePrefix []*string `json:"routePrefix,omitempty"` +} + +// PatchObject - Object for patch operations. +type PatchObject struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// PatchRouteFilter - Route Filter Resource. +type PatchRouteFilter struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the route filter. + Properties *RouteFilterPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PatchRouteFilterRule - Route Filter Rule Resource. +type PatchRouteFilterRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the route filter rule. + Properties *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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" azure:"ro"` +} + +// PeerExpressRouteCircuitConnection - Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. +type PeerExpressRouteCircuitConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the peer express route circuit connection. + Properties *PeerExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PeerExpressRouteCircuitConnectionListResult - Response for ListPeeredConnections API service call retrieves all global +// reach peer circuit connections that belongs to a Private Peering for an ExpressRouteCircuit. +type PeerExpressRouteCircuitConnectionListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. + Value []*PeerExpressRouteCircuitConnection `json:"value,omitempty"` +} + +// PeerExpressRouteCircuitConnectionPropertiesFormat - Properties of the peer express route circuit connection. +type PeerExpressRouteCircuitConnectionPropertiesFormat struct { + // /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // The resource guid of the authorization used for the express route circuit connection. + AuthResourceGUID *string `json:"authResourceGuid,omitempty"` + + // The name of the express route circuit connection resource. + ConnectionName *string `json:"connectionName,omitempty"` + + // Reference to Express Route Circuit Private Peering Resource of the circuit. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + + // Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + + // READ-ONLY; Express Route Circuit connection state. + CircuitConnectionStatus *CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the peer express route circuit connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PeerExpressRouteCircuitConnectionsClientGetOptions contains the optional parameters for the PeerExpressRouteCircuitConnectionsClient.Get +// method. +type PeerExpressRouteCircuitConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PeerExpressRouteCircuitConnectionsClientListOptions contains the optional parameters for the PeerExpressRouteCircuitConnectionsClient.List +// method. +type PeerExpressRouteCircuitConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PeerRoute - Peer routing details. +type PeerRoute struct { + // READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty" azure:"ro"` + + // READ-ONLY; The peer's local address. + LocalAddress *string `json:"localAddress,omitempty" azure:"ro"` + + // READ-ONLY; The route's network prefix. + Network *string `json:"network,omitempty" azure:"ro"` + + // READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty" azure:"ro"` + + // READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty" azure:"ro"` + + // READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty" azure:"ro"` + + // READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty" azure:"ro"` +} + +// PeerRouteList - List of virtual router peer routes. +type PeerRouteList struct { + // List of peer routes. + Value []*PeerRoute `json:"value,omitempty"` +} + +// PolicySettings - Defines contents of a web application firewall global configuration. +type PolicySettings struct { + // Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` + + // Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + + // The mode of the policy. + Mode *WebApplicationFirewallMode `json:"mode,omitempty"` + + // Whether to allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` + + // The state of the policy. + State *WebApplicationFirewallEnabledState `json:"state,omitempty"` +} + +// PrepareNetworkPoliciesRequest - Details of PrepareNetworkPolicies for Subnet. +type PrepareNetworkPoliciesRequest struct { + // A list of NetworkIntentPolicyConfiguration. + NetworkIntentPolicyConfigurations []*IntentPolicyConfiguration `json:"networkIntentPolicyConfigurations,omitempty"` + + // The name of the service for which subnet is being prepared for. + ServiceName *string `json:"serviceName,omitempty"` +} + +// PrivateDNSZoneConfig - PrivateDnsZoneConfig resource. +type PrivateDNSZoneConfig struct { + // 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"` + + // Properties of the private dns zone configuration. + Properties *PrivateDNSZonePropertiesFormat `json:"properties,omitempty"` +} + +// PrivateDNSZoneGroup - Private dns zone group resource. +type PrivateDNSZoneGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the private dns zone group. + Properties *PrivateDNSZoneGroupPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// PrivateDNSZoneGroupListResult - Response for the ListPrivateDnsZoneGroups API service call. +type PrivateDNSZoneGroupListResult struct { + // A list of private dns zone group resources in a private endpoint. + Value []*PrivateDNSZoneGroup `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateDNSZoneGroupPropertiesFormat - Properties of the private dns zone group. +type PrivateDNSZoneGroupPropertiesFormat struct { + // A collection of private dns zone configurations of the private dns zone group. + PrivateDNSZoneConfigs []*PrivateDNSZoneConfig `json:"privateDnsZoneConfigs,omitempty"` + + // READ-ONLY; The provisioning state of the private dns zone group resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.BeginCreateOrUpdate +// method. +type PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateDNSZoneGroupsClientBeginDeleteOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.BeginDelete +// method. +type PrivateDNSZoneGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateDNSZoneGroupsClientGetOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.Get method. +type PrivateDNSZoneGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateDNSZoneGroupsClientListOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.List method. +type PrivateDNSZoneGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateDNSZonePropertiesFormat - Properties of the private dns zone configuration resource. +type PrivateDNSZonePropertiesFormat struct { + // The resource id of the private dns zone. + PrivateDNSZoneID *string `json:"privateDnsZoneId,omitempty"` + + // READ-ONLY; A collection of information regarding a recordSet, holding information to identify private resources. + RecordSets []*RecordSet `json:"recordSets,omitempty" azure:"ro"` +} + +// PrivateEndpoint - Private endpoint resource. +type PrivateEndpoint struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the private endpoint. + Properties *PrivateEndpointProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnection resource. +type PrivateEndpointConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the private end point connection. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionListResult - Response for the ListPrivateEndpointConnection API service call. +type PrivateEndpointConnectionListResult struct { + // A list of PrivateEndpointConnection resources for a specific private link service. + Value []*PrivateEndpointConnection `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty" azure:"ro"` + + // READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateEndpointIPConfiguration - An IP Configuration of the private endpoint. +type PrivateEndpointIPConfiguration struct { + // The name of the resource that is unique within a resource group. + Name *string `json:"name,omitempty"` + + // Properties of private endpoint IP configurations. + Properties *PrivateEndpointIPConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointIPConfigurationProperties - Properties of an IP Configuration of the private endpoint. +type PrivateEndpointIPConfigurationProperties struct { + // The ID of a group obtained from the remote resource that this private endpoint should connect to. + GroupID *string `json:"groupId,omitempty"` + + // The member name of a group obtained from the remote resource that this private endpoint should connect to. + MemberName *string `json:"memberName,omitempty"` + + // A private ip address obtained from the private endpoint's subnet. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` +} + +// PrivateEndpointListResult - Response for the ListPrivateEndpoints API service call. +type PrivateEndpointListResult struct { + // A list of private endpoint resources in a resource group. + Value []*PrivateEndpoint `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateEndpointProperties - Properties of the private endpoint. +type PrivateEndpointProperties struct { + // Application security groups in which the private endpoint IP configuration is included. + ApplicationSecurityGroups []*ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + + // An array of custom dns configurations. + CustomDNSConfigs []*CustomDNSConfigPropertiesFormat `json:"customDnsConfigs,omitempty"` + + // The custom name of the network interface attached to the private endpoint. + CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,omitempty"` + + // A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints. + IPConfigurations []*PrivateEndpointIPConfiguration `json:"ipConfigurations,omitempty"` + + // A grouping of information about the connection to the remote resource. Used when the network admin does not have access + // to approve connections to the remote resource. + ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` + + // A grouping of information about the connection to the remote resource. + PrivateLinkServiceConnections []*PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"` + + // The ID of the subnet from which the private IP will be allocated. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; An array of references to the network interfaces created for this private endpoint. + NetworkInterfaces []*Interface `json:"networkInterfaces,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the private endpoint resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateEndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointsClient.BeginDelete method. +type PrivateEndpointsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointsClientGetOptions contains the optional parameters for the PrivateEndpointsClient.Get method. +type PrivateEndpointsClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// PrivateEndpointsClientListBySubscriptionOptions contains the optional parameters for the PrivateEndpointsClient.ListBySubscription +// method. +type PrivateEndpointsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointsClientListOptions contains the optional parameters for the PrivateEndpointsClient.List method. +type PrivateEndpointsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkService - Private link service resource. +type PrivateLinkService struct { + // The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the private link service. + Properties *PrivateLinkServiceProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnection resource. +type PrivateLinkServiceConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the private link service connection. + Properties *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnectionProperties - Properties of the PrivateLinkServiceConnection. +type PrivateLinkServiceConnectionProperties struct { + // The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. + GroupIDs []*string `json:"groupIds,omitempty"` + + // A collection of read-only information about the state of the connection to the remote resource. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // The resource id of private link service. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + + // A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string `json:"requestMessage,omitempty"` + + // READ-ONLY; The provisioning state of the private link service connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *string `json:"status,omitempty"` +} + +// PrivateLinkServiceIPConfiguration - The private link service ip configuration. +type PrivateLinkServiceIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of private link service ip configuration. + Name *string `json:"name,omitempty"` + + // Properties of the private link service ip configuration. + Properties *PrivateLinkServiceIPConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkServiceIPConfigurationProperties - Properties of private link service IP configuration. +type PrivateLinkServiceIPConfigurationProperties struct { + // Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + + // The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + + // Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + + // READ-ONLY; The provisioning state of the private link service IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateLinkServiceListResult - Response for the ListPrivateLinkService API service call. +type PrivateLinkServiceListResult struct { + // A list of PrivateLinkService resources in a resource group. + Value []*PrivateLinkService `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateLinkServiceProperties - Properties of the private link service. +type PrivateLinkServiceProperties struct { + // The auto-approval list of the private link service. + AutoApproval *PrivateLinkServicePropertiesAutoApproval `json:"autoApproval,omitempty"` + + // Whether the private link service is enabled for proxy protocol or not. + EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"` + + // The list of Fqdn. + Fqdns []*string `json:"fqdns,omitempty"` + + // An array of private link service IP configurations. + IPConfigurations []*PrivateLinkServiceIPConfiguration `json:"ipConfigurations,omitempty"` + + // An array of references to the load balancer IP configurations. + LoadBalancerFrontendIPConfigurations []*FrontendIPConfiguration `json:"loadBalancerFrontendIpConfigurations,omitempty"` + + // The visibility list of the private link service. + Visibility *PrivateLinkServicePropertiesVisibility `json:"visibility,omitempty"` + + // READ-ONLY; The alias of the private link service. + Alias *string `json:"alias,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to the network interfaces created for this private link service. + NetworkInterfaces []*Interface `json:"networkInterfaces,omitempty" azure:"ro"` + + // READ-ONLY; An array of list about connections to the private endpoint. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the private link service resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateLinkServicePropertiesAutoApproval - The auto-approval list of the private link service. +type PrivateLinkServicePropertiesAutoApproval struct { + // The list of subscriptions. + Subscriptions []*string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServicePropertiesVisibility - The visibility list of the private link service. +type PrivateLinkServicePropertiesVisibility struct { + // The list of subscriptions. + Subscriptions []*string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServiceVisibility - Response for the CheckPrivateLinkServiceVisibility API service call. +type PrivateLinkServiceVisibility struct { + // Private Link Service Visibility (True/False). + Visible *bool `json:"visible,omitempty"` +} + +// PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions contains the optional parameters +// for the PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibilityByResourceGroup method. +type PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions contains the optional parameters for the PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibility +// method. +type PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesClient.BeginCreateOrUpdate +// method. +type PrivateLinkServicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkServicesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesClient.BeginDelete +// method. +type PrivateLinkServicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions contains the optional parameters for the PrivateLinkServicesClient.BeginDeletePrivateEndpointConnection +// method. +type PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkServicesClientGetOptions contains the optional parameters for the PrivateLinkServicesClient.Get method. +type PrivateLinkServicesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// PrivateLinkServicesClientGetPrivateEndpointConnectionOptions contains the optional parameters for the PrivateLinkServicesClient.GetPrivateEndpointConnection +// method. +type PrivateLinkServicesClientGetPrivateEndpointConnectionOptions struct { + // Expands referenced resources. + Expand *string +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions contains the optional parameters for +// the PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup method. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions contains the optional parameters for the PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices +// method. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListBySubscriptionOptions contains the optional parameters for the PrivateLinkServicesClient.ListBySubscription +// method. +type PrivateLinkServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListOptions contains the optional parameters for the PrivateLinkServicesClient.List method. +type PrivateLinkServicesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the PrivateLinkServicesClient.ListPrivateEndpointConnections +// method. +type PrivateLinkServicesClientListPrivateEndpointConnectionsOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServicesClientUpdatePrivateEndpointConnectionOptions contains the optional parameters for the PrivateLinkServicesClient.UpdatePrivateEndpointConnection +// method. +type PrivateLinkServicesClientUpdatePrivateEndpointConnectionOptions struct { + // placeholder for future optional parameters +} + +// Probe - A load balancer probe. +type Probe struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access + // the resource. + Name *string `json:"name,omitempty"` + + // Properties of load balancer probe. + Properties *ProbePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProbePropertiesFormat - Load balancer probe resource. +type ProbePropertiesFormat struct { + // REQUIRED; The port for communicating the probe. Possible values range from 1 to 65535, inclusive. + Port *int32 `json:"port,omitempty"` + + // REQUIRED; The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. + // If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required + // for the probe to be successful. + Protocol *ProbeProtocol `json:"protocol,omitempty"` + + // The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly + // less than half the allocated timeout period (in seconds) which allows two full + // probes before taking the instance out of rotation. The default value is 15, the minimum value is 5. + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + + // The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. + // This values allows endpoints to be taken out of rotation faster or slower than + // the typical times used in Azure. + NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` + + // The number of consecutive successful or failed probes in order to allow or deny traffic from being delivered to this endpoint. + // After failing the number of consecutive probes equal to this value, the + // endpoint will be taken out of rotation and require the same number of successful consecutive probes to be placed back in + // rotation. + ProbeThreshold *int32 `json:"probeThreshold,omitempty"` + + // The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is + // not allowed. There is no default value. + RequestPath *string `json:"requestPath,omitempty"` + + // READ-ONLY; The load balancer rules that use this probe. + LoadBalancingRules []*SubResource `json:"loadBalancingRules,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the probe resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// Profile - Network profile resource. +type Profile struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Network profile properties. + Properties *ProfilePropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProfileListResult - Response for ListNetworkProfiles API service call. +type ProfileListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of network profiles that exist in a resource group. + Value []*Profile `json:"value,omitempty"` +} + +// ProfilePropertiesFormat - Network profile properties. +type ProfilePropertiesFormat struct { + // List of chid container network interface configurations. + ContainerNetworkInterfaceConfigurations []*ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfigurations,omitempty"` + + // READ-ONLY; List of child container network interfaces. + ContainerNetworkInterfaces []*ContainerNetworkInterface `json:"containerNetworkInterfaces,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the network profile resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the network profile resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// ProfilesClientBeginDeleteOptions contains the optional parameters for the ProfilesClient.BeginDelete method. +type ProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProfilesClientCreateOrUpdateOptions contains the optional parameters for the ProfilesClient.CreateOrUpdate method. +type ProfilesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ProfilesClientGetOptions contains the optional parameters for the ProfilesClient.Get method. +type ProfilesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// ProfilesClientListAllOptions contains the optional parameters for the ProfilesClient.ListAll method. +type ProfilesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// ProfilesClientListOptions contains the optional parameters for the ProfilesClient.List method. +type ProfilesClientListOptions struct { + // placeholder for future optional parameters +} + +// ProfilesClientUpdateTagsOptions contains the optional parameters for the ProfilesClient.UpdateTags method. +type ProfilesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// PropagatedRouteTable - The list of RouteTables to advertise the routes to. +type PropagatedRouteTable struct { + // The list of resource ids of all the RouteTables. + IDs []*SubResource `json:"ids,omitempty"` + + // The list of labels. + Labels []*string `json:"labels,omitempty"` +} + +// ProtocolConfiguration - Configuration of the protocol. +type ProtocolConfiguration struct { + // HTTP configuration of the connectivity check. + HTTPConfiguration *HTTPConfiguration `json:"HTTPConfiguration,omitempty"` +} + +// PublicIPAddress - Public IP address resource. +type PublicIPAddress struct { + // The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Public IP address properties. + Properties *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` + + // The public IP address SKU. + SKU *PublicIPAddressSKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PublicIPAddressDNSSettings - Contains FQDN of the DNS record associated with the public IP address. +type PublicIPAddressDNSSettings struct { + // The domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified + // domain name associated with the public IP address. If a domain name label is + // specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + + // The Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel + // and the regionalized DNS zone. + Fqdn *string `json:"fqdn,omitempty"` + + // The reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn + // is specified, then a PTR DNS record is created pointing from the IP address in + // the in-addr.arpa domain to the reverse FQDN. + ReverseFqdn *string `json:"reverseFqdn,omitempty"` +} + +// PublicIPAddressListResult - Response for ListPublicIpAddresses API service call. +type PublicIPAddressListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of public IP addresses that exists in a resource group. + Value []*PublicIPAddress `json:"value,omitempty"` +} + +// PublicIPAddressPropertiesFormat - Public IP address properties. +type PublicIPAddressPropertiesFormat struct { + // The FQDN of the DNS record associated with the public IP address. + DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` + + // The DDoS protection custom policy associated with the public IP address. + DdosSettings *DdosSettings `json:"ddosSettings,omitempty"` + + // Specify what happens to the public IP address when the VM using it is deleted + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + + // The IP address associated with the public IP address resource. + IPAddress *string `json:"ipAddress,omitempty"` + + // The list of tags associated with the public IP address. + IPTags []*IPTag `json:"ipTags,omitempty"` + + // The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + + // The linked public IP address of the public IP address resource. + LinkedPublicIPAddress *PublicIPAddress `json:"linkedPublicIPAddress,omitempty"` + + // Migration phase of Public IP Address. + MigrationPhase *PublicIPAddressMigrationPhase `json:"migrationPhase,omitempty"` + + // The NatGateway for the Public IP address. + NatGateway *NatGateway `json:"natGateway,omitempty"` + + // The public IP address version. + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + + // The public IP address allocation method. + PublicIPAllocationMethod *IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + + // The Public IP Prefix this Public IP Address should be allocated from. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + + // The service public IP address of the public IP address resource. + ServicePublicIPAddress *PublicIPAddress `json:"servicePublicIPAddress,omitempty"` + + // READ-ONLY; The IP configuration associated with the public IP address. + IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the public IP address resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the public IP address resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// PublicIPAddressSKU - SKU of a public IP address. +type PublicIPAddressSKU struct { + // Name of a public IP address SKU. + Name *PublicIPAddressSKUName `json:"name,omitempty"` + + // Tier of a public IP address SKU. + Tier *PublicIPAddressSKUTier `json:"tier,omitempty"` +} + +// PublicIPAddressesClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicIPAddressesClient.BeginCreateOrUpdate +// method. +type PublicIPAddressesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PublicIPAddressesClientBeginDdosProtectionStatusOptions contains the optional parameters for the PublicIPAddressesClient.BeginDdosProtectionStatus +// method. +type PublicIPAddressesClientBeginDdosProtectionStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PublicIPAddressesClientBeginDeleteOptions contains the optional parameters for the PublicIPAddressesClient.BeginDelete +// method. +type PublicIPAddressesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PublicIPAddressesClientGetCloudServicePublicIPAddressOptions contains the optional parameters for the PublicIPAddressesClient.GetCloudServicePublicIPAddress +// method. +type PublicIPAddressesClientGetCloudServicePublicIPAddressOptions struct { + // Expands referenced resources. + Expand *string +} + +// PublicIPAddressesClientGetOptions contains the optional parameters for the PublicIPAddressesClient.Get method. +type PublicIPAddressesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions contains the optional parameters for the PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress +// method. +type PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions struct { + // Expands referenced resources. + Expand *string +} + +// PublicIPAddressesClientListAllOptions contains the optional parameters for the PublicIPAddressesClient.ListAll method. +type PublicIPAddressesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListCloudServicePublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.ListCloudServicePublicIPAddresses +// method. +type PublicIPAddressesClientListCloudServicePublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.ListCloudServiceRoleInstancePublicIPAddresses +// method. +type PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListOptions contains the optional parameters for the PublicIPAddressesClient.List method. +type PublicIPAddressesClientListOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.ListVirtualMachineScaleSetPublicIPAddresses +// method. +type PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.ListVirtualMachineScaleSetVMPublicIPAddresses +// method. +type PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions struct { + // placeholder for future optional parameters +} + +// PublicIPAddressesClientUpdateTagsOptions contains the optional parameters for the PublicIPAddressesClient.UpdateTags method. +type PublicIPAddressesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// PublicIPDdosProtectionStatusResult - Response for GetPublicIpAddressDdosProtectionStatusOperation API service call. +type PublicIPDdosProtectionStatusResult struct { + // DDoS protection plan Resource Id of a if IP address is protected through a plan. + DdosProtectionPlanID *string `json:"ddosProtectionPlanId,omitempty"` + + // Value indicating whether the IP address is DDoS workload protected or not. + IsWorkloadProtected *IsWorkloadProtected `json:"isWorkloadProtected,omitempty"` + + // IP Address of the Public IP Resource + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + + // Public IP ARM resource ID + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` +} + +// PublicIPPrefix - Public IP prefix resource. +type PublicIPPrefix struct { + // The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Public IP prefix properties. + Properties *PublicIPPrefixPropertiesFormat `json:"properties,omitempty"` + + // The public IP prefix SKU. + SKU *PublicIPPrefixSKU `json:"sku,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones []*string `json:"zones,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PublicIPPrefixListResult - Response for ListPublicIpPrefixes API service call. +type PublicIPPrefixListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of public IP prefixes that exists in a resource group. + Value []*PublicIPPrefix `json:"value,omitempty"` +} + +// PublicIPPrefixPropertiesFormat - Public IP prefix properties. +type PublicIPPrefixPropertiesFormat struct { + // The customIpPrefix that this prefix is associated with. + CustomIPPrefix *SubResource `json:"customIPPrefix,omitempty"` + + // The list of tags associated with the public IP prefix. + IPTags []*IPTag `json:"ipTags,omitempty"` + + // NatGateway of Public IP Prefix. + NatGateway *NatGateway `json:"natGateway,omitempty"` + + // The Length of the Public IP Prefix. + PrefixLength *int32 `json:"prefixLength,omitempty"` + + // The public IP address version. + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + + // READ-ONLY; The allocated Prefix. + IPPrefix *string `json:"ipPrefix,omitempty" azure:"ro"` + + // READ-ONLY; The reference to load balancer frontend IP configuration associated with the public IP prefix. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIpConfiguration,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the public IP prefix resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The list of all referenced PublicIPAddresses. + PublicIPAddresses []*ReferencedPublicIPAddress `json:"publicIPAddresses,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the public IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// PublicIPPrefixSKU - SKU of a public IP prefix. +type PublicIPPrefixSKU struct { + // Name of a public IP prefix SKU. + Name *PublicIPPrefixSKUName `json:"name,omitempty"` + + // Tier of a public IP prefix SKU. + Tier *PublicIPPrefixSKUTier `json:"tier,omitempty"` +} + +// PublicIPPrefixesClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicIPPrefixesClient.BeginCreateOrUpdate +// method. +type PublicIPPrefixesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PublicIPPrefixesClientBeginDeleteOptions contains the optional parameters for the PublicIPPrefixesClient.BeginDelete method. +type PublicIPPrefixesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PublicIPPrefixesClientGetOptions contains the optional parameters for the PublicIPPrefixesClient.Get method. +type PublicIPPrefixesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// PublicIPPrefixesClientListAllOptions contains the optional parameters for the PublicIPPrefixesClient.ListAll method. +type PublicIPPrefixesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// PublicIPPrefixesClientListOptions contains the optional parameters for the PublicIPPrefixesClient.List method. +type PublicIPPrefixesClientListOptions struct { + // placeholder for future optional parameters +} + +// PublicIPPrefixesClientUpdateTagsOptions contains the optional parameters for the PublicIPPrefixesClient.UpdateTags method. +type PublicIPPrefixesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// QosDefinition - Quality of Service defines the traffic configuration between endpoints. Mandatory to have one marking. +type QosDefinition struct { + // Destination IP ranges. + DestinationIPRanges []*QosIPRange `json:"destinationIpRanges,omitempty"` + + // Destination port ranges. + DestinationPortRanges []*QosPortRange `json:"destinationPortRanges,omitempty"` + + // List of markings to be used in the configuration. + Markings []*int32 `json:"markings,omitempty"` + + // RNM supported protocol types. + Protocol *ProtocolType `json:"protocol,omitempty"` + + // Source IP ranges. + SourceIPRanges []*QosIPRange `json:"sourceIpRanges,omitempty"` + + // Sources port ranges. + SourcePortRanges []*QosPortRange `json:"sourcePortRanges,omitempty"` +} + +// QosIPRange - Qos Traffic Profiler IP Range properties. +type QosIPRange struct { + // End IP Address. + EndIP *string `json:"endIP,omitempty"` + + // Start IP Address. + StartIP *string `json:"startIP,omitempty"` +} + +// QosPortRange - Qos Traffic Profiler Port range properties. +type QosPortRange struct { + // Qos Port Range end. + End *int32 `json:"end,omitempty"` + + // Qos Port Range start. + Start *int32 `json:"start,omitempty"` +} + +// QueryInboundNatRulePortMappingRequest - The request for a QueryInboundNatRulePortMapping API. Either IpConfiguration or +// IpAddress should be set +type QueryInboundNatRulePortMappingRequest struct { + // IP address set in load balancer backend address. + IPAddress *string `json:"ipAddress,omitempty"` + + // NetworkInterfaceIPConfiguration set in load balancer backend address. + IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` +} + +// QueryRequestOptions - Query Request Options +type QueryRequestOptions struct { + // When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current + // request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// QueryResults - Query result +type QueryResults struct { + // Number of total records matching the query. + MatchingRecordsCount *int64 `json:"matchingRecordsCount,omitempty"` + + // Array containing the results of the query + Signatures []*SingleQueryResult `json:"signatures,omitempty"` +} + +// QueryTroubleshootingParameters - Parameters that define the resource to query the troubleshooting result. +type QueryTroubleshootingParameters struct { + // REQUIRED; The target resource ID to query the troubleshooting result. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// RadiusServer - Radius Server Settings. +type RadiusServer struct { + // REQUIRED; The address of this radius server. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + + // The initial score assigned to this radius server. + RadiusServerScore *int64 `json:"radiusServerScore,omitempty"` + + // The secret used for this radius server. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` +} + +// RecordSet - A collective group of information about the record set information. +type RecordSet struct { + // Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + + // The private ip address of the private endpoint. + IPAddresses []*string `json:"ipAddresses,omitempty"` + + // Recordset name. + RecordSetName *string `json:"recordSetName,omitempty"` + + // Resource record type. + RecordType *string `json:"recordType,omitempty"` + + // Recordset time to live. + TTL *int32 `json:"ttl,omitempty"` + + // READ-ONLY; The provisioning state of the recordset. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ReferencedPublicIPAddress - Reference to a public IP address. +type ReferencedPublicIPAddress struct { + // The PublicIPAddress Reference. + ID *string `json:"id,omitempty"` +} + +// Resource - Common resource representation. +type Resource struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceNavigationLink resource. +type ResourceNavigationLink struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Resource navigation link properties format. + Properties *ResourceNavigationLinkFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceNavigationLinkFormat - Properties of ResourceNavigationLink. +type ResourceNavigationLinkFormat struct { + // Link to the external resource. + Link *string `json:"link,omitempty"` + + // Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + + // READ-ONLY; The provisioning state of the resource navigation link resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ResourceNavigationLinksClientListOptions contains the optional parameters for the ResourceNavigationLinksClient.List method. +type ResourceNavigationLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// ResourceNavigationLinksListResult - Response for ResourceNavigationLinks_List operation. +type ResourceNavigationLinksListResult struct { + // The resource navigation links in a subnet. + Value []*ResourceNavigationLink `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ResourceSet - The base resource set for visibility and auto-approval. +type ResourceSet struct { + // The list of subscriptions. + Subscriptions []*string `json:"subscriptions,omitempty"` +} + +// RetentionPolicyParameters - Parameters that define the retention policy for flow log. +type RetentionPolicyParameters struct { + // Number of days to retain flow log records. + Days *int32 `json:"days,omitempty"` + + // Flag to enable/disable retention. + Enabled *bool `json:"enabled,omitempty"` +} + +// Route resource. +type Route struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the route. + Properties *RoutePropertiesFormat `json:"properties,omitempty"` + + // The type of the resource. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// RouteFilter - Route Filter Resource. +type RouteFilter struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the route filter. + Properties *RouteFilterPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RouteFilterListResult - Response for the ListRouteFilters API service call. +type RouteFilterListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of route filters in a resource group. + Value []*RouteFilter `json:"value,omitempty"` +} + +// RouteFilterPropertiesFormat - Route Filter Resource. +type RouteFilterPropertiesFormat struct { + // Collection of RouteFilterRules contained within a route filter. + Rules []*RouteFilterRule `json:"rules,omitempty"` + + // READ-ONLY; A collection of references to express route circuit ipv6 peerings. + IPv6Peerings []*ExpressRouteCircuitPeering `json:"ipv6Peerings,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to express route circuit peerings. + Peerings []*ExpressRouteCircuitPeering `json:"peerings,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the route filter resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RouteFilterRule - Route Filter Rule Resource. +type RouteFilterRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // 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"` + + // Properties of the route filter rule. + Properties *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// RouteFilterRuleListResult - Response for the ListRouteFilterRules API service call. +type RouteFilterRuleListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of RouteFilterRules in a resource group. + Value []*RouteFilterRule `json:"value,omitempty"` +} + +// RouteFilterRulePropertiesFormat - Route Filter Rule Resource. +type RouteFilterRulePropertiesFormat struct { + // REQUIRED; The access type of the rule. + Access *Access `json:"access,omitempty"` + + // REQUIRED; The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. + Communities []*string `json:"communities,omitempty"` + + // REQUIRED; The rule type of the rule. + RouteFilterRuleType *RouteFilterRuleType `json:"routeFilterRuleType,omitempty"` + + // READ-ONLY; The provisioning state of the route filter rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RouteFilterRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteFilterRulesClient.BeginCreateOrUpdate +// method. +type RouteFilterRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteFilterRulesClientBeginDeleteOptions contains the optional parameters for the RouteFilterRulesClient.BeginDelete method. +type RouteFilterRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteFilterRulesClientGetOptions contains the optional parameters for the RouteFilterRulesClient.Get method. +type RouteFilterRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RouteFilterRulesClientListByRouteFilterOptions contains the optional parameters for the RouteFilterRulesClient.ListByRouteFilter +// method. +type RouteFilterRulesClientListByRouteFilterOptions struct { + // placeholder for future optional parameters +} + +// RouteFiltersClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteFiltersClient.BeginCreateOrUpdate +// method. +type RouteFiltersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteFiltersClientBeginDeleteOptions contains the optional parameters for the RouteFiltersClient.BeginDelete method. +type RouteFiltersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteFiltersClientGetOptions contains the optional parameters for the RouteFiltersClient.Get method. +type RouteFiltersClientGetOptions struct { + // Expands referenced express route bgp peering resources. + Expand *string +} + +// RouteFiltersClientListByResourceGroupOptions contains the optional parameters for the RouteFiltersClient.ListByResourceGroup +// method. +type RouteFiltersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// RouteFiltersClientListOptions contains the optional parameters for the RouteFiltersClient.List method. +type RouteFiltersClientListOptions struct { + // placeholder for future optional parameters +} + +// RouteFiltersClientUpdateTagsOptions contains the optional parameters for the RouteFiltersClient.UpdateTags method. +type RouteFiltersClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// RouteListResult - Response for the ListRoute API service call. +type RouteListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of routes in a resource group. + Value []*Route `json:"value,omitempty"` +} + +// RouteMap - The RouteMap child resource of a Virtual hub. +type RouteMap struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Properties of the RouteMap resource. + Properties *RouteMapProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // 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" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RouteMapProperties - Properties of RouteMap resource +type RouteMapProperties struct { + // List of connections which have this RoutMap associated for inbound traffic. + AssociatedInboundConnections []*string `json:"associatedInboundConnections,omitempty"` + + // List of connections which have this RoutMap associated for outbound traffic. + AssociatedOutboundConnections []*string `json:"associatedOutboundConnections,omitempty"` + + // List of RouteMap rules to be applied. + Rules []*RouteMapRule `json:"rules,omitempty"` + + // READ-ONLY; The provisioning state of the RouteMap resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RouteMapRule - A RouteMap Rule. +type RouteMapRule struct { + // List of actions which will be applied on a match. + Actions []*Action `json:"actions,omitempty"` + + // List of matching criterion which will be applied to traffic. + MatchCriteria []*Criterion `json:"matchCriteria,omitempty"` + + // The unique name for the rule. + Name *string `json:"name,omitempty"` + + // Next step after rule is evaluated. Current supported behaviors are 'Continue'(to next rule) and 'Terminate'. + NextStepIfMatched *NextStep `json:"nextStepIfMatched,omitempty"` +} + +// RouteMapsClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteMapsClient.BeginCreateOrUpdate +// method. +type RouteMapsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteMapsClientBeginDeleteOptions contains the optional parameters for the RouteMapsClient.BeginDelete method. +type RouteMapsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteMapsClientGetOptions contains the optional parameters for the RouteMapsClient.Get method. +type RouteMapsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RouteMapsClientListOptions contains the optional parameters for the RouteMapsClient.List method. +type RouteMapsClientListOptions struct { + // placeholder for future optional parameters +} + +// RoutePropertiesFormat - Route resource. +type RoutePropertiesFormat struct { + // REQUIRED; The type of Azure hop the packet should be sent to. + NextHopType *RouteNextHopType `json:"nextHopType,omitempty"` + + // The destination CIDR to which the route applies. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // A value indicating whether this route overrides overlapping BGP routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + + // The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + + // READ-ONLY; The provisioning state of the route resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RouteTable - Route table resource. +type RouteTable struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the route table. + Properties *RouteTablePropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RouteTableListResult - Response for the ListRouteTable API service call. +type RouteTableListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of route tables in a resource group. + Value []*RouteTable `json:"value,omitempty"` +} + +// RouteTablePropertiesFormat - Route Table resource. +type RouteTablePropertiesFormat struct { + // Whether to disable the routes learned by BGP on that route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + + // Collection of routes contained within a route table. + Routes []*Route `json:"routes,omitempty"` + + // READ-ONLY; The provisioning state of the route table resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the route table. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet `json:"subnets,omitempty" azure:"ro"` +} + +// RouteTablesClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteTablesClient.BeginCreateOrUpdate +// method. +type RouteTablesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteTablesClientBeginDeleteOptions contains the optional parameters for the RouteTablesClient.BeginDelete method. +type RouteTablesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RouteTablesClientGetOptions contains the optional parameters for the RouteTablesClient.Get method. +type RouteTablesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// RouteTablesClientListAllOptions contains the optional parameters for the RouteTablesClient.ListAll method. +type RouteTablesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// RouteTablesClientListOptions contains the optional parameters for the RouteTablesClient.List method. +type RouteTablesClientListOptions struct { + // placeholder for future optional parameters +} + +// RouteTablesClientUpdateTagsOptions contains the optional parameters for the RouteTablesClient.UpdateTags method. +type RouteTablesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// RoutesClientBeginCreateOrUpdateOptions contains the optional parameters for the RoutesClient.BeginCreateOrUpdate method. +type RoutesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RoutesClientBeginDeleteOptions contains the optional parameters for the RoutesClient.BeginDelete method. +type RoutesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RoutesClientGetOptions contains the optional parameters for the RoutesClient.Get method. +type RoutesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoutesClientListOptions contains the optional parameters for the RoutesClient.List method. +type RoutesClientListOptions struct { + // placeholder for future optional parameters +} + +// RoutingConfiguration - Routing Configuration indicating the associated and propagated route tables for this connection. +type RoutingConfiguration struct { + // The resource id RouteTable associated with this RoutingConfiguration. + AssociatedRouteTable *SubResource `json:"associatedRouteTable,omitempty"` + + // The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes. + InboundRouteMap *SubResource `json:"inboundRouteMap,omitempty"` + + // The resource id of theRouteMap associated with this RoutingConfiguration for outbound advertised routes. + OutboundRouteMap *SubResource `json:"outboundRouteMap,omitempty"` + + // The list of RouteTables to advertise the routes to. + PropagatedRouteTables *PropagatedRouteTable `json:"propagatedRouteTables,omitempty"` + + // List of routes that control routing from VirtualHub into a virtual network connection. + VnetRoutes *VnetRoute `json:"vnetRoutes,omitempty"` +} + +// RoutingIntent - The routing intent child resource of a Virtual hub. +type RoutingIntent struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the RoutingIntent resource. + Properties *RoutingIntentProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RoutingIntentClientBeginCreateOrUpdateOptions contains the optional parameters for the RoutingIntentClient.BeginCreateOrUpdate +// method. +type RoutingIntentClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RoutingIntentClientBeginDeleteOptions contains the optional parameters for the RoutingIntentClient.BeginDelete method. +type RoutingIntentClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RoutingIntentClientGetOptions contains the optional parameters for the RoutingIntentClient.Get method. +type RoutingIntentClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentClientListOptions contains the optional parameters for the RoutingIntentClient.List method. +type RoutingIntentClientListOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentProperties - The properties of a RoutingIntent resource. +type RoutingIntentProperties struct { + // List of routing policies. + RoutingPolicies []*RoutingPolicy `json:"routingPolicies,omitempty"` + + // READ-ONLY; The provisioning state of the RoutingIntent resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RoutingPolicy - The routing policy object used in a RoutingIntent resource. +type RoutingPolicy struct { + // REQUIRED; List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic). + Destinations []*string `json:"destinations,omitempty"` + + // REQUIRED; The unique name for the routing policy. + Name *string `json:"name,omitempty"` + + // REQUIRED; The next hop resource id on which this routing policy is applicable to. + NextHop *string `json:"nextHop,omitempty"` +} + +// Rule of type network. +type Rule struct { + // REQUIRED; Rule Type. + RuleType *FirewallPolicyRuleType `json:"ruleType,omitempty"` + + // Description of the rule. + Description *string `json:"description,omitempty"` + + // List of destination IP addresses or Service Tags. + DestinationAddresses []*string `json:"destinationAddresses,omitempty"` + + // List of destination FQDNs. + DestinationFqdns []*string `json:"destinationFqdns,omitempty"` + + // List of destination IpGroups for this rule. + DestinationIPGroups []*string `json:"destinationIpGroups,omitempty"` + + // List of destination ports. + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols []*FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + + // Name of the rule. + Name *string `json:"name,omitempty"` + + // List of source IP addresses for this rule. + SourceAddresses []*string `json:"sourceAddresses,omitempty"` + + // List of source IpGroups for this rule. + SourceIPGroups []*string `json:"sourceIpGroups,omitempty"` +} + +// GetFirewallPolicyRule implements the FirewallPolicyRuleClassification interface for type Rule. +func (r *Rule) GetFirewallPolicyRule() *FirewallPolicyRule { + return &FirewallPolicyRule{ + Name: r.Name, + Description: r.Description, + RuleType: r.RuleType, + } +} + +// SKU - The sku of this Bastion Host. +type SKU struct { + // The name of this Bastion Host. + Name *BastionHostSKUName `json:"name,omitempty"` +} + +// ScopeConnection - The Scope Connections resource +type ScopeConnection struct { + // The scope connection properties + Properties *ScopeConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ScopeConnectionListResult - List of scope connections. +type ScopeConnectionListResult struct { + // Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of scope connections. + Value []*ScopeConnection `json:"value,omitempty"` +} + +// ScopeConnectionProperties - Scope connection. +type ScopeConnectionProperties struct { + // A description of the scope connection. + Description *string `json:"description,omitempty"` + + // Resource ID. + ResourceID *string `json:"resourceId,omitempty"` + + // Tenant ID. + TenantID *string `json:"tenantId,omitempty"` + + // READ-ONLY; Connection State + ConnectionState *ScopeConnectionState `json:"connectionState,omitempty" azure:"ro"` +} + +// ScopeConnectionsClientCreateOrUpdateOptions contains the optional parameters for the ScopeConnectionsClient.CreateOrUpdate +// method. +type ScopeConnectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ScopeConnectionsClientDeleteOptions contains the optional parameters for the ScopeConnectionsClient.Delete method. +type ScopeConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ScopeConnectionsClientGetOptions contains the optional parameters for the ScopeConnectionsClient.Get method. +type ScopeConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScopeConnectionsClientListOptions contains the optional parameters for the ScopeConnectionsClient.List method. +type ScopeConnectionsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// SecurityAdminConfiguration - Defines the security admin configuration +type SecurityAdminConfiguration struct { + // Indicates the properties for the network manager security admin configuration. + Properties *SecurityAdminConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SecurityAdminConfigurationListResult - A list of network manager security admin configurations +type SecurityAdminConfigurationListResult struct { + // Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + + // Gets a page of security admin configurations + Value []*SecurityAdminConfiguration `json:"value,omitempty"` +} + +// SecurityAdminConfigurationPropertiesFormat - Defines the security admin configuration properties. +type SecurityAdminConfigurationPropertiesFormat struct { + // Enum list of network intent policy based services. + ApplyOnNetworkIntentPolicyBasedServices []*NetworkIntentPolicyBasedService `json:"applyOnNetworkIntentPolicyBasedServices,omitempty"` + + // A description of the security configuration. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// SecurityAdminConfigurationsClientBeginDeleteOptions contains the optional parameters for the SecurityAdminConfigurationsClient.BeginDelete +// method. +type SecurityAdminConfigurationsClientBeginDeleteOptions struct { + // Deletes the resource even if it is part of a deployed configuration. If the configuration has been deployed, the service + // will do a cleanup deployment in the background, prior to the delete. + Force *bool + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityAdminConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SecurityAdminConfigurationsClient.CreateOrUpdate +// method. +type SecurityAdminConfigurationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SecurityAdminConfigurationsClientGetOptions contains the optional parameters for the SecurityAdminConfigurationsClient.Get +// method. +type SecurityAdminConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityAdminConfigurationsClientListOptions contains the optional parameters for the SecurityAdminConfigurationsClient.List +// method. +type SecurityAdminConfigurationsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// SecurityGroup - NetworkSecurityGroup resource. +type SecurityGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the network security group. + Properties *SecurityGroupPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SecurityGroupListResult - Response for ListNetworkSecurityGroups API service call. +type SecurityGroupListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of NetworkSecurityGroup resources. + Value []*SecurityGroup `json:"value,omitempty"` +} + +// SecurityGroupNetworkInterface - Network interface and all its associated security rules. +type SecurityGroupNetworkInterface struct { + // ID of the network interface. + ID *string `json:"id,omitempty"` + + // All security rules associated with the network interface. + SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` +} + +// SecurityGroupPropertiesFormat - Network Security Group resource. +type SecurityGroupPropertiesFormat struct { + // When enabled, flows created from Network Security Group connections will be re-evaluated when rules are updates. Initial + // enablement will trigger re-evaluation. + FlushConnection *bool `json:"flushConnection,omitempty"` + + // A collection of security rules of the network security group. + SecurityRules []*SecurityRule `json:"securityRules,omitempty"` + + // READ-ONLY; The default security rules of network security group. + DefaultSecurityRules []*SecurityRule `json:"defaultSecurityRules,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to flow log resources. + FlowLogs []*FlowLog `json:"flowLogs,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to network interfaces. + NetworkInterfaces []*Interface `json:"networkInterfaces,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the network security group resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the network security group resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet `json:"subnets,omitempty" azure:"ro"` +} + +// SecurityGroupResult - Network configuration diagnostic result corresponded provided traffic query. +type SecurityGroupResult struct { + // The network traffic is allowed or denied. + SecurityRuleAccessResult *SecurityRuleAccess `json:"securityRuleAccessResult,omitempty"` + + // READ-ONLY; List of results network security groups diagnostic. + EvaluatedNetworkSecurityGroups []*EvaluatedNetworkSecurityGroup `json:"evaluatedNetworkSecurityGroups,omitempty" azure:"ro"` +} + +// SecurityGroupViewParameters - Parameters that define the VM to check security groups for. +type SecurityGroupViewParameters struct { + // REQUIRED; ID of the target VM. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// SecurityGroupViewResult - The information about security rules applied to the specified VM. +type SecurityGroupViewResult struct { + // List of network interfaces on the specified VM. + NetworkInterfaces []*SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` +} + +// SecurityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityGroupsClient.BeginCreateOrUpdate +// method. +type SecurityGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityGroupsClientBeginDeleteOptions contains the optional parameters for the SecurityGroupsClient.BeginDelete method. +type SecurityGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityGroupsClientGetOptions contains the optional parameters for the SecurityGroupsClient.Get method. +type SecurityGroupsClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// SecurityGroupsClientListAllOptions contains the optional parameters for the SecurityGroupsClient.ListAll method. +type SecurityGroupsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// SecurityGroupsClientListOptions contains the optional parameters for the SecurityGroupsClient.List method. +type SecurityGroupsClientListOptions struct { + // placeholder for future optional parameters +} + +// SecurityGroupsClientUpdateTagsOptions contains the optional parameters for the SecurityGroupsClient.UpdateTags method. +type SecurityGroupsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// SecurityPartnerProvider - Security Partner Provider resource. +type SecurityPartnerProvider struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the Security Partner Provider. + Properties *SecurityPartnerProviderPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SecurityPartnerProviderListResult - Response for ListSecurityPartnerProviders API service call. +type SecurityPartnerProviderListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Security Partner Providers in a resource group. + Value []*SecurityPartnerProvider `json:"value,omitempty"` +} + +// SecurityPartnerProviderPropertiesFormat - Properties of the Security Partner Provider. +type SecurityPartnerProviderPropertiesFormat struct { + // The security provider name. + SecurityProviderName *SecurityProviderName `json:"securityProviderName,omitempty"` + + // The virtualHub to which the Security Partner Provider belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + + // READ-ONLY; The connection status with the Security Partner Provider. + ConnectionStatus *SecurityPartnerProviderConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Security Partner Provider resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// SecurityPartnerProvidersClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityPartnerProvidersClient.BeginCreateOrUpdate +// method. +type SecurityPartnerProvidersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityPartnerProvidersClientBeginDeleteOptions contains the optional parameters for the SecurityPartnerProvidersClient.BeginDelete +// method. +type SecurityPartnerProvidersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityPartnerProvidersClientGetOptions contains the optional parameters for the SecurityPartnerProvidersClient.Get method. +type SecurityPartnerProvidersClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityPartnerProvidersClientListByResourceGroupOptions contains the optional parameters for the SecurityPartnerProvidersClient.ListByResourceGroup +// method. +type SecurityPartnerProvidersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SecurityPartnerProvidersClientListOptions contains the optional parameters for the SecurityPartnerProvidersClient.List +// method. +type SecurityPartnerProvidersClientListOptions struct { + // placeholder for future optional parameters +} + +// SecurityPartnerProvidersClientUpdateTagsOptions contains the optional parameters for the SecurityPartnerProvidersClient.UpdateTags +// method. +type SecurityPartnerProvidersClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// SecurityRule - Network security rule. +type SecurityRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the security rule. + Properties *SecurityRulePropertiesFormat `json:"properties,omitempty"` + + // The type of the resource. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// SecurityRuleAssociations - All security rules associated with the network interface. +type SecurityRuleAssociations struct { + // Collection of default security rules of the network security group. + DefaultSecurityRules []*SecurityRule `json:"defaultSecurityRules,omitempty"` + + // Collection of effective security rules. + EffectiveSecurityRules []*EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` + + // Network interface and it's custom security rules. + NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` + + // Subnet and it's custom security rules. + SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` +} + +// SecurityRuleListResult - Response for ListSecurityRule API service call. Retrieves all security rules that belongs to a +// network security group. +type SecurityRuleListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The security rules in a network security group. + Value []*SecurityRule `json:"value,omitempty"` +} + +// SecurityRulePropertiesFormat - Security rule resource. +type SecurityRulePropertiesFormat struct { + // REQUIRED; The network traffic is allowed or denied. + Access *SecurityRuleAccess `json:"access,omitempty"` + + // REQUIRED; The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. + Direction *SecurityRuleDirection `json:"direction,omitempty"` + + // REQUIRED; Network protocol this rule applies to. + Protocol *SecurityRuleProtocol `json:"protocol,omitempty"` + + // A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + + // The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default + // tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also + // be used. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + + // The destination address prefixes. CIDR or destination IP ranges. + DestinationAddressPrefixes []*string `json:"destinationAddressPrefixes,omitempty"` + + // The application security group specified as destination. + DestinationApplicationSecurityGroups []*ApplicationSecurityGroup `json:"destinationApplicationSecurityGroups,omitempty"` + + // The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + + // The destination port ranges. + DestinationPortRanges []*string `json:"destinationPortRanges,omitempty"` + + // The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the + // collection. The lower the priority number, the higher the priority of the rule. + Priority *int32 `json:"priority,omitempty"` + + // The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', + // 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress + // rule, specifies where network traffic originates from. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + + // The CIDR or source IP ranges. + SourceAddressPrefixes []*string `json:"sourceAddressPrefixes,omitempty"` + + // The application security group specified as source. + SourceApplicationSecurityGroups []*ApplicationSecurityGroup `json:"sourceApplicationSecurityGroups,omitempty"` + + // The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + + // The source port ranges. + SourcePortRanges []*string `json:"sourcePortRanges,omitempty"` + + // READ-ONLY; The provisioning state of the security rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// SecurityRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityRulesClient.BeginCreateOrUpdate +// method. +type SecurityRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityRulesClientBeginDeleteOptions contains the optional parameters for the SecurityRulesClient.BeginDelete method. +type SecurityRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecurityRulesClientGetOptions contains the optional parameters for the SecurityRulesClient.Get method. +type SecurityRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityRulesClientListOptions contains the optional parameters for the SecurityRulesClient.List method. +type SecurityRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// SecurityRulesEvaluationResult - Network security rules evaluation result. +type SecurityRulesEvaluationResult struct { + // Value indicating whether destination is matched. + DestinationMatched *bool `json:"destinationMatched,omitempty"` + + // Value indicating whether destination port is matched. + DestinationPortMatched *bool `json:"destinationPortMatched,omitempty"` + + // Name of the network security rule. + Name *string `json:"name,omitempty"` + + // Value indicating whether protocol is matched. + ProtocolMatched *bool `json:"protocolMatched,omitempty"` + + // Value indicating whether source is matched. + SourceMatched *bool `json:"sourceMatched,omitempty"` + + // Value indicating whether source port is matched. + SourcePortMatched *bool `json:"sourcePortMatched,omitempty"` +} + +// ServiceAssociationLink resource. +type ServiceAssociationLink struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Resource navigation link properties format. + Properties *ServiceAssociationLinkPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServiceAssociationLinkPropertiesFormat - Properties of ServiceAssociationLink. +type ServiceAssociationLinkPropertiesFormat struct { + // If true, the resource can be deleted. + AllowDelete *bool `json:"allowDelete,omitempty"` + + // Link to the external resource. + Link *string `json:"link,omitempty"` + + // Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + + // A list of locations. + Locations []*string `json:"locations,omitempty"` + + // READ-ONLY; The provisioning state of the service association link resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ServiceAssociationLinksClientListOptions contains the optional parameters for the ServiceAssociationLinksClient.List method. +type ServiceAssociationLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// ServiceAssociationLinksListResult - Response for ServiceAssociationLinks_List operation. +type ServiceAssociationLinksListResult struct { + // The service association links in a subnet. + Value []*ServiceAssociationLink `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ServiceDelegationPropertiesFormat - Properties of a service delegation. +type ServiceDelegationPropertiesFormat struct { + // The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). + ServiceName *string `json:"serviceName,omitempty"` + + // READ-ONLY; The actions permitted to the service upon delegation. + Actions []*string `json:"actions,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the service delegation resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceEndpointPoliciesClient.BeginCreateOrUpdate +// method. +type ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceEndpointPoliciesClientBeginDeleteOptions contains the optional parameters for the ServiceEndpointPoliciesClient.BeginDelete +// method. +type ServiceEndpointPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceEndpointPoliciesClientGetOptions contains the optional parameters for the ServiceEndpointPoliciesClient.Get method. +type ServiceEndpointPoliciesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// ServiceEndpointPoliciesClientListByResourceGroupOptions contains the optional parameters for the ServiceEndpointPoliciesClient.ListByResourceGroup +// method. +type ServiceEndpointPoliciesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPoliciesClientListOptions contains the optional parameters for the ServiceEndpointPoliciesClient.List method. +type ServiceEndpointPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPoliciesClientUpdateTagsOptions contains the optional parameters for the ServiceEndpointPoliciesClient.UpdateTags +// method. +type ServiceEndpointPoliciesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPolicy - Service End point policy resource. +type ServiceEndpointPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the service end point policy. + Properties *ServiceEndpointPolicyPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Kind of service endpoint policy. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServiceEndpointPolicyDefinition - Service Endpoint policy definitions. +type ServiceEndpointPolicyDefinition struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the service endpoint policy definition. + Properties *ServiceEndpointPolicyDefinitionPropertiesFormat `json:"properties,omitempty"` + + // The type of the resource. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// ServiceEndpointPolicyDefinitionListResult - Response for ListServiceEndpointPolicyDefinition API service call. Retrieves +// all service endpoint policy definition that belongs to a service endpoint policy. +type ServiceEndpointPolicyDefinitionListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The service endpoint policy definition in a service endpoint policy. + Value []*ServiceEndpointPolicyDefinition `json:"value,omitempty"` +} + +// ServiceEndpointPolicyDefinitionPropertiesFormat - Service Endpoint policy definition resource. +type ServiceEndpointPolicyDefinitionPropertiesFormat struct { + // A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + + // Service endpoint name. + Service *string `json:"service,omitempty"` + + // A list of service resources. + ServiceResources []*string `json:"serviceResources,omitempty"` + + // READ-ONLY; The provisioning state of the service endpoint policy definition resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.BeginCreateOrUpdate +// method. +type ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.BeginDelete +// method. +type ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceEndpointPolicyDefinitionsClientGetOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.Get +// method. +type ServiceEndpointPolicyDefinitionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.ListByResourceGroup +// method. +type ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServiceEndpointPolicyListResult - Response for ListServiceEndpointPolicies API service call. +type ServiceEndpointPolicyListResult struct { + // A list of ServiceEndpointPolicy resources. + Value []*ServiceEndpointPolicy `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ServiceEndpointPolicyPropertiesFormat - Service Endpoint Policy resource. +type ServiceEndpointPolicyPropertiesFormat struct { + // A collection of contextual service endpoint policy. + ContextualServiceEndpointPolicies []*string `json:"contextualServiceEndpointPolicies,omitempty"` + + // The alias indicating if the policy belongs to a service + ServiceAlias *string `json:"serviceAlias,omitempty"` + + // A collection of service endpoint policy definitions of the service endpoint policy. + ServiceEndpointPolicyDefinitions []*ServiceEndpointPolicyDefinition `json:"serviceEndpointPolicyDefinitions,omitempty"` + + // READ-ONLY; The provisioning state of the service endpoint policy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the service endpoint policy resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to subnets. + Subnets []*Subnet `json:"subnets,omitempty" azure:"ro"` +} + +// ServiceEndpointPropertiesFormat - The service endpoint properties. +type ServiceEndpointPropertiesFormat struct { + // A list of locations. + Locations []*string `json:"locations,omitempty"` + + // The type of the endpoint service. + Service *string `json:"service,omitempty"` + + // READ-ONLY; The provisioning state of the service endpoint resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ServiceTagInformation - The service tag information. +type ServiceTagInformation struct { + // READ-ONLY; The ID of service tag. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of service tag. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Properties of the service tag information. + Properties *ServiceTagInformationPropertiesFormat `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; The iteration number of service tag object for region. + ServiceTagChangeNumber *string `json:"serviceTagChangeNumber,omitempty" azure:"ro"` +} + +// ServiceTagInformationClientListOptions contains the optional parameters for the ServiceTagInformationClient.List method. +type ServiceTagInformationClientListOptions struct { + // Do not return address prefixes for the tag(s). + NoAddressPrefixes *bool + // Return tag information for a particular tag. + TagName *string +} + +// ServiceTagInformationListResult - Response for Get ServiceTagInformation API service call. Retrieves the list of service +// tag information resources. +type ServiceTagInformationListResult struct { + // The list of service tag information resources. + Value []*ServiceTagInformation `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ServiceTagInformationPropertiesFormat - Properties of the service tag information. +type ServiceTagInformationPropertiesFormat struct { + // READ-ONLY; The list of IP address prefixes. + AddressPrefixes []*string `json:"addressPrefixes,omitempty" azure:"ro"` + + // READ-ONLY; The iteration number of service tag. + ChangeNumber *string `json:"changeNumber,omitempty" azure:"ro"` + + // READ-ONLY; The region of service tag. + Region *string `json:"region,omitempty" azure:"ro"` + + // READ-ONLY; The state of the service tag. + State *string `json:"state,omitempty" azure:"ro"` + + // READ-ONLY; The name of system service. + SystemService *string `json:"systemService,omitempty" azure:"ro"` +} + +// ServiceTagsClientListOptions contains the optional parameters for the ServiceTagsClient.List method. +type ServiceTagsClientListOptions struct { + // placeholder for future optional parameters +} + +// ServiceTagsListResult - Response for the ListServiceTags API service call. +type ServiceTagsListResult struct { + // READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty" azure:"ro"` + + // READ-ONLY; The name of the cloud. + Cloud *string `json:"cloud,omitempty" azure:"ro"` + + // READ-ONLY; The ID of the cloud. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the cloud. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The URL to get next page of service tag information resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; The azure resource type. + Type *string `json:"type,omitempty" azure:"ro"` + + // READ-ONLY; The list of service tag information resources. + Values []*ServiceTagInformation `json:"values,omitempty" azure:"ro"` +} + +// SessionIDs - List of session IDs. +type SessionIDs struct { + // List of session IDs. + SessionIDs []*string `json:"sessionIds,omitempty"` +} + +// SignatureOverridesFilterValuesQuery - Describes the filter values possibles for a given column +type SignatureOverridesFilterValuesQuery struct { + // Describes the name of the column which values will be returned + FilterName *string `json:"filterName,omitempty"` +} + +// SignatureOverridesFilterValuesResponse - Describes the list of all possible values for a specific filter value +type SignatureOverridesFilterValuesResponse struct { + // Describes the possible values + FilterValues []*string `json:"filterValues,omitempty"` +} + +// SignaturesOverrides - Contains all specific policy signatures overrides for the IDPS +type SignaturesOverrides struct { + // Will contain the resource id of the signature override resource + ID *string `json:"id,omitempty"` + + // Contains the name of the resource (default) + Name *string `json:"name,omitempty"` + + // Will contain the properties of the resource (the actual signature overrides) + Properties *SignaturesOverridesProperties `json:"properties,omitempty"` + + // Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides + Type *string `json:"type,omitempty"` +} + +// SignaturesOverridesList - Describes an object containing an array with a single item +type SignaturesOverridesList struct { + // Describes a list consisting exactly one item describing the policy's signature override status + Value []*SignaturesOverrides `json:"value,omitempty"` +} + +// SignaturesOverridesProperties - Will contain the properties of the resource (the actual signature overrides) +type SignaturesOverridesProperties struct { + // Dictionary of + Signatures map[string]*string `json:"signatures,omitempty"` +} + +type SingleQueryResult struct { + // Describes what is the signature enforces + Description *string `json:"description,omitempty"` + + // Describes the list of destination ports related to this signature + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional + Direction *FirewallPolicyIDPSSignatureDirection `json:"direction,omitempty"` + + // Describes the groups the signature belongs to + Group *string `json:"group,omitempty"` + + // Describes if this override is inherited from base policy or not + InheritedFromParentPolicy *bool `json:"inheritedFromParentPolicy,omitempty"` + + // Describes the last updated time of the signature (provided from 3rd party vendor) + LastUpdated *string `json:"lastUpdated,omitempty"` + + // The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny + Mode *FirewallPolicyIDPSSignatureMode `json:"mode,omitempty"` + + // Describes the protocol the signatures is being enforced in + Protocol *string `json:"protocol,omitempty"` + + // Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High + Severity *FirewallPolicyIDPSSignatureSeverity `json:"severity,omitempty"` + + // The ID of the signature + SignatureID *int32 `json:"signatureId,omitempty"` + + // Describes the list of source ports related to this signature + SourcePorts []*string `json:"sourcePorts,omitempty"` +} + +// StaticMember Item. +type StaticMember struct { + // The Static Member properties + Properties *StaticMemberProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// StaticMemberListResult - Result of the request to list StaticMember. It contains a list of groups and a URL link to get +// the next set of results. +type StaticMemberListResult struct { + // Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // Gets a page of StaticMember + Value []*StaticMember `json:"value,omitempty"` +} + +// StaticMemberProperties - Properties of static member. +type StaticMemberProperties struct { + // Resource Id. + ResourceID *string `json:"resourceId,omitempty"` + + // READ-ONLY; The provisioning state of the scope assignment resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Resource region. + Region *string `json:"region,omitempty" azure:"ro"` +} + +// StaticMembersClientCreateOrUpdateOptions contains the optional parameters for the StaticMembersClient.CreateOrUpdate method. +type StaticMembersClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StaticMembersClientDeleteOptions contains the optional parameters for the StaticMembersClient.Delete method. +type StaticMembersClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// StaticMembersClientGetOptions contains the optional parameters for the StaticMembersClient.Get method. +type StaticMembersClientGetOptions struct { + // placeholder for future optional parameters +} + +// StaticMembersClientListOptions contains the optional parameters for the StaticMembersClient.List method. +type StaticMembersClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// StaticRoute - List of all Static Routes. +type StaticRoute struct { + // List of all address prefixes. + AddressPrefixes []*string `json:"addressPrefixes,omitempty"` + + // The name of the StaticRoute that is unique within a VnetRoute. + Name *string `json:"name,omitempty"` + + // The ip address of the next hop. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// StaticRoutesConfig - Configuration for static routes on this HubVnetConnectionConfiguration for static routes on this HubVnetConnection. +type StaticRoutesConfig struct { + // Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke. + VnetLocalRouteOverrideCriteria *VnetLocalRouteOverrideCriteria `json:"vnetLocalRouteOverrideCriteria,omitempty"` + + // READ-ONLY; Boolean indicating whether static routes on this connection are automatically propagate to route tables which + // this connection propagates to. + PropagateStaticRoutes *bool `json:"propagateStaticRoutes,omitempty" azure:"ro"` +} + +// SubResource - Reference to another subresource. +type SubResource struct { + // Resource ID. + ID *string `json:"id,omitempty"` +} + +// Subnet in a virtual network resource. +type Subnet struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the subnet. + Properties *SubnetPropertiesFormat `json:"properties,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// SubnetAssociation - Subnet and it's custom security rules. +type SubnetAssociation struct { + // Collection of custom security rules. + SecurityRules []*SecurityRule `json:"securityRules,omitempty"` + + // READ-ONLY; Subnet ID. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// SubnetListResult - Response for ListSubnets API service callRetrieves all subnet that belongs to a virtual network. +type SubnetListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The subnets in a virtual network. + Value []*Subnet `json:"value,omitempty"` +} + +// SubnetPropertiesFormat - Properties of the subnet. +type SubnetPropertiesFormat struct { + // The address prefix for the subnet. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // List of address prefixes for the subnet. + AddressPrefixes []*string `json:"addressPrefixes,omitempty"` + + // Application gateway IP configurations of virtual network resource. + ApplicationGatewayIPConfigurations []*ApplicationGatewayIPConfiguration `json:"applicationGatewayIpConfigurations,omitempty"` + + // An array of references to the delegations on the subnet. + Delegations []*Delegation `json:"delegations,omitempty"` + + // Array of IpAllocation which reference this subnet. + IPAllocations []*SubResource `json:"ipAllocations,omitempty"` + + // Nat gateway associated with this subnet. + NatGateway *SubResource `json:"natGateway,omitempty"` + + // The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + + // Enable or Disable apply network policies on private end point in the subnet. + PrivateEndpointNetworkPolicies *VirtualNetworkPrivateEndpointNetworkPolicies `json:"privateEndpointNetworkPolicies,omitempty"` + + // Enable or Disable apply network policies on private link service in the subnet. + PrivateLinkServiceNetworkPolicies *VirtualNetworkPrivateLinkServiceNetworkPolicies `json:"privateLinkServiceNetworkPolicies,omitempty"` + + // The reference to the RouteTable resource. + RouteTable *RouteTable `json:"routeTable,omitempty"` + + // An array of service endpoint policies. + ServiceEndpointPolicies []*ServiceEndpointPolicy `json:"serviceEndpointPolicies,omitempty"` + + // An array of service endpoints. + ServiceEndpoints []*ServiceEndpointPropertiesFormat `json:"serviceEndpoints,omitempty"` + + // READ-ONLY; Array of IP configuration profiles which reference this subnet. + IPConfigurationProfiles []*IPConfigurationProfile `json:"ipConfigurationProfiles,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to the network interface IP configurations using subnet. + IPConfigurations []*IPConfiguration `json:"ipConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to private endpoints. + PrivateEndpoints []*PrivateEndpoint `json:"privateEndpoints,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the subnet resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; A read-only string identifying the intention of use for this subnet based on delegations and other user-defined + // properties. + Purpose *string `json:"purpose,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to the external resources using subnet. + ResourceNavigationLinks []*ResourceNavigationLink `json:"resourceNavigationLinks,omitempty" azure:"ro"` + + // READ-ONLY; An array of references to services injecting into this subnet. + ServiceAssociationLinks []*ServiceAssociationLink `json:"serviceAssociationLinks,omitempty" azure:"ro"` +} + +// SubnetsClientBeginCreateOrUpdateOptions contains the optional parameters for the SubnetsClient.BeginCreateOrUpdate method. +type SubnetsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SubnetsClientBeginDeleteOptions contains the optional parameters for the SubnetsClient.BeginDelete method. +type SubnetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SubnetsClientBeginPrepareNetworkPoliciesOptions contains the optional parameters for the SubnetsClient.BeginPrepareNetworkPolicies +// method. +type SubnetsClientBeginPrepareNetworkPoliciesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SubnetsClientBeginUnprepareNetworkPoliciesOptions contains the optional parameters for the SubnetsClient.BeginUnprepareNetworkPolicies +// method. +type SubnetsClientBeginUnprepareNetworkPoliciesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SubnetsClientGetOptions contains the optional parameters for the SubnetsClient.Get method. +type SubnetsClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// SubnetsClientListOptions contains the optional parameters for the SubnetsClient.List method. +type SubnetsClientListOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.CreateOrUpdate +// method. +type SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionNetworkManagerConnectionsClientDeleteOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.Delete +// method. +type SubscriptionNetworkManagerConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionNetworkManagerConnectionsClientGetOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.Get +// method. +type SubscriptionNetworkManagerConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionNetworkManagerConnectionsClientListOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.List +// method. +type SubscriptionNetworkManagerConnectionsClientListOptions struct { + // 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. + SkipToken *string + // An optional query parameter which specifies the maximum number of records to be returned by the server. + Top *int32 +} + +// SwapResource to represent slot type on the specified cloud service. +type SwapResource struct { + // Swap resource properties + Properties *SwapResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SwapResourceListResult - SwapResource List with single entry to represent slot type on the specified cloud service. +type SwapResourceListResult struct { + Value []*SwapResource `json:"value,omitempty"` +} + +// SwapResourceProperties - Swap resource properties +type SwapResourceProperties struct { + // Specifies slot info on a cloud service + SlotType *SlotType `json:"slotType,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// TagsObject - Tags object for patch operations. +type TagsObject struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// Topology of the specified resource group. +type Topology struct { + // A list of topology resources. + Resources []*TopologyResource `json:"resources,omitempty"` + + // READ-ONLY; The datetime when the topology was initially created for the resource group. + CreatedDateTime *time.Time `json:"createdDateTime,omitempty" azure:"ro"` + + // READ-ONLY; GUID representing the operation id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The datetime when the topology was last modified. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` +} + +// TopologyAssociation - Resources that have an association with the parent resource. +type TopologyAssociation struct { + // The association type of the child resource to the parent resource. + AssociationType *AssociationType `json:"associationType,omitempty"` + + // The name of the resource that is associated with the parent resource. + Name *string `json:"name,omitempty"` + + // The ID of the resource that is associated with the parent resource. + ResourceID *string `json:"resourceId,omitempty"` +} + +// TopologyParameters - Parameters that define the representation of topology. +type TopologyParameters struct { + // The name of the target resource group to perform topology on. + TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` + + // The reference to the Subnet resource. + TargetSubnet *SubResource `json:"targetSubnet,omitempty"` + + // The reference to the Virtual Network resource. + TargetVirtualNetwork *SubResource `json:"targetVirtualNetwork,omitempty"` +} + +// TopologyResource - The network resource topology information for the given resource group. +type TopologyResource struct { + // Holds the associations the resource has with other resources in the resource group. + Associations []*TopologyAssociation `json:"associations,omitempty"` + + // ID of the resource. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Name of the resource. + Name *string `json:"name,omitempty"` +} + +// TrafficAnalyticsConfigurationProperties - Parameters that define the configuration of traffic analytics. +type TrafficAnalyticsConfigurationProperties struct { + // Flag to enable/disable traffic analytics. + Enabled *bool `json:"enabled,omitempty"` + + // The interval in minutes which would decide how frequently TA service should do flow analytics. + TrafficAnalyticsInterval *int32 `json:"trafficAnalyticsInterval,omitempty"` + + // The resource guid of the attached workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + + // The location of the attached workspace. + WorkspaceRegion *string `json:"workspaceRegion,omitempty"` + + // Resource Id of the attached workspace. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` +} + +// TrafficAnalyticsProperties - Parameters that define the configuration of traffic analytics. +type TrafficAnalyticsProperties struct { + // Parameters that define the configuration of traffic analytics. + NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` +} + +// TrafficSelectorPolicy - An traffic selector policy for a virtual network gateway connection. +type TrafficSelectorPolicy struct { + // REQUIRED; A collection of local address spaces in CIDR format. + LocalAddressRanges []*string `json:"localAddressRanges,omitempty"` + + // REQUIRED; A collection of remote address spaces in CIDR format. + RemoteAddressRanges []*string `json:"remoteAddressRanges,omitempty"` +} + +// TroubleshootingDetails - Information gained from troubleshooting of specified resource. +type TroubleshootingDetails struct { + // Details on troubleshooting results. + Detail *string `json:"detail,omitempty"` + + // The id of the get troubleshoot operation. + ID *string `json:"id,omitempty"` + + // Reason type of failure. + ReasonType *string `json:"reasonType,omitempty"` + + // List of recommended actions. + RecommendedActions []*TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` + + // A summary of troubleshooting. + Summary *string `json:"summary,omitempty"` +} + +// TroubleshootingParameters - Parameters that define the resource to troubleshoot. +type TroubleshootingParameters struct { + // REQUIRED; Properties of the troubleshooting resource. + Properties *TroubleshootingProperties `json:"properties,omitempty"` + + // REQUIRED; The target resource to troubleshoot. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// TroubleshootingProperties - Storage location provided for troubleshoot. +type TroubleshootingProperties struct { + // REQUIRED; The ID for the storage account to save the troubleshoot result. + StorageID *string `json:"storageId,omitempty"` + + // REQUIRED; The path to the blob to save the troubleshoot result in. + StoragePath *string `json:"storagePath,omitempty"` +} + +// TroubleshootingRecommendedActions - Recommended actions based on discovered issues. +type TroubleshootingRecommendedActions struct { + // ID of the recommended action. + ActionID *string `json:"actionId,omitempty"` + + // Description of recommended actions. + ActionText *string `json:"actionText,omitempty"` + + // The uri linking to a documentation for the recommended troubleshooting actions. + ActionURI *string `json:"actionUri,omitempty"` + + // The information from the URI for the recommended troubleshooting actions. + ActionURIText *string `json:"actionUriText,omitempty"` +} + +// TroubleshootingResult - Troubleshooting information gained from specified resource. +type TroubleshootingResult struct { + // The result code of the troubleshooting. + Code *string `json:"code,omitempty"` + + // The end time of the troubleshooting. + EndTime *time.Time `json:"endTime,omitempty"` + + // Information from troubleshooting. + Results []*TroubleshootingDetails `json:"results,omitempty"` + + // The start time of the troubleshooting. + StartTime *time.Time `json:"startTime,omitempty"` +} + +// TunnelConnectionHealth - VirtualNetworkGatewayConnection properties. +type TunnelConnectionHealth struct { + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The Egress Bytes Transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The Ingress Bytes Transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The time at which connection was established in Utc format. + LastConnectionEstablishedUTCTime *string `json:"lastConnectionEstablishedUtcTime,omitempty" azure:"ro"` + + // READ-ONLY; Tunnel name. + Tunnel *string `json:"tunnel,omitempty" azure:"ro"` +} + +// UnprepareNetworkPoliciesRequest - Details of UnprepareNetworkPolicies for Subnet. +type UnprepareNetworkPoliciesRequest struct { + // The name of the service for which subnet is being unprepared for. + ServiceName *string `json:"serviceName,omitempty"` +} + +// Usage - The network resource usage. +type Usage struct { + // REQUIRED; The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + + // REQUIRED; The limit of usage. + Limit *int64 `json:"limit,omitempty"` + + // REQUIRED; The name of the type of usage. + Name *UsageName `json:"name,omitempty"` + + // REQUIRED; An enum describing the unit of measurement. + Unit *UsageUnit `json:"unit,omitempty"` + + // READ-ONLY; Resource identifier. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// UsageName - The usage names. +type UsageName struct { + // A localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` + + // A string describing the resource name. + Value *string `json:"value,omitempty"` +} + +// UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +type UsagesClientListOptions struct { + // placeholder for future optional parameters +} + +// UsagesListResult - The list usages operation response. +type UsagesListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The list network resource usages. + Value []*Usage `json:"value,omitempty"` +} + +// VM - Describes a Virtual Machine. +type VM struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNClientConfiguration - VpnClientConfiguration for P2S client. +type VPNClientConfiguration struct { + // The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AADAudience *string `json:"aadAudience,omitempty"` + + // The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AADIssuer *string `json:"aadIssuer,omitempty"` + + // The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AADTenant *string `json:"aadTenant,omitempty"` + + // The radius server address property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + + // The radius secret property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + + // The radiusServers property for multiple radius server configuration. + RadiusServers []*RadiusServer `json:"radiusServers,omitempty"` + + // VPN authentication types for the virtual network gateway.. + VPNAuthenticationTypes []*VPNAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + + // The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + + // VpnClientIpsecPolicies for virtual network gateway P2S client. + VPNClientIPSecPolicies []*IPSecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + + // VpnClientProtocols for Virtual network gateway. + VPNClientProtocols []*VPNClientProtocol `json:"vpnClientProtocols,omitempty"` + + // VpnClientRevokedCertificate for Virtual network gateway. + VPNClientRevokedCertificates []*VPNClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + + // VpnClientRootCertificate for virtual network gateway. + VPNClientRootCertificates []*VPNClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + + // per ip address pool connection policy for virtual network gateway P2S client. + VngClientConnectionConfigurations []*VngClientConnectionConfiguration `json:"vngClientConnectionConfigurations,omitempty"` +} + +// VPNClientConnectionHealth - VpnClientConnectionHealth properties. +type VPNClientConnectionHealth struct { + // List of allocated ip addresses to the connected p2s vpn clients. + AllocatedIPAddresses []*string `json:"allocatedIpAddresses,omitempty"` + + // The total of p2s vpn clients connected at this time to this P2SVpnGateway. + VPNClientConnectionsCount *int32 `json:"vpnClientConnectionsCount,omitempty"` + + // READ-ONLY; Total of the Egress Bytes Transferred in this connection. + TotalEgressBytesTransferred *int64 `json:"totalEgressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; Total of the Ingress Bytes Transferred in this P2S Vpn connection. + TotalIngressBytesTransferred *int64 `json:"totalIngressBytesTransferred,omitempty" azure:"ro"` +} + +// VPNClientConnectionHealthDetail - VPN client connection health detail. +type VPNClientConnectionHealthDetail struct { + // READ-ONLY; The egress bytes per second. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The egress packets per second. + EgressPacketsTransferred *int64 `json:"egressPacketsTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The ingress bytes per second. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The ingress packets per second. + IngressPacketsTransferred *int64 `json:"ingressPacketsTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The max band width. + MaxBandwidth *int64 `json:"maxBandwidth,omitempty" azure:"ro"` + + // READ-ONLY; The max packets transferred per second. + MaxPacketsPerSecond *int64 `json:"maxPacketsPerSecond,omitempty" azure:"ro"` + + // READ-ONLY; The assigned private Ip of a connected vpn client. + PrivateIPAddress *string `json:"privateIpAddress,omitempty" azure:"ro"` + + // READ-ONLY; The public Ip of a connected vpn client. + PublicIPAddress *string `json:"publicIpAddress,omitempty" azure:"ro"` + + // READ-ONLY; The duration time of a connected vpn client. + VPNConnectionDuration *int64 `json:"vpnConnectionDuration,omitempty" azure:"ro"` + + // READ-ONLY; The vpn client Id. + VPNConnectionID *string `json:"vpnConnectionId,omitempty" azure:"ro"` + + // READ-ONLY; The start time of a connected vpn client. + VPNConnectionTime *string `json:"vpnConnectionTime,omitempty" azure:"ro"` + + // READ-ONLY; The user name of a connected vpn client. + VPNUserName *string `json:"vpnUserName,omitempty" azure:"ro"` +} + +// VPNClientConnectionHealthDetailListResult - List of virtual network gateway vpn client connection health. +type VPNClientConnectionHealthDetailListResult struct { + // List of vpn client connection health. + Value []*VPNClientConnectionHealthDetail `json:"value,omitempty"` +} + +// VPNClientIPsecParameters - An IPSec parameters for a virtual network gateway P2S connection. +type VPNClientIPsecParameters struct { + // REQUIRED; The DH Group used in IKE Phase 1 for initial SA. + DhGroup *DhGroup `json:"dhGroup,omitempty"` + + // REQUIRED; The IPSec encryption algorithm (IKE phase 1). + IPSecEncryption *IPSecEncryption `json:"ipsecEncryption,omitempty"` + + // REQUIRED; The IPSec integrity algorithm (IKE phase 1). + IPSecIntegrity *IPSecIntegrity `json:"ipsecIntegrity,omitempty"` + + // REQUIRED; The IKE encryption algorithm (IKE phase 2). + IkeEncryption *IkeEncryption `json:"ikeEncryption,omitempty"` + + // REQUIRED; The IKE integrity algorithm (IKE phase 2). + IkeIntegrity *IkeIntegrity `json:"ikeIntegrity,omitempty"` + + // REQUIRED; The Pfs Group used in IKE Phase 2 for new child SA. + PfsGroup *PfsGroup `json:"pfsGroup,omitempty"` + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + + // REQUIRED; The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` +} + +// VPNClientParameters - Vpn Client Parameters for package generation. +type VPNClientParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod `json:"authenticationMethod,omitempty"` + + // A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external + // radius based authentication with EAPTLS. + ClientRootCertificates []*string `json:"clientRootCertificates,omitempty"` + + // VPN client Processor Architecture. + ProcessorArchitecture *ProcessorArchitecture `json:"processorArchitecture,omitempty"` + + // The public certificate data for the radius server authentication certificate as a Base-64 encoded string. Required only + // if external radius authentication has been configured with EAPTLS + // authentication. + RadiusServerAuthCertificate *string `json:"radiusServerAuthCertificate,omitempty"` +} + +// VPNClientRevokedCertificate - VPN client revoked certificate of virtual network gateway. +type VPNClientRevokedCertificate struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the vpn client revoked certificate. + Properties *VPNClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VPNClientRevokedCertificatePropertiesFormat - Properties of the revoked VPN client certificate of virtual network gateway. +type VPNClientRevokedCertificatePropertiesFormat struct { + // The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + + // READ-ONLY; The provisioning state of the VPN client revoked certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNClientRootCertificate - VPN client root certificate of virtual network gateway. +type VPNClientRootCertificate struct { + // REQUIRED; Properties of the vpn client root certificate. + Properties *VPNClientRootCertificatePropertiesFormat `json:"properties,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VPNClientRootCertificatePropertiesFormat - Properties of SSL certificates of application gateway. +type VPNClientRootCertificatePropertiesFormat struct { + // REQUIRED; The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` + + // READ-ONLY; The provisioning state of the VPN client root certificate resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNConnection - VpnConnection Resource. +type VPNConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the VPN connection. + Properties *VPNConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VPNConnectionPacketCaptureStartParameters - Vpn Connection packet capture parameters supplied to start packet capture on +// gateway connection. +type VPNConnectionPacketCaptureStartParameters struct { + // Start Packet capture parameters on vpn connection. + FilterData *string `json:"filterData,omitempty"` + + // List of site link connection names. + LinkConnectionNames []*string `json:"linkConnectionNames,omitempty"` +} + +// VPNConnectionPacketCaptureStopParameters - Vpn Connection packet capture parameters supplied to stop packet capture on +// gateway connection. +type VPNConnectionPacketCaptureStopParameters struct { + // List of site link connection names. + LinkConnectionNames []*string `json:"linkConnectionNames,omitempty"` + + // SAS url for packet capture on vpn connection. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VPNConnectionProperties - Parameters for VpnConnection. +type VPNConnectionProperties struct { + // Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + + // DPD timeout in seconds for vpn connection. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + + // EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + + // Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + + // EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy `json:"ipsecPolicies,omitempty"` + + // Id of the connected vpn site. + RemoteVPNSite *SubResource `json:"remoteVpnSite,omitempty"` + + // The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + + // Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + + // SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + + // Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + + // Connection protocol used for this connection. + VPNConnectionProtocolType *VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + + // List of all vpn site link connections to the gateway. + VPNLinkConnections []*VPNSiteLinkConnection `json:"vpnLinkConnections,omitempty"` + + // READ-ONLY; The connection status. + ConnectionStatus *VPNConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the VPN connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNConnectionsClient.BeginCreateOrUpdate +// method. +type VPNConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNConnectionsClientBeginDeleteOptions contains the optional parameters for the VPNConnectionsClient.BeginDelete method. +type VPNConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNConnectionsClientBeginStartPacketCaptureOptions contains the optional parameters for the VPNConnectionsClient.BeginStartPacketCapture +// method. +type VPNConnectionsClientBeginStartPacketCaptureOptions struct { + // Vpn Connection packet capture parameters supplied to start packet capture on gateway connection. + Parameters *VPNConnectionPacketCaptureStartParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNConnectionsClientBeginStopPacketCaptureOptions contains the optional parameters for the VPNConnectionsClient.BeginStopPacketCapture +// method. +type VPNConnectionsClientBeginStopPacketCaptureOptions struct { + // Vpn Connection packet capture parameters supplied to stop packet capture on gateway connection. + Parameters *VPNConnectionPacketCaptureStopParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNConnectionsClientGetOptions contains the optional parameters for the VPNConnectionsClient.Get method. +type VPNConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNConnectionsClientListByVPNGatewayOptions contains the optional parameters for the VPNConnectionsClient.ListByVPNGateway +// method. +type VPNConnectionsClientListByVPNGatewayOptions struct { + // placeholder for future optional parameters +} + +// VPNDeviceScriptParameters - Vpn device configuration script generation parameters. +type VPNDeviceScriptParameters struct { + // The device family for the vpn device. + DeviceFamily *string `json:"deviceFamily,omitempty"` + + // The firmware version for the vpn device. + FirmwareVersion *string `json:"firmwareVersion,omitempty"` + + // The vendor for the vpn device. + Vendor *string `json:"vendor,omitempty"` +} + +// VPNGateway - VpnGateway Resource. +type VPNGateway struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the VPN gateway. + Properties *VPNGatewayProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNGatewayIPConfiguration - IP Configuration of a VPN Gateway Resource. +type VPNGatewayIPConfiguration struct { + // The identifier of the IP configuration for a VPN Gateway. + ID *string `json:"id,omitempty"` + + // The private IP address of this IP configuration. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + + // The public IP address of this IP configuration. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` +} + +// VPNGatewayNatRule - VpnGatewayNatRule Resource. +type VPNGatewayNatRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the VpnGateway NAT rule. + Properties *VPNGatewayNatRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNGatewayNatRuleProperties - Parameters for VpnGatewayNatRule. +type VPNGatewayNatRuleProperties struct { + // The private IP address external mapping for NAT. + ExternalMappings []*VPNNatRuleMapping `json:"externalMappings,omitempty"` + + // The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + + // The private IP address internal mapping for NAT. + InternalMappings []*VPNNatRuleMapping `json:"internalMappings,omitempty"` + + // The Source NAT direction of a VPN NAT. + Mode *VPNNatRuleMode `json:"mode,omitempty"` + + // The type of NAT rule for VPN NAT. + Type *VPNNatRuleType `json:"type,omitempty"` + + // READ-ONLY; List of egress VpnSiteLinkConnections. + EgressVPNSiteLinkConnections []*SubResource `json:"egressVpnSiteLinkConnections,omitempty" azure:"ro"` + + // READ-ONLY; List of ingress VpnSiteLinkConnections. + IngressVPNSiteLinkConnections []*SubResource `json:"ingressVpnSiteLinkConnections,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the NAT Rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNGatewayPacketCaptureStartParameters - Start packet capture parameters. +type VPNGatewayPacketCaptureStartParameters struct { + // Start Packet capture parameters on vpn gateway. + FilterData *string `json:"filterData,omitempty"` +} + +// VPNGatewayPacketCaptureStopParameters - Stop packet capture parameters. +type VPNGatewayPacketCaptureStopParameters struct { + // SAS url for packet capture on vpn gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VPNGatewayProperties - Parameters for VpnGateway. +type VPNGatewayProperties struct { + // Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + + // List of all vpn connections to the gateway. + Connections []*VPNConnection `json:"connections,omitempty"` + + // Enable BGP routes translation for NAT on this VpnGateway. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` + + // Enable Routing Preference property for the Public IP Interface of the VpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` + + // List of all the nat Rules associated with the gateway. + NatRules []*VPNGatewayNatRule `json:"natRules,omitempty"` + + // The scale unit for this vpn gateway. + VPNGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + + // The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + + // READ-ONLY; List of all IPs configured on the gateway. + IPConfigurations []*VPNGatewayIPConfiguration `json:"ipConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the VPN gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNGatewaysClient.BeginCreateOrUpdate +// method. +type VPNGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientBeginDeleteOptions contains the optional parameters for the VPNGatewaysClient.BeginDelete method. +type VPNGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientBeginResetOptions contains the optional parameters for the VPNGatewaysClient.BeginReset method. +type VPNGatewaysClientBeginResetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientBeginStartPacketCaptureOptions contains the optional parameters for the VPNGatewaysClient.BeginStartPacketCapture +// method. +type VPNGatewaysClientBeginStartPacketCaptureOptions struct { + // Vpn gateway packet capture parameters supplied to start packet capture on vpn gateway. + Parameters *VPNGatewayPacketCaptureStartParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientBeginStopPacketCaptureOptions contains the optional parameters for the VPNGatewaysClient.BeginStopPacketCapture +// method. +type VPNGatewaysClientBeginStopPacketCaptureOptions struct { + // Vpn gateway packet capture parameters supplied to stop packet capture on vpn gateway. + Parameters *VPNGatewayPacketCaptureStopParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the VPNGatewaysClient.BeginUpdateTags method. +type VPNGatewaysClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNGatewaysClientGetOptions contains the optional parameters for the VPNGatewaysClient.Get method. +type VPNGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the VPNGatewaysClient.ListByResourceGroup +// method. +type VPNGatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNGatewaysClientListOptions contains the optional parameters for the VPNGatewaysClient.List method. +type VPNGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// VPNLinkBgpSettings - BGP settings details for a link. +type VPNLinkBgpSettings struct { + // The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + + // The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` +} + +// VPNLinkConnectionsClientBeginGetIkeSasOptions contains the optional parameters for the VPNLinkConnectionsClient.BeginGetIkeSas +// method. +type VPNLinkConnectionsClientBeginGetIkeSasOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNLinkConnectionsClientBeginResetConnectionOptions contains the optional parameters for the VPNLinkConnectionsClient.BeginResetConnection +// method. +type VPNLinkConnectionsClientBeginResetConnectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNLinkConnectionsClientListByVPNConnectionOptions contains the optional parameters for the VPNLinkConnectionsClient.ListByVPNConnection +// method. +type VPNLinkConnectionsClientListByVPNConnectionOptions struct { + // placeholder for future optional parameters +} + +// VPNLinkProviderProperties - List of properties of a link provider. +type VPNLinkProviderProperties struct { + // Name of the link provider. + LinkProviderName *string `json:"linkProviderName,omitempty"` + + // Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// VPNNatRuleMapping - Vpn NatRule mapping. +type VPNNatRuleMapping struct { + // Address space for Vpn NatRule mapping. + AddressSpace *string `json:"addressSpace,omitempty"` + + // Port range for Vpn NatRule mapping. + PortRange *string `json:"portRange,omitempty"` +} + +// VPNPacketCaptureStartParameters - Start packet capture parameters on virtual network gateway. +type VPNPacketCaptureStartParameters struct { + // Start Packet capture parameters. + FilterData *string `json:"filterData,omitempty"` +} + +// VPNPacketCaptureStopParameters - Stop packet capture parameters. +type VPNPacketCaptureStopParameters struct { + // SAS url for packet capture on virtual network gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VPNProfileResponse - Vpn Profile Response for package generation. +type VPNProfileResponse struct { + // URL to the VPN profile. + ProfileURL *string `json:"profileUrl,omitempty"` +} + +// VPNServerConfigRadiusClientRootCertificate - Properties of the Radius client root certificate of VpnServerConfiguration. +type VPNServerConfigRadiusClientRootCertificate struct { + // The certificate name. + Name *string `json:"name,omitempty"` + + // The Radius client root certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VPNServerConfigRadiusServerRootCertificate - Properties of Radius Server root certificate of VpnServerConfiguration. +type VPNServerConfigRadiusServerRootCertificate struct { + // The certificate name. + Name *string `json:"name,omitempty"` + + // The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VPNServerConfigVPNClientRevokedCertificate - Properties of the revoked VPN client certificate of VpnServerConfiguration. +type VPNServerConfigVPNClientRevokedCertificate struct { + // The certificate name. + Name *string `json:"name,omitempty"` + + // The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VPNServerConfigVPNClientRootCertificate - Properties of VPN client root certificate of VpnServerConfiguration. +type VPNServerConfigVPNClientRootCertificate struct { + // The certificate name. + Name *string `json:"name,omitempty"` + + // The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VPNServerConfiguration - VpnServerConfiguration Resource. +type VPNServerConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the P2SVpnServer configuration. + Properties *VPNServerConfigurationProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNServerConfigurationPolicyGroup - VpnServerConfigurationPolicyGroup Resource. +type VPNServerConfigurationPolicyGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the VpnServerConfigurationPolicyGroup. + Properties *VPNServerConfigurationPolicyGroupProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNServerConfigurationPolicyGroupMember - VpnServerConfiguration PolicyGroup member +type VPNServerConfigurationPolicyGroupMember struct { + // The Vpn Policy member attribute type. + AttributeType *VPNPolicyMemberAttributeType `json:"attributeType,omitempty"` + + // The value of Attribute used for this VpnServerConfigurationPolicyGroupMember. + AttributeValue *string `json:"attributeValue,omitempty"` + + // Name of the VpnServerConfigurationPolicyGroupMember. + Name *string `json:"name,omitempty"` +} + +// VPNServerConfigurationPolicyGroupProperties - Parameters for VpnServerConfigurationPolicyGroup. +type VPNServerConfigurationPolicyGroupProperties struct { + // Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + IsDefault *bool `json:"isDefault,omitempty"` + + // Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + PolicyMembers []*VPNServerConfigurationPolicyGroupMember `json:"policyMembers,omitempty"` + + // Priority for VpnServerConfigurationPolicyGroup. + Priority *int32 `json:"priority,omitempty"` + + // READ-ONLY; List of references to P2SConnectionConfigurations. + P2SConnectionConfigurations []*SubResource `json:"p2SConnectionConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the VpnServerConfigurationPolicyGroup resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNServerConfigurationProperties - Parameters for VpnServerConfiguration. +type VPNServerConfigurationProperties struct { + // The set of aad vpn authentication parameters. + AADAuthenticationParameters *AADAuthenticationParameters `json:"aadAuthenticationParameters,omitempty"` + + // List of all VpnServerConfigurationPolicyGroups. + ConfigurationPolicyGroups []*VPNServerConfigurationPolicyGroup `json:"configurationPolicyGroups,omitempty"` + + // The name of the VpnServerConfiguration that is unique within a resource group. + Name *string `json:"name,omitempty"` + + // Radius client root certificate of VpnServerConfiguration. + RadiusClientRootCertificates []*VPNServerConfigRadiusClientRootCertificate `json:"radiusClientRootCertificates,omitempty"` + + // The radius server address property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + + // Radius Server root certificate of VpnServerConfiguration. + RadiusServerRootCertificates []*VPNServerConfigRadiusServerRootCertificate `json:"radiusServerRootCertificates,omitempty"` + + // The radius secret property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + + // Multiple Radius Server configuration for VpnServerConfiguration. + RadiusServers []*RadiusServer `json:"radiusServers,omitempty"` + + // VPN authentication types for the VpnServerConfiguration. + VPNAuthenticationTypes []*VPNAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + + // VpnClientIpsecPolicies for VpnServerConfiguration. + VPNClientIPSecPolicies []*IPSecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + + // VPN client revoked certificate of VpnServerConfiguration. + VPNClientRevokedCertificates []*VPNServerConfigVPNClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + + // VPN client root certificate of VpnServerConfiguration. + VPNClientRootCertificates []*VPNServerConfigVPNClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + + // VPN protocols for the VpnServerConfiguration. + VPNProtocols []*VPNGatewayTunnelingProtocol `json:"vpnProtocols,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; List of references to P2SVpnGateways. + P2SVPNGateways []*P2SVPNGateway `json:"p2SVpnGateways,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', + // and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions contains the optional parameters for the VPNServerConfigurationsAssociatedWithVirtualWanClient.BeginList +// method. +type VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNServerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginCreateOrUpdate +// method. +type VPNServerConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNServerConfigurationsClientBeginDeleteOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginDelete +// method. +type VPNServerConfigurationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNServerConfigurationsClientGetOptions contains the optional parameters for the VPNServerConfigurationsClient.Get method. +type VPNServerConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNServerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the VPNServerConfigurationsClient.ListByResourceGroup +// method. +type VPNServerConfigurationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNServerConfigurationsClientListOptions contains the optional parameters for the VPNServerConfigurationsClient.List method. +type VPNServerConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// VPNServerConfigurationsClientUpdateTagsOptions contains the optional parameters for the VPNServerConfigurationsClient.UpdateTags +// method. +type VPNServerConfigurationsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VPNServerConfigurationsResponse - VpnServerConfigurations list associated with VirtualWan Response. +type VPNServerConfigurationsResponse struct { + // List of VpnServerConfigurations associated with VirtualWan. + VPNServerConfigurationResourceIDs []*string `json:"vpnServerConfigurationResourceIds,omitempty"` +} + +// VPNSite - VpnSite Resource. +type VPNSite struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the VPN site. + Properties *VPNSiteProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNSiteID - VpnSite Resource. +type VPNSiteID struct { + // READ-ONLY; The resource-uri of the vpn-site for which config is to be fetched. + VPNSite *string `json:"vpnSite,omitempty" azure:"ro"` +} + +// VPNSiteLink - VpnSiteLink Resource. +type VPNSiteLink struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the VPN site link. + Properties *VPNSiteLinkProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNSiteLinkConnection - VpnSiteLinkConnection Resource. +type VPNSiteLinkConnection struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the VPN site link connection. + Properties *VPNSiteLinkConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VPNSiteLinkConnectionProperties - Parameters for VpnConnection. +type VPNSiteLinkConnectionProperties struct { + // Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + + // List of egress NatRules. + EgressNatRules []*SubResource `json:"egressNatRules,omitempty"` + + // EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + + // EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy `json:"ipsecPolicies,omitempty"` + + // List of ingress NatRules. + IngressNatRules []*SubResource `json:"ingressNatRules,omitempty"` + + // Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + + // SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + + // Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + + // Connection protocol used for this connection. + VPNConnectionProtocolType *VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + + // vpnGatewayCustomBgpAddresses used by this connection. + VPNGatewayCustomBgpAddresses []*GatewayCustomBgpIPAddressIPConfiguration `json:"vpnGatewayCustomBgpAddresses,omitempty"` + + // Vpn link connection mode. + VPNLinkConnectionMode *VPNLinkConnectionMode `json:"vpnLinkConnectionMode,omitempty"` + + // Id of the connected vpn site link. + VPNSiteLink *SubResource `json:"vpnSiteLink,omitempty"` + + // READ-ONLY; The connection status. + ConnectionStatus *VPNConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the VPN site link connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNSiteLinkConnectionsClientGetOptions contains the optional parameters for the VPNSiteLinkConnectionsClient.Get method. +type VPNSiteLinkConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNSiteLinkProperties - Parameters for VpnSite. +type VPNSiteLinkProperties struct { + // The set of bgp properties. + BgpProperties *VPNLinkBgpSettings `json:"bgpProperties,omitempty"` + + // FQDN of vpn-site-link. + Fqdn *string `json:"fqdn,omitempty"` + + // The ip-address for the vpn-site-link. + IPAddress *string `json:"ipAddress,omitempty"` + + // The link provider properties. + LinkProperties *VPNLinkProviderProperties `json:"linkProperties,omitempty"` + + // READ-ONLY; The provisioning state of the VPN site link resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNSiteLinksClientGetOptions contains the optional parameters for the VPNSiteLinksClient.Get method. +type VPNSiteLinksClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNSiteLinksClientListByVPNSiteOptions contains the optional parameters for the VPNSiteLinksClient.ListByVPNSite method. +type VPNSiteLinksClientListByVPNSiteOptions struct { + // placeholder for future optional parameters +} + +// VPNSiteProperties - Parameters for VpnSite. +type VPNSiteProperties struct { + // The AddressSpace that contains an array of IP address ranges. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + + // The set of bgp properties. + BgpProperties *BgpSettings `json:"bgpProperties,omitempty"` + + // The device properties. + DeviceProperties *DeviceProperties `json:"deviceProperties,omitempty"` + + // The ip-address for the vpn-site. + IPAddress *string `json:"ipAddress,omitempty"` + + // IsSecuritySite flag. + IsSecuritySite *bool `json:"isSecuritySite,omitempty"` + + // Office365 Policy. + O365Policy *O365PolicyProperties `json:"o365Policy,omitempty"` + + // The key for vpn-site that can be used for connections. + SiteKey *string `json:"siteKey,omitempty"` + + // List of all vpn site links. + VPNSiteLinks []*VPNSiteLink `json:"vpnSiteLinks,omitempty"` + + // The VirtualWAN to which the vpnSite belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + + // READ-ONLY; The provisioning state of the VPN site resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VPNSitesClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNSitesClient.BeginCreateOrUpdate method. +type VPNSitesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNSitesClientBeginDeleteOptions contains the optional parameters for the VPNSitesClient.BeginDelete method. +type VPNSitesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VPNSitesClientGetOptions contains the optional parameters for the VPNSitesClient.Get method. +type VPNSitesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VPNSitesClientListByResourceGroupOptions contains the optional parameters for the VPNSitesClient.ListByResourceGroup method. +type VPNSitesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VPNSitesClientListOptions contains the optional parameters for the VPNSitesClient.List method. +type VPNSitesClientListOptions struct { + // placeholder for future optional parameters +} + +// VPNSitesClientUpdateTagsOptions contains the optional parameters for the VPNSitesClient.UpdateTags method. +type VPNSitesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VPNSitesConfigurationClientBeginDownloadOptions contains the optional parameters for the VPNSitesConfigurationClient.BeginDownload +// method. +type VPNSitesConfigurationClientBeginDownloadOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VerificationIPFlowParameters - Parameters that define the IP flow to be verified. +type VerificationIPFlowParameters struct { + // REQUIRED; The direction of the packet represented as a 5-tuple. + Direction *Direction `json:"direction,omitempty"` + + // REQUIRED; The local IP address. Acceptable values are valid IPv4 addresses. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + + // REQUIRED; The local port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, + // which depends on the direction. + LocalPort *string `json:"localPort,omitempty"` + + // REQUIRED; Protocol to be verified on. + Protocol *IPFlowProtocol `json:"protocol,omitempty"` + + // REQUIRED; The remote IP address. Acceptable values are valid IPv4 addresses. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + + // REQUIRED; The remote port. Acceptable values are a single integer in the range (0-65535). Support for * for the source + // port, which depends on the direction. + RemotePort *string `json:"remotePort,omitempty"` + + // REQUIRED; The ID of the target resource to perform next-hop on. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of them, then this parameter must be specified. + // Otherwise optional). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// VerificationIPFlowResult - Results of IP flow verification on the target resource. +type VerificationIPFlowResult struct { + // Indicates whether the traffic is allowed or denied. + Access *Access `json:"access,omitempty"` + + // Name of the rule. If input is not matched against any security rule, it is not displayed. + RuleName *string `json:"ruleName,omitempty"` +} + +// VipSwapClientBeginCreateOptions contains the optional parameters for the VipSwapClient.BeginCreate method. +type VipSwapClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VipSwapClientGetOptions contains the optional parameters for the VipSwapClient.Get method. +type VipSwapClientGetOptions struct { + // placeholder for future optional parameters +} + +// VipSwapClientListOptions contains the optional parameters for the VipSwapClient.List method. +type VipSwapClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualAppliance - NetworkVirtualAppliance Resource. +type VirtualAppliance struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // The service principal that has read access to cloud-init and config blob. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the Network Virtual Appliance. + Properties *VirtualAppliancePropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualApplianceListResult - Response for ListNetworkVirtualAppliances API service call. +type VirtualApplianceListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Network Virtual Appliances. + Value []*VirtualAppliance `json:"value,omitempty"` +} + +// VirtualApplianceNicProperties - Network Virtual Appliance NIC properties. +type VirtualApplianceNicProperties struct { + // READ-ONLY; NIC name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Private IP address. + PrivateIPAddress *string `json:"privateIpAddress,omitempty" azure:"ro"` + + // READ-ONLY; Public IP address. + PublicIPAddress *string `json:"publicIpAddress,omitempty" azure:"ro"` +} + +// VirtualAppliancePropertiesFormat - Network Virtual Appliance definition. +type VirtualAppliancePropertiesFormat struct { + // BootStrapConfigurationBlobs storage URLs. + BootStrapConfigurationBlobs []*string `json:"bootStrapConfigurationBlobs,omitempty"` + + // CloudInitConfiguration string in plain text. + CloudInitConfiguration *string `json:"cloudInitConfiguration,omitempty"` + + // CloudInitConfigurationBlob storage URLs. + CloudInitConfigurationBlobs []*string `json:"cloudInitConfigurationBlobs,omitempty"` + + // Network Virtual Appliance SKU. + NvaSKU *VirtualApplianceSKUProperties `json:"nvaSku,omitempty"` + + // Public key for SSH login. + SSHPublicKey *string `json:"sshPublicKey,omitempty"` + + // VirtualAppliance ASN. + VirtualApplianceAsn *int64 `json:"virtualApplianceAsn,omitempty"` + + // The Virtual Hub where Network Virtual Appliance is being deployed. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + + // READ-ONLY; Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty" azure:"ro"` + + // READ-ONLY; List of references to InboundSecurityRules. + InboundSecurityRules []*SubResource `json:"inboundSecurityRules,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; List of Virtual Appliance Network Interfaces. + VirtualApplianceNics []*VirtualApplianceNicProperties `json:"virtualApplianceNics,omitempty" azure:"ro"` + + // READ-ONLY; List of references to VirtualApplianceSite. + VirtualApplianceSites []*SubResource `json:"virtualApplianceSites,omitempty" azure:"ro"` +} + +// VirtualApplianceSKU - Definition of the NetworkVirtualApplianceSkus resource. +type VirtualApplianceSKU struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // NetworkVirtualApplianceSku properties. + Properties *VirtualApplianceSKUPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualApplianceSKUInstances - List of available Sku and instances. +type VirtualApplianceSKUInstances struct { + // READ-ONLY; Instance Count. + InstanceCount *int32 `json:"instanceCount,omitempty" azure:"ro"` + + // READ-ONLY; Scale Unit. + ScaleUnit *string `json:"scaleUnit,omitempty" azure:"ro"` +} + +// VirtualApplianceSKUListResult - Response for ListNetworkVirtualApplianceSkus API service call. +type VirtualApplianceSKUListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Network Virtual Appliance Skus that are available. + Value []*VirtualApplianceSKU `json:"value,omitempty"` +} + +// VirtualApplianceSKUProperties - Network Virtual Appliance Sku Properties. +type VirtualApplianceSKUProperties struct { + // Virtual Appliance Scale Unit. + BundledScaleUnit *string `json:"bundledScaleUnit,omitempty"` + + // Virtual Appliance Version. + MarketPlaceVersion *string `json:"marketPlaceVersion,omitempty"` + + // Virtual Appliance Vendor. + Vendor *string `json:"vendor,omitempty"` +} + +// VirtualApplianceSKUPropertiesFormat - Properties specific to NetworkVirtualApplianceSkus. +type VirtualApplianceSKUPropertiesFormat struct { + // The list of scale units available. + AvailableScaleUnits []*VirtualApplianceSKUInstances `json:"availableScaleUnits,omitempty"` + + // READ-ONLY; Available Network Virtual Appliance versions. + AvailableVersions []*string `json:"availableVersions,omitempty" azure:"ro"` + + // READ-ONLY; Network Virtual Appliance Sku vendor. + Vendor *string `json:"vendor,omitempty" azure:"ro"` +} + +// VirtualApplianceSKUsClientGetOptions contains the optional parameters for the VirtualApplianceSKUsClient.Get method. +type VirtualApplianceSKUsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualApplianceSKUsClientListOptions contains the optional parameters for the VirtualApplianceSKUsClient.List method. +type VirtualApplianceSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualApplianceSite - Virtual Appliance Site resource. +type VirtualApplianceSite struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the virtual appliance site. + Name *string `json:"name,omitempty"` + + // The properties of the Virtual Appliance Sites. + Properties *VirtualApplianceSiteProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Site type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualApplianceSiteListResult - Response for ListNetworkVirtualApplianceSites API service call. +type VirtualApplianceSiteListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Network Virtual Appliance sites. + Value []*VirtualApplianceSite `json:"value,omitempty"` +} + +// VirtualApplianceSiteProperties - Properties of the rule group. +type VirtualApplianceSiteProperties struct { + // Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // Office 365 Policy. + O365Policy *Office365PolicyProperties `json:"o365Policy,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualApplianceSitesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualApplianceSitesClient.BeginCreateOrUpdate +// method. +type VirtualApplianceSitesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualApplianceSitesClientBeginDeleteOptions contains the optional parameters for the VirtualApplianceSitesClient.BeginDelete +// method. +type VirtualApplianceSitesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualApplianceSitesClientGetOptions contains the optional parameters for the VirtualApplianceSitesClient.Get method. +type VirtualApplianceSitesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualApplianceSitesClientListOptions contains the optional parameters for the VirtualApplianceSitesClient.List method. +type VirtualApplianceSitesClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualAppliancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualAppliancesClient.BeginCreateOrUpdate +// method. +type VirtualAppliancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualAppliancesClientBeginDeleteOptions contains the optional parameters for the VirtualAppliancesClient.BeginDelete +// method. +type VirtualAppliancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualAppliancesClientGetOptions contains the optional parameters for the VirtualAppliancesClient.Get method. +type VirtualAppliancesClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// VirtualAppliancesClientListByResourceGroupOptions contains the optional parameters for the VirtualAppliancesClient.ListByResourceGroup +// method. +type VirtualAppliancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualAppliancesClientListOptions contains the optional parameters for the VirtualAppliancesClient.List method. +type VirtualAppliancesClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualAppliancesClientUpdateTagsOptions contains the optional parameters for the VirtualAppliancesClient.UpdateTags method. +type VirtualAppliancesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VirtualHub Resource. +type VirtualHub struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the virtual hub. + Properties *VirtualHubProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server. + Kind *string `json:"kind,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubBgpConnectionClient.BeginCreateOrUpdate +// method. +type VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubBgpConnectionClientBeginDeleteOptions contains the optional parameters for the VirtualHubBgpConnectionClient.BeginDelete +// method. +type VirtualHubBgpConnectionClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubBgpConnectionClientGetOptions contains the optional parameters for the VirtualHubBgpConnectionClient.Get method. +type VirtualHubBgpConnectionClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.BeginListAdvertisedRoutes +// method. +type VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.BeginListLearnedRoutes +// method. +type VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubBgpConnectionsClientListOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.List +// method. +type VirtualHubBgpConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubEffectiveRoute - The effective route configured on the virtual hub or specified resource. +type VirtualHubEffectiveRoute struct { + // The list of address prefixes. + AddressPrefixes []*string `json:"addressPrefixes,omitempty"` + + // The ASPath of this route. + AsPath *string `json:"asPath,omitempty"` + + // The type of the next hop. + NextHopType *string `json:"nextHopType,omitempty"` + + // The list of next hops. + NextHops []*string `json:"nextHops,omitempty"` + + // The origin of this route. + RouteOrigin *string `json:"routeOrigin,omitempty"` +} + +// VirtualHubEffectiveRouteList - EffectiveRoutes List. +type VirtualHubEffectiveRouteList struct { + // The list of effective routes configured on the virtual hub or the specified resource. + Value []*VirtualHubEffectiveRoute `json:"value,omitempty"` +} + +// VirtualHubID - Virtual Hub identifier. +type VirtualHubID struct { + // The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and + // the ExpressRoute gateway resource reside in the same subscription. + ID *string `json:"id,omitempty"` +} + +// VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubIPConfigurationClient.BeginCreateOrUpdate +// method. +type VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubIPConfigurationClientBeginDeleteOptions contains the optional parameters for the VirtualHubIPConfigurationClient.BeginDelete +// method. +type VirtualHubIPConfigurationClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubIPConfigurationClientGetOptions contains the optional parameters for the VirtualHubIPConfigurationClient.Get +// method. +type VirtualHubIPConfigurationClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubIPConfigurationClientListOptions contains the optional parameters for the VirtualHubIPConfigurationClient.List +// method. +type VirtualHubIPConfigurationClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubProperties - Parameters for VirtualHub. +type VirtualHubProperties struct { + // Address-prefix for this VirtualHub. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // Flag to control transit for VirtualRouter hub. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + + // The azureFirewall associated with this VirtualHub. + AzureFirewall *SubResource `json:"azureFirewall,omitempty"` + + // The expressRouteGateway associated with this VirtualHub. + ExpressRouteGateway *SubResource `json:"expressRouteGateway,omitempty"` + + // The hubRoutingPreference of this VirtualHub. + HubRoutingPreference *HubRoutingPreference `json:"hubRoutingPreference,omitempty"` + + // The P2SVpnGateway associated with this VirtualHub. + P2SVPNGateway *SubResource `json:"p2SVpnGateway,omitempty"` + + // The preferred gateway to route on-prem traffic + PreferredRoutingGateway *PreferredRoutingGateway `json:"preferredRoutingGateway,omitempty"` + + // The routeTable associated with this virtual hub. + RouteTable *VirtualHubRouteTable `json:"routeTable,omitempty"` + + // The sku of this VirtualHub. + SKU *string `json:"sku,omitempty"` + + // The securityPartnerProvider associated with this VirtualHub. + SecurityPartnerProvider *SubResource `json:"securityPartnerProvider,omitempty"` + + // The Security Provider name. + SecurityProviderName *string `json:"securityProviderName,omitempty"` + + // The VpnGateway associated with this VirtualHub. + VPNGateway *SubResource `json:"vpnGateway,omitempty"` + + // List of all virtual hub route table v2s associated with this VirtualHub. + VirtualHubRouteTableV2S []*VirtualHubRouteTableV2 `json:"virtualHubRouteTableV2s,omitempty"` + + // VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + + // The VirtualHub Router autoscale configuration. + VirtualRouterAutoScaleConfiguration *VirtualRouterAutoScaleConfiguration `json:"virtualRouterAutoScaleConfiguration,omitempty"` + + // VirtualRouter IPs. + VirtualRouterIPs []*string `json:"virtualRouterIps,omitempty"` + + // The VirtualWAN to which the VirtualHub belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + + // READ-ONLY; List of references to Bgp Connections. + BgpConnections []*SubResource `json:"bgpConnections,omitempty" azure:"ro"` + + // READ-ONLY; List of references to IpConfigurations. + IPConfigurations []*SubResource `json:"ipConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual hub resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; List of references to RouteMaps. + RouteMaps []*SubResource `json:"routeMaps,omitempty" azure:"ro"` + + // READ-ONLY; The routing state. + RoutingState *RoutingState `json:"routingState,omitempty" azure:"ro"` +} + +// VirtualHubRoute - VirtualHub route. +type VirtualHubRoute struct { + // List of all addressPrefixes. + AddressPrefixes []*string `json:"addressPrefixes,omitempty"` + + // NextHop ip address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// VirtualHubRouteTable - VirtualHub route table. +type VirtualHubRouteTable struct { + // List of all routes. + Routes []*VirtualHubRoute `json:"routes,omitempty"` +} + +// VirtualHubRouteTableV2 Resource. +type VirtualHubRouteTableV2 struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the virtual hub route table v2. + Properties *VirtualHubRouteTableV2Properties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VirtualHubRouteTableV2Properties - Parameters for VirtualHubRouteTableV2. +type VirtualHubRouteTableV2Properties struct { + // List of all connections attached to this route table v2. + AttachedConnections []*string `json:"attachedConnections,omitempty"` + + // List of all routes. + Routes []*VirtualHubRouteV2 `json:"routes,omitempty"` + + // READ-ONLY; The provisioning state of the virtual hub route table v2 resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.BeginCreateOrUpdate +// method. +type VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubRouteTableV2SClientBeginDeleteOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.BeginDelete +// method. +type VirtualHubRouteTableV2SClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubRouteTableV2SClientGetOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.Get method. +type VirtualHubRouteTableV2SClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubRouteTableV2SClientListOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.List method. +type VirtualHubRouteTableV2SClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubRouteV2 - VirtualHubRouteTableV2 route. +type VirtualHubRouteV2 struct { + // The type of destinations. + DestinationType *string `json:"destinationType,omitempty"` + + // List of all destinations. + Destinations []*string `json:"destinations,omitempty"` + + // The type of next hops. + NextHopType *string `json:"nextHopType,omitempty"` + + // NextHops ip address. + NextHops []*string `json:"nextHops,omitempty"` +} + +// VirtualHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubsClient.BeginCreateOrUpdate +// method. +type VirtualHubsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubsClientBeginDeleteOptions contains the optional parameters for the VirtualHubsClient.BeginDelete method. +type VirtualHubsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetEffectiveVirtualHubRoutes +// method. +type VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions struct { + // Parameters supplied to get the effective routes for a specific resource. + EffectiveRoutesParameters *EffectiveRoutesParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubsClientBeginGetInboundRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetInboundRoutes +// method. +type VirtualHubsClientBeginGetInboundRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubsClientBeginGetOutboundRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetOutboundRoutes +// method. +type VirtualHubsClientBeginGetOutboundRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualHubsClientGetOptions contains the optional parameters for the VirtualHubsClient.Get method. +type VirtualHubsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubsClientListByResourceGroupOptions contains the optional parameters for the VirtualHubsClient.ListByResourceGroup +// method. +type VirtualHubsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubsClientListOptions contains the optional parameters for the VirtualHubsClient.List method. +type VirtualHubsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualHubsClientUpdateTagsOptions contains the optional parameters for the VirtualHubsClient.UpdateTags method. +type VirtualHubsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetwork - Virtual Network resource. +type VirtualNetwork struct { + // The extended location of the virtual network. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the virtual network. + Properties *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkBgpCommunities - Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this +// VNET. +type VirtualNetworkBgpCommunities struct { + // REQUIRED; The BGP community associated with the virtual network. + VirtualNetworkCommunity *string `json:"virtualNetworkCommunity,omitempty"` + + // READ-ONLY; The BGP community associated with the region of the virtual network. + RegionalCommunity *string `json:"regionalCommunity,omitempty" azure:"ro"` +} + +// VirtualNetworkConnectionGatewayReference - A reference to VirtualNetworkGateway or LocalNetworkGateway resource. +type VirtualNetworkConnectionGatewayReference struct { + // REQUIRED; The ID of VirtualNetworkGateway or LocalNetworkGateway resource. + ID *string `json:"id,omitempty"` +} + +// VirtualNetworkDdosProtectionStatusResult - Response for GetVirtualNetworkDdosProtectionStatusOperation. +type VirtualNetworkDdosProtectionStatusResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The Ddos Protection Status Result for each public ip under a virtual network. + Value []*PublicIPDdosProtectionStatusResult `json:"value,omitempty"` +} + +// VirtualNetworkEncryption - Indicates if encryption is enabled on virtual network and if VM without encryption is allowed +// in encrypted VNet. +type VirtualNetworkEncryption struct { + // REQUIRED; Indicates if encryption is enabled on the virtual network. + Enabled *bool `json:"enabled,omitempty"` + + // If the encrypted VNet allows VM that does not support encryption + Enforcement *VirtualNetworkEncryptionEnforcement `json:"enforcement,omitempty"` +} + +// VirtualNetworkGateway - A common class for general resource information. +type VirtualNetworkGateway struct { + // REQUIRED; Properties of the virtual network gateway. + Properties *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + + // The extended location of type local virtual network gateway. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnection - A common class for general resource information. +type VirtualNetworkGatewayConnection struct { + // REQUIRED; Properties of the virtual network gateway connection. + Properties *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnectionListEntity - A common class for general resource information. +type VirtualNetworkGatewayConnectionListEntity struct { + // REQUIRED; Properties of the virtual network gateway connection. + Properties *VirtualNetworkGatewayConnectionListEntityPropertiesFormat `json:"properties,omitempty"` + + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnectionListEntityPropertiesFormat - VirtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionListEntityPropertiesFormat struct { + // REQUIRED; Gateway connection type. + ConnectionType *VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + + // REQUIRED; The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway1,omitempty"` + + // The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // The connection mode for this connection. + ConnectionMode *VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + + // Connection protocol used for this connection. + ConnectionProtocol *VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + + // EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` + + // Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + + // GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses []*GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy `json:"ipsecPolicies,omitempty"` + + // The reference to local network gateway resource. + LocalNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"localNetworkGateway2,omitempty"` + + // The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + + // The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + + // The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + + // The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway2,omitempty"` + + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual network gateway connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus []*TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnectionListResult - Response for the ListVirtualNetworkGatewayConnections API service call. +type VirtualNetworkGatewayConnectionListResult struct { + // A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value []*VirtualNetworkGatewayConnection `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnectionPropertiesFormat - VirtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionPropertiesFormat struct { + // REQUIRED; Gateway connection type. + ConnectionType *VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + + // REQUIRED; The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` + + // The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + + // The connection mode for this connection. + ConnectionMode *VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + + // Connection protocol used for this connection. + ConnectionProtocol *VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + + // The dead peer detection timeout of this connection in seconds. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + + // List of egress NatRules. + EgressNatRules []*SubResource `json:"egressNatRules,omitempty"` + + // EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + + // Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be + // enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` + + // Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + + // GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses []*GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + + // The IPSec Policies to be considered by this connection. + IPSecPolicies []*IPSecPolicy `json:"ipsecPolicies,omitempty"` + + // List of ingress NatRules. + IngressNatRules []*SubResource `json:"ingressNatRules,omitempty"` + + // The reference to local network gateway resource. + LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` + + // The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + + // The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + + // The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + + // The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies []*TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + + // Use private local Azure IP for the connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + + // Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + + // The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` + + // READ-ONLY; Virtual Network Gateway connection status. + ConnectionStatus *VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual network gateway connection resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` + + // READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus []*TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginCreateOrUpdate +// method. +type VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginDelete +// method. +type VirtualNetworkGatewayConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginGetIkeSas +// method. +type VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginResetConnection +// method. +type VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginResetSharedKey +// method. +type VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginSetSharedKey +// method. +type VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginStartPacketCapture +// method. +type VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions struct { + // Virtual network gateway packet capture parameters supplied to start packet capture on gateway connection. + Parameters *VPNPacketCaptureStartParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginStopPacketCapture +// method. +type VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginUpdateTags +// method. +type VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayConnectionsClientGetOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.Get +// method. +type VirtualNetworkGatewayConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewayConnectionsClientGetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.GetSharedKey +// method. +type VirtualNetworkGatewayConnectionsClientGetSharedKeyOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewayConnectionsClientListOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.List +// method. +type VirtualNetworkGatewayConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewayIPConfiguration - IP configuration for virtual network gateway. +type VirtualNetworkGatewayIPConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the virtual network gateway ip configuration. + Properties *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayIPConfigurationPropertiesFormat - Properties of VirtualNetworkGatewayIPConfiguration. +type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { + // The private IP address allocation method. + PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + + // The reference to the public IP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + + // The reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + + // READ-ONLY; Private IP Address for this gateway. + PrivateIPAddress *string `json:"privateIPAddress,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual network gateway IP configuration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayListConnectionsResult - Response for the VirtualNetworkGatewayListConnections API service call. +type VirtualNetworkGatewayListConnectionsResult struct { + // A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value []*VirtualNetworkGatewayConnectionListEntity `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayListResult - Response for the ListVirtualNetworkGateways API service call. +type VirtualNetworkGatewayListResult struct { + // A list of VirtualNetworkGateway resources that exists in a resource group. + Value []*VirtualNetworkGateway `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayNatRule Resource. +type VirtualNetworkGatewayNatRule struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the Virtual Network Gateway NAT rule. + Properties *VirtualNetworkGatewayNatRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayNatRuleProperties - Parameters for VirtualNetworkGatewayNatRule. +type VirtualNetworkGatewayNatRuleProperties struct { + // The private IP address external mapping for NAT. + ExternalMappings []*VPNNatRuleMapping `json:"externalMappings,omitempty"` + + // The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + + // The private IP address internal mapping for NAT. + InternalMappings []*VPNNatRuleMapping `json:"internalMappings,omitempty"` + + // The Source NAT direction of a VPN NAT. + Mode *VPNNatRuleMode `json:"mode,omitempty"` + + // The type of NAT rule for VPN NAT. + Type *VPNNatRuleType `json:"type,omitempty"` + + // READ-ONLY; The provisioning state of the NAT Rule resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.BeginCreateOrUpdate +// method. +type VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayNatRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.BeginDelete +// method. +type VirtualNetworkGatewayNatRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewayNatRulesClientGetOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.Get +// method. +type VirtualNetworkGatewayNatRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.ListByVirtualNetworkGateway +// method. +type VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewayPolicyGroup - Parameters for VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroup struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of tVirtualNetworkGatewayPolicyGroup. + Properties *VirtualNetworkGatewayPolicyGroupProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayPolicyGroupMember - Vpn Client Connection configuration PolicyGroup member +type VirtualNetworkGatewayPolicyGroupMember struct { + // The Vpn Policy member attribute type. + AttributeType *VPNPolicyMemberAttributeType `json:"attributeType,omitempty"` + + // The value of Attribute used for this VirtualNetworkGatewayPolicyGroupMember. + AttributeValue *string `json:"attributeValue,omitempty"` + + // Name of the VirtualNetworkGatewayPolicyGroupMember. + Name *string `json:"name,omitempty"` +} + +// VirtualNetworkGatewayPolicyGroupProperties - Properties of VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroupProperties struct { + // REQUIRED; Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. + IsDefault *bool `json:"isDefault,omitempty"` + + // REQUIRED; Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. + PolicyMembers []*VirtualNetworkGatewayPolicyGroupMember `json:"policyMembers,omitempty"` + + // REQUIRED; Priority for VirtualNetworkGatewayPolicyGroup. + Priority *int32 `json:"priority,omitempty"` + + // READ-ONLY; The provisioning state of the VirtualNetworkGatewayPolicyGroup resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; List of references to vngClientConnectionConfigurations. + VngClientConnectionConfigurations []*SubResource `json:"vngClientConnectionConfigurations,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewayPropertiesFormat - VirtualNetworkGateway properties. +type VirtualNetworkGatewayPropertiesFormat struct { + // ActiveActive flag. + Active *bool `json:"activeActive,omitempty"` + + // Configure this gateway to accept traffic from other Azure Virtual Networks. This configuration does not support connectivity + // to Azure Virtual WAN. + AllowRemoteVnetTraffic *bool `json:"allowRemoteVnetTraffic,omitempty"` + + // Configures this gateway to accept traffic from remote Virtual WAN networks. + AllowVirtualWanTraffic *bool `json:"allowVirtualWanTraffic,omitempty"` + + // Virtual network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + + // The reference to the address space resource which represents the custom routes address space specified by the customer + // for virtual network gateway and VpnClient. + CustomRoutes *AddressSpace `json:"customRoutes,omitempty"` + + // disableIPSecReplayProtection flag. + DisableIPSecReplayProtection *bool `json:"disableIPSecReplayProtection,omitempty"` + + // Whether BGP is enabled for this virtual network gateway or not. + EnableBgp *bool `json:"enableBgp,omitempty"` + + // EnableBgpRouteTranslationForNat flag. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` + + // Whether dns forwarding is enabled or not. + EnableDNSForwarding *bool `json:"enableDnsForwarding,omitempty"` + + // Whether private IP needs to be enabled on this gateway for connections or not. + EnablePrivateIPAddress *bool `json:"enablePrivateIpAddress,omitempty"` + + // The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null + // value in case of removing existing default site setting. + GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` + + // The type of this virtual network gateway. + GatewayType *VirtualNetworkGatewayType `json:"gatewayType,omitempty"` + + // IP configurations for virtual network gateway. + IPConfigurations []*VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + + // NatRules for virtual network gateway. + NatRules []*VirtualNetworkGatewayNatRule `json:"natRules,omitempty"` + + // The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. + SKU *VirtualNetworkGatewaySKU `json:"sku,omitempty"` + + // Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. + VNetExtendedLocationResourceID *string `json:"vNetExtendedLocationResourceId,omitempty"` + + // The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. + VPNClientConfiguration *VPNClientConfiguration `json:"vpnClientConfiguration,omitempty"` + + // The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. + VPNGatewayGeneration *VPNGatewayGeneration `json:"vpnGatewayGeneration,omitempty"` + + // The type of this virtual network gateway. + VPNType *VPNType `json:"vpnType,omitempty"` + + // The reference to the VirtualNetworkGatewayPolicyGroup resource which represents the available VirtualNetworkGatewayPolicyGroup + // for the gateway. + VirtualNetworkGatewayPolicyGroups []*VirtualNetworkGatewayPolicyGroup `json:"virtualNetworkGatewayPolicyGroups,omitempty"` + + // READ-ONLY; The IP address allocated by the gateway to which dns requests can be sent. + InboundDNSForwardingEndpoint *string `json:"inboundDnsForwardingEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual network gateway resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the virtual network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewaySKU - VirtualNetworkGatewaySku details. +type VirtualNetworkGatewaySKU struct { + // Gateway SKU name. + Name *VirtualNetworkGatewaySKUName `json:"name,omitempty"` + + // Gateway SKU tier. + Tier *VirtualNetworkGatewaySKUTier `json:"tier,omitempty"` + + // READ-ONLY; The capacity. + Capacity *int32 `json:"capacity,omitempty" azure:"ro"` +} + +// VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginCreateOrUpdate +// method. +type VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginDelete +// method. +type VirtualNetworkGatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions contains the optional parameters +// for the VirtualNetworkGatewaysClient.BeginDisconnectVirtualNetworkGatewayVPNConnections method. +type VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGenerateVPNProfile +// method. +type VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGeneratevpnclientpackage +// method. +type VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetAdvertisedRoutes +// method. +type VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetBgpPeerStatus +// method. +type VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions struct { + // The IP address of the peer to retrieve the status of. + Peer *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetLearnedRoutes +// method. +type VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetVPNProfilePackageURL +// method. +type VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetVpnclientConnectionHealth +// method. +type VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetVpnclientIPSecParameters +// method. +type VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginResetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginReset +// method. +type VirtualNetworkGatewaysClientBeginResetOptions struct { + // Virtual network gateway vip address supplied to the begin reset of the active-active feature enabled gateway. + GatewayVip *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginResetVPNClientSharedKey +// method. +type VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginSetVpnclientIPSecParameters +// method. +type VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStartPacketCapture +// method. +type VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions struct { + // Virtual network gateway packet capture parameters supplied to start packet capture on gateway. + Parameters *VPNPacketCaptureStartParameters + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStopPacketCapture +// method. +type VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginUpdateTags +// method. +type VirtualNetworkGatewaysClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkGatewaysClientGetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.Get method. +type VirtualNetworkGatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewaysClientListConnectionsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.ListConnections +// method. +type VirtualNetworkGatewaysClientListConnectionsOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewaysClientListOptions contains the optional parameters for the VirtualNetworkGatewaysClient.List method. +type VirtualNetworkGatewaysClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewaysClientSupportedVPNDevicesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.SupportedVPNDevices +// method. +type VirtualNetworkGatewaysClientSupportedVPNDevicesOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions contains the optional parameters for the VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript +// method. +type VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkListResult - Response for the ListVirtualNetworks API service call. +type VirtualNetworkListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of VirtualNetwork resources in a resource group. + Value []*VirtualNetwork `json:"value,omitempty"` +} + +// VirtualNetworkListUsageResult - Response for the virtual networks GetUsage API service call. +type VirtualNetworkListUsageResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // READ-ONLY; VirtualNetwork usage stats. + Value []*VirtualNetworkUsage `json:"value,omitempty" azure:"ro"` +} + +// VirtualNetworkPeering - Peerings in a virtual network resource. +type VirtualNetworkPeering struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the virtual network peering. + Properties *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + + // Resource type. + Type *string `json:"type,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VirtualNetworkPeeringListResult - Response for ListSubnets API service call. Retrieves all subnets that belong to a virtual +// network. +type VirtualNetworkPeeringListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // The peerings in a virtual network. + Value []*VirtualNetworkPeering `json:"value,omitempty"` +} + +// VirtualNetworkPeeringPropertiesFormat - Properties of the virtual network peering. +type VirtualNetworkPeeringPropertiesFormat struct { + // Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + + // If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + + // Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + + // If we need to verify the provisioning state of the remote gateway. + DoNotVerifyRemoteGateways *bool `json:"doNotVerifyRemoteGateways,omitempty"` + + // The status of the virtual network peering. + PeeringState *VirtualNetworkPeeringState `json:"peeringState,omitempty"` + + // The peering sync status of the virtual network peering. + PeeringSyncLevel *VirtualNetworkPeeringLevel `json:"peeringSyncLevel,omitempty"` + + // The reference to the address space peered with the remote virtual network. + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + + // The reference to the remote virtual network's Bgp Communities. + RemoteBgpCommunities *VirtualNetworkBgpCommunities `json:"remoteBgpCommunities,omitempty"` + + // The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). + // See here to register for the preview and learn more + // (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + + // The reference to the current address space of the remote virtual network. + RemoteVirtualNetworkAddressSpace *AddressSpace `json:"remoteVirtualNetworkAddressSpace,omitempty"` + + // If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering + // is also true, virtual network will use gateways of remote virtual network + // for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a + // gateway. + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + + // READ-ONLY; The provisioning state of the virtual network peering resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The reference to the remote virtual network's encryption + RemoteVirtualNetworkEncryption *VirtualNetworkEncryption `json:"remoteVirtualNetworkEncryption,omitempty" azure:"ro"` + + // READ-ONLY; The resourceGuid property of the Virtual Network peering resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkPeeringsClient.BeginCreateOrUpdate +// method. +type VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // Parameter indicates the intention to sync the peering with the current address space on the remote vNet after it's updated. + SyncRemoteAddressSpace *SyncRemoteAddressSpace +} + +// VirtualNetworkPeeringsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkPeeringsClient.BeginDelete +// method. +type VirtualNetworkPeeringsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkPeeringsClientGetOptions contains the optional parameters for the VirtualNetworkPeeringsClient.Get method. +type VirtualNetworkPeeringsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkPeeringsClientListOptions contains the optional parameters for the VirtualNetworkPeeringsClient.List method. +type VirtualNetworkPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkPropertiesFormat - Properties of the virtual network. +type VirtualNetworkPropertiesFormat struct { + // The AddressSpace that contains an array of IP address ranges that can be used by subnets. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + + // Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. + BgpCommunities *VirtualNetworkBgpCommunities `json:"bgpCommunities,omitempty"` + + // The DDoS protection plan associated with the virtual network. + DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` + + // The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. + DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` + + // Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection + // plan associated with the resource. + EnableDdosProtection *bool `json:"enableDdosProtection,omitempty"` + + // Indicates if VM protection is enabled for all the subnets in the virtual network. + EnableVMProtection *bool `json:"enableVmProtection,omitempty"` + + // Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. + Encryption *VirtualNetworkEncryption `json:"encryption,omitempty"` + + // The FlowTimeout value (in minutes) for the Virtual Network + FlowTimeoutInMinutes *int32 `json:"flowTimeoutInMinutes,omitempty"` + + // Array of IpAllocation which reference this VNET. + IPAllocations []*SubResource `json:"ipAllocations,omitempty"` + + // A list of subnets in a Virtual Network. + Subnets []*Subnet `json:"subnets,omitempty"` + + // A list of peerings in a Virtual Network. + VirtualNetworkPeerings []*VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` + + // READ-ONLY; The provisioning state of the virtual network resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resourceGuid property of the Virtual Network resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// VirtualNetworkTap - Virtual Network Tap resource. +type VirtualNetworkTap struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Virtual Network Tap Properties. + Properties *VirtualNetworkTapPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualNetworkTapListResult - Response for ListVirtualNetworkTap API service call. +type VirtualNetworkTapListResult struct { + // The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // A list of VirtualNetworkTaps in a resource group. + Value []*VirtualNetworkTap `json:"value,omitempty"` +} + +// VirtualNetworkTapPropertiesFormat - Virtual Network Tap properties. +type VirtualNetworkTapPropertiesFormat struct { + // The reference to the private IP address on the internal Load Balancer that will receive the tap. + DestinationLoadBalancerFrontEndIPConfiguration *FrontendIPConfiguration `json:"destinationLoadBalancerFrontEndIPConfiguration,omitempty"` + + // The reference to the private IP Address of the collector nic that will receive the tap. + DestinationNetworkInterfaceIPConfiguration *InterfaceIPConfiguration `json:"destinationNetworkInterfaceIPConfiguration,omitempty"` + + // The VXLAN destination port that will receive the tapped traffic. + DestinationPort *int32 `json:"destinationPort,omitempty"` + + // READ-ONLY; Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. + NetworkInterfaceTapConfigurations []*InterfaceTapConfiguration `json:"networkInterfaceTapConfigurations,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual network tap resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource GUID property of the virtual network tap resource. + ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` +} + +// VirtualNetworkTapsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkTapsClient.BeginCreateOrUpdate +// method. +type VirtualNetworkTapsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkTapsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkTapsClient.BeginDelete +// method. +type VirtualNetworkTapsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkTapsClientGetOptions contains the optional parameters for the VirtualNetworkTapsClient.Get method. +type VirtualNetworkTapsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkTapsClientListAllOptions contains the optional parameters for the VirtualNetworkTapsClient.ListAll method. +type VirtualNetworkTapsClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkTapsClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworkTapsClient.ListByResourceGroup +// method. +type VirtualNetworkTapsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkTapsClientUpdateTagsOptions contains the optional parameters for the VirtualNetworkTapsClient.UpdateTags +// method. +type VirtualNetworkTapsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkUsage - Usage details for subnet. +type VirtualNetworkUsage struct { + // READ-ONLY; Indicates number of IPs used from the Subnet. + CurrentValue *float64 `json:"currentValue,omitempty" azure:"ro"` + + // READ-ONLY; Subnet identifier. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Indicates the size of the subnet. + Limit *float64 `json:"limit,omitempty" azure:"ro"` + + // READ-ONLY; The name containing common and localized value for usage. + Name *VirtualNetworkUsageName `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Usage units. Returns 'Count'. + Unit *string `json:"unit,omitempty" azure:"ro"` +} + +// VirtualNetworkUsageName - Usage strings container. +type VirtualNetworkUsageName struct { + // READ-ONLY; Localized subnet size and usage string. + LocalizedValue *string `json:"localizedValue,omitempty" azure:"ro"` + + // READ-ONLY; Subnet size and usage string. + Value *string `json:"value,omitempty" azure:"ro"` +} + +// VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +type VirtualNetworksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. +type VirtualNetworksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginListDdosProtectionStatusOptions contains the optional parameters for the VirtualNetworksClient.BeginListDdosProtectionStatus +// method. +type VirtualNetworksClientBeginListDdosProtectionStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string + // The skipToken that is given with nextLink. + SkipToken *string + // The max number of ip addresses to return. + Top *int32 +} + +// VirtualNetworksClientCheckIPAddressAvailabilityOptions contains the optional parameters for the VirtualNetworksClient.CheckIPAddressAvailability +// method. +type VirtualNetworksClientCheckIPAddressAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. +type VirtualNetworksClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// VirtualNetworksClientListAllOptions contains the optional parameters for the VirtualNetworksClient.ListAll method. +type VirtualNetworksClientListAllOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.List method. +type VirtualNetworksClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListUsageOptions contains the optional parameters for the VirtualNetworksClient.ListUsage method. +type VirtualNetworksClientListUsageOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientUpdateTagsOptions contains the optional parameters for the VirtualNetworksClient.UpdateTags method. +type VirtualNetworksClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VirtualRouter Resource. +type VirtualRouter struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the Virtual Router. + Properties *VirtualRouterPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualRouterAutoScaleConfiguration - The VirtualHub Router autoscale configuration. +type VirtualRouterAutoScaleConfiguration struct { + // The minimum number of scale units for VirtualHub Router. + MinCapacity *int32 `json:"minCapacity,omitempty"` +} + +// VirtualRouterListResult - Response for ListVirtualRouters API service call. +type VirtualRouterListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of Virtual Routers. + Value []*VirtualRouter `json:"value,omitempty"` +} + +// VirtualRouterPeering - Virtual Router Peering resource. +type VirtualRouterPeering struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Name of the virtual router peering that is unique within a virtual router. + Name *string `json:"name,omitempty"` + + // The properties of the Virtual Router Peering. + Properties *VirtualRouterPeeringProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Peering type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualRouterPeeringListResult - Response for ListVirtualRouterPeerings API service call. +type VirtualRouterPeeringListResult struct { + // URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` + + // List of VirtualRouterPeerings in a VirtualRouter. + Value []*VirtualRouterPeering `json:"value,omitempty"` +} + +// VirtualRouterPeeringProperties - Properties of the rule group. +type VirtualRouterPeeringProperties struct { + // Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + + // Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualRouterPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualRouterPeeringsClient.BeginCreateOrUpdate +// method. +type VirtualRouterPeeringsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualRouterPeeringsClientBeginDeleteOptions contains the optional parameters for the VirtualRouterPeeringsClient.BeginDelete +// method. +type VirtualRouterPeeringsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualRouterPeeringsClientGetOptions contains the optional parameters for the VirtualRouterPeeringsClient.Get method. +type VirtualRouterPeeringsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualRouterPeeringsClientListOptions contains the optional parameters for the VirtualRouterPeeringsClient.List method. +type VirtualRouterPeeringsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualRouterPropertiesFormat - Virtual Router definition. +type VirtualRouterPropertiesFormat struct { + // The Gateway on which VirtualRouter is hosted. + HostedGateway *SubResource `json:"hostedGateway,omitempty"` + + // The Subnet on which VirtualRouter is hosted. + HostedSubnet *SubResource `json:"hostedSubnet,omitempty"` + + // VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + + // VirtualRouter IPs. + VirtualRouterIPs []*string `json:"virtualRouterIps,omitempty"` + + // READ-ONLY; List of references to VirtualRouterPeerings. + Peerings []*SubResource `json:"peerings,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// VirtualRoutersClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualRoutersClient.BeginCreateOrUpdate +// method. +type VirtualRoutersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualRoutersClientBeginDeleteOptions contains the optional parameters for the VirtualRoutersClient.BeginDelete method. +type VirtualRoutersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualRoutersClientGetOptions contains the optional parameters for the VirtualRoutersClient.Get method. +type VirtualRoutersClientGetOptions struct { + // Expands referenced resources. + Expand *string +} + +// VirtualRoutersClientListByResourceGroupOptions contains the optional parameters for the VirtualRoutersClient.ListByResourceGroup +// method. +type VirtualRoutersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualRoutersClientListOptions contains the optional parameters for the VirtualRoutersClient.List method. +type VirtualRoutersClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualWAN Resource. +type VirtualWAN struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the virtual WAN. + Properties *VirtualWanProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VirtualWanProperties - Parameters for VirtualWAN. +type VirtualWanProperties struct { + // True if branch to branch traffic is allowed. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + + // True if Vnet to Vnet traffic is allowed. + AllowVnetToVnetTraffic *bool `json:"allowVnetToVnetTraffic,omitempty"` + + // Vpn encryption to be disabled or not. + DisableVPNEncryption *bool `json:"disableVpnEncryption,omitempty"` + + // The type of the VirtualWAN. + Type *string `json:"type,omitempty"` + + // READ-ONLY; The office local breakout category. + Office365LocalBreakoutCategory *OfficeTrafficCategory `json:"office365LocalBreakoutCategory,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the virtual WAN resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; List of VpnSites in the VirtualWAN. + VPNSites []*SubResource `json:"vpnSites,omitempty" azure:"ro"` + + // READ-ONLY; List of VirtualHubs in the VirtualWAN. + VirtualHubs []*SubResource `json:"virtualHubs,omitempty" azure:"ro"` +} + +// VirtualWanSecurityProvider - Collection of SecurityProviders. +type VirtualWanSecurityProvider struct { + // Name of the security provider. + Name *string `json:"name,omitempty"` + + // Url of the security provider. + URL *string `json:"url,omitempty"` + + // READ-ONLY; Name of the security provider. + Type *VirtualWanSecurityProviderType `json:"type,omitempty" azure:"ro"` +} + +// VirtualWanSecurityProviders - Collection of SecurityProviders. +type VirtualWanSecurityProviders struct { + // List of VirtualWAN security providers. + SupportedProviders []*VirtualWanSecurityProvider `json:"supportedProviders,omitempty"` +} + +// VirtualWanVPNProfileParameters - Virtual Wan Vpn profile parameters Vpn profile generation. +type VirtualWanVPNProfileParameters struct { + // VPN client authentication method. + AuthenticationMethod *AuthenticationMethod `json:"authenticationMethod,omitempty"` + + // VpnServerConfiguration partial resource uri with which VirtualWan is associated to. + VPNServerConfigurationResourceID *string `json:"vpnServerConfigurationResourceId,omitempty"` +} + +// VirtualWansClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualWansClient.BeginCreateOrUpdate +// method. +type VirtualWansClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualWansClientBeginDeleteOptions contains the optional parameters for the VirtualWansClient.BeginDelete method. +type VirtualWansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualWansClientGetOptions contains the optional parameters for the VirtualWansClient.Get method. +type VirtualWansClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualWansClientListByResourceGroupOptions contains the optional parameters for the VirtualWansClient.ListByResourceGroup +// method. +type VirtualWansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualWansClientListOptions contains the optional parameters for the VirtualWansClient.List method. +type VirtualWansClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualWansClientUpdateTagsOptions contains the optional parameters for the VirtualWansClient.UpdateTags method. +type VirtualWansClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// VnetRoute - List of routes that control routing from VirtualHub into a virtual network connection. +type VnetRoute struct { + // List of all Static Routes. + StaticRoutes []*StaticRoute `json:"staticRoutes,omitempty"` + + // Configuration for static routes on this HubVnetConnection. + StaticRoutesConfig *StaticRoutesConfig `json:"staticRoutesConfig,omitempty"` + + // READ-ONLY; The list of references to HubBgpConnection objects. + BgpConnections []*SubResource `json:"bgpConnections,omitempty" azure:"ro"` +} + +// VngClientConnectionConfiguration - A vpn client connection configuration for client connection configuration. +type VngClientConnectionConfiguration struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // 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"` + + // Properties of the vpn client root certificate. + Properties *VngClientConnectionConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// VngClientConnectionConfigurationProperties - Properties of VngClientConnectionConfiguration. +type VngClientConnectionConfigurationProperties struct { + // REQUIRED; The reference to the address space resource which represents Address space for P2S VpnClient. + VPNClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + + // REQUIRED; List of references to virtualNetworkGatewayPolicyGroups + VirtualNetworkGatewayPolicyGroups []*SubResource `json:"virtualNetworkGatewayPolicyGroups,omitempty"` + + // READ-ONLY; The provisioning state of the VngClientConnectionConfiguration resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// Watcher - Network watcher in a resource group. +type Watcher struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the network watcher. + Properties *WatcherPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// WatcherListResult - Response for ListNetworkWatchers API service call. +type WatcherListResult struct { + // List of network watcher resources. + Value []*Watcher `json:"value,omitempty"` +} + +// WatcherPropertiesFormat - The network watcher properties. +type WatcherPropertiesFormat struct { + // READ-ONLY; The provisioning state of the network watcher resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// WatchersClientBeginCheckConnectivityOptions contains the optional parameters for the WatchersClient.BeginCheckConnectivity +// method. +type WatchersClientBeginCheckConnectivityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginDeleteOptions contains the optional parameters for the WatchersClient.BeginDelete method. +type WatchersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetAzureReachabilityReportOptions contains the optional parameters for the WatchersClient.BeginGetAzureReachabilityReport +// method. +type WatchersClientBeginGetAzureReachabilityReportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetFlowLogStatusOptions contains the optional parameters for the WatchersClient.BeginGetFlowLogStatus +// method. +type WatchersClientBeginGetFlowLogStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetNetworkConfigurationDiagnosticOptions contains the optional parameters for the WatchersClient.BeginGetNetworkConfigurationDiagnostic +// method. +type WatchersClientBeginGetNetworkConfigurationDiagnosticOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetNextHopOptions contains the optional parameters for the WatchersClient.BeginGetNextHop method. +type WatchersClientBeginGetNextHopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetTroubleshootingOptions contains the optional parameters for the WatchersClient.BeginGetTroubleshooting +// method. +type WatchersClientBeginGetTroubleshootingOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetTroubleshootingResultOptions contains the optional parameters for the WatchersClient.BeginGetTroubleshootingResult +// method. +type WatchersClientBeginGetTroubleshootingResultOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginGetVMSecurityRulesOptions contains the optional parameters for the WatchersClient.BeginGetVMSecurityRules +// method. +type WatchersClientBeginGetVMSecurityRulesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginListAvailableProvidersOptions contains the optional parameters for the WatchersClient.BeginListAvailableProviders +// method. +type WatchersClientBeginListAvailableProvidersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginSetFlowLogConfigurationOptions contains the optional parameters for the WatchersClient.BeginSetFlowLogConfiguration +// method. +type WatchersClientBeginSetFlowLogConfigurationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientBeginVerifyIPFlowOptions contains the optional parameters for the WatchersClient.BeginVerifyIPFlow method. +type WatchersClientBeginVerifyIPFlowOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WatchersClientCreateOrUpdateOptions contains the optional parameters for the WatchersClient.CreateOrUpdate method. +type WatchersClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientGetOptions contains the optional parameters for the WatchersClient.Get method. +type WatchersClientGetOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientGetTopologyOptions contains the optional parameters for the WatchersClient.GetTopology method. +type WatchersClientGetTopologyOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientListAllOptions contains the optional parameters for the WatchersClient.ListAll method. +type WatchersClientListAllOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientListOptions contains the optional parameters for the WatchersClient.List method. +type WatchersClientListOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientUpdateTagsOptions contains the optional parameters for the WatchersClient.UpdateTags method. +type WatchersClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallCustomRule - Defines contents of a web application rule. +type WebApplicationFirewallCustomRule struct { + // REQUIRED; Type of Actions. + Action *WebApplicationFirewallAction `json:"action,omitempty"` + + // REQUIRED; List of match conditions. + MatchConditions []*MatchCondition `json:"matchConditions,omitempty"` + + // REQUIRED; Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. + Priority *int32 `json:"priority,omitempty"` + + // REQUIRED; The rule type. + RuleType *WebApplicationFirewallRuleType `json:"ruleType,omitempty"` + + // The name of the resource that is unique within a policy. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// WebApplicationFirewallPoliciesClientBeginDeleteOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.BeginDelete +// method. +type WebApplicationFirewallPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WebApplicationFirewallPoliciesClientCreateOrUpdateOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.CreateOrUpdate +// method. +type WebApplicationFirewallPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallPoliciesClientGetOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.Get +// method. +type WebApplicationFirewallPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallPoliciesClientListAllOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.ListAll +// method. +type WebApplicationFirewallPoliciesClientListAllOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallPoliciesClientListOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.List +// method. +type WebApplicationFirewallPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// WebApplicationFirewallPolicy - Defines web application firewall policy. +type WebApplicationFirewallPolicy struct { + // Resource ID. + ID *string `json:"id,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Properties of the web application firewall policy. + Properties *WebApplicationFirewallPolicyPropertiesFormat `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// WebApplicationFirewallPolicyListResult - Result of the request to list WebApplicationFirewallPolicies. It contains a list +// of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. +type WebApplicationFirewallPolicyListResult struct { + // READ-ONLY; URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. + Value []*WebApplicationFirewallPolicy `json:"value,omitempty" azure:"ro"` +} + +// WebApplicationFirewallPolicyPropertiesFormat - Defines web application firewall policy properties. +type WebApplicationFirewallPolicyPropertiesFormat struct { + // REQUIRED; Describes the managedRules structure. + ManagedRules *ManagedRulesDefinition `json:"managedRules,omitempty"` + + // The custom rules inside the policy. + CustomRules []*WebApplicationFirewallCustomRule `json:"customRules,omitempty"` + + // The PolicySettings for policy. + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + + // READ-ONLY; A collection of references to application gateways. + ApplicationGateways []*ApplicationGateway `json:"applicationGateways,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to application gateway http listeners. + HTTPListeners []*SubResource `json:"httpListeners,omitempty" azure:"ro"` + + // READ-ONLY; A collection of references to application gateway path rules. + PathBasedRules []*SubResource `json:"pathBasedRules,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the web application firewall policy resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Resource status of the policy. + ResourceState *WebApplicationFirewallPolicyResourceState `json:"resourceState,omitempty" azure:"ro"` +} + +// WebCategoriesClientGetOptions contains the optional parameters for the WebCategoriesClient.Get method. +type WebCategoriesClientGetOptions struct { + // Expands resourceIds back referenced by the azureWebCategory resource. + Expand *string +} + +// WebCategoriesClientListBySubscriptionOptions contains the optional parameters for the WebCategoriesClient.ListBySubscription +// method. +type WebCategoriesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models_serde.go new file mode 100644 index 000000000..914bcc20a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/models_serde.go @@ -0,0 +1,33556 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AADAuthenticationParameters. +func (a AADAuthenticationParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadAudience", a.AADAudience) + populate(objectMap, "aadIssuer", a.AADIssuer) + populate(objectMap, "aadTenant", a.AADTenant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADAuthenticationParameters. +func (a *AADAuthenticationParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadAudience": + err = unpopulate(val, "AADAudience", &a.AADAudience) + delete(rawMsg, key) + case "aadIssuer": + err = unpopulate(val, "AADIssuer", &a.AADIssuer) + delete(rawMsg, key) + case "aadTenant": + err = unpopulate(val, "AADTenant", &a.AADTenant) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Action. +func (a Action) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "parameters", a.Parameters) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Action. +func (a *Action) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "parameters": + err = unpopulate(val, "Parameters", &a.Parameters) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveBaseSecurityAdminRule. +func (a ActiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "commitTime", a.CommitTime) + populate(objectMap, "configurationDescription", a.ConfigurationDescription) + populate(objectMap, "id", a.ID) + objectMap["kind"] = a.Kind + populate(objectMap, "region", a.Region) + populate(objectMap, "ruleCollectionAppliesToGroups", a.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", a.RuleCollectionDescription) + populate(objectMap, "ruleGroups", a.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveBaseSecurityAdminRule. +func (a *ActiveBaseSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitTime": + err = unpopulateTimeRFC3339(val, "CommitTime", &a.CommitTime) + delete(rawMsg, key) + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &a.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &a.Region) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &a.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &a.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &a.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveConfigurationParameter. +func (a ActiveConfigurationParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "regions", a.Regions) + populate(objectMap, "skipToken", a.SkipToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConfigurationParameter. +func (a *ActiveConfigurationParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "regions": + err = unpopulate(val, "Regions", &a.Regions) + delete(rawMsg, key) + case "skipToken": + err = unpopulate(val, "SkipToken", &a.SkipToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveConnectivityConfiguration. +func (a ActiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "commitTime", a.CommitTime) + populate(objectMap, "configurationGroups", a.ConfigurationGroups) + populate(objectMap, "id", a.ID) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "region", a.Region) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConnectivityConfiguration. +func (a *ActiveConnectivityConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitTime": + err = unpopulateTimeRFC3339(val, "CommitTime", &a.CommitTime) + delete(rawMsg, key) + case "configurationGroups": + err = unpopulate(val, "ConfigurationGroups", &a.ConfigurationGroups) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &a.Region) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveConnectivityConfigurationsListResult. +func (a ActiveConnectivityConfigurationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", a.SkipToken) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConnectivityConfigurationsListResult. +func (a *ActiveConnectivityConfigurationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &a.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveDefaultSecurityAdminRule. +func (a ActiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "commitTime", a.CommitTime) + populate(objectMap, "configurationDescription", a.ConfigurationDescription) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EffectiveAdminRuleKindDefault + populate(objectMap, "properties", a.Properties) + populate(objectMap, "region", a.Region) + populate(objectMap, "ruleCollectionAppliesToGroups", a.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", a.RuleCollectionDescription) + populate(objectMap, "ruleGroups", a.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDefaultSecurityAdminRule. +func (a *ActiveDefaultSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitTime": + err = unpopulateTimeRFC3339(val, "CommitTime", &a.CommitTime) + delete(rawMsg, key) + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &a.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &a.Region) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &a.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &a.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &a.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveSecurityAdminRule. +func (a ActiveSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "commitTime", a.CommitTime) + populate(objectMap, "configurationDescription", a.ConfigurationDescription) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EffectiveAdminRuleKindCustom + populate(objectMap, "properties", a.Properties) + populate(objectMap, "region", a.Region) + populate(objectMap, "ruleCollectionAppliesToGroups", a.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", a.RuleCollectionDescription) + populate(objectMap, "ruleGroups", a.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveSecurityAdminRule. +func (a *ActiveSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitTime": + err = unpopulateTimeRFC3339(val, "CommitTime", &a.CommitTime) + delete(rawMsg, key) + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &a.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &a.Region) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &a.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &a.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &a.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActiveSecurityAdminRulesListResult. +func (a ActiveSecurityAdminRulesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", a.SkipToken) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveSecurityAdminRulesListResult. +func (a *ActiveSecurityAdminRulesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &a.SkipToken) + delete(rawMsg, key) + case "value": + a.Value, err = unmarshalActiveBaseSecurityAdminRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressPrefixItem. +func (a AddressPrefixItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", a.AddressPrefix) + populate(objectMap, "addressPrefixType", a.AddressPrefixType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressPrefixItem. +func (a *AddressPrefixItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &a.AddressPrefix) + delete(rawMsg, key) + case "addressPrefixType": + err = unpopulate(val, "AddressPrefixType", &a.AddressPrefixType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AddressSpace. +func (a AddressSpace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefixes", a.AddressPrefixes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressSpace. +func (a *AddressSpace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &a.AddressPrefixes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminPropertiesFormat. +func (a AdminPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", a.Access) + populate(objectMap, "description", a.Description) + populate(objectMap, "destinationPortRanges", a.DestinationPortRanges) + populate(objectMap, "destinations", a.Destinations) + populate(objectMap, "direction", a.Direction) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "sourcePortRanges", a.SourcePortRanges) + populate(objectMap, "sources", a.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminPropertiesFormat. +func (a *AdminPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &a.Access) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &a.DestinationPortRanges) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &a.Destinations) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &a.Direction) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &a.SourcePortRanges) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &a.Sources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRule. +func (a AdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = AdminRuleKindCustom + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRule. +func (a *AdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRuleCollection. +func (a AdminRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRuleCollection. +func (a *AdminRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRuleCollectionListResult. +func (a AdminRuleCollectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRuleCollectionListResult. +func (a *AdminRuleCollectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRuleCollectionPropertiesFormat. +func (a AdminRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliesToGroups", a.AppliesToGroups) + populate(objectMap, "description", a.Description) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRuleCollectionPropertiesFormat. +func (a *AdminRuleCollectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliesToGroups": + err = unpopulate(val, "AppliesToGroups", &a.AppliesToGroups) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdminRuleListResult. +func (a AdminRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRuleListResult. +func (a *AdminRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + a.Value, err = unmarshalBaseAdminRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGateway. +func (a ApplicationGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + populate(objectMap, "zones", a.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGateway. +func (a *ApplicationGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &a.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAuthenticationCertificate. +func (a ApplicationGatewayAuthenticationCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAuthenticationCertificate. +func (a *ApplicationGatewayAuthenticationCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAuthenticationCertificatePropertiesFormat. +func (a ApplicationGatewayAuthenticationCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", a.Data) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAuthenticationCertificatePropertiesFormat. +func (a *ApplicationGatewayAuthenticationCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &a.Data) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAutoscaleConfiguration. +func (a ApplicationGatewayAutoscaleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxCapacity", a.MaxCapacity) + populate(objectMap, "minCapacity", a.MinCapacity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAutoscaleConfiguration. +func (a *ApplicationGatewayAutoscaleConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxCapacity": + err = unpopulate(val, "MaxCapacity", &a.MaxCapacity) + delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &a.MinCapacity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAvailableSSLOptions. +func (a ApplicationGatewayAvailableSSLOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAvailableSSLOptions. +func (a *ApplicationGatewayAvailableSSLOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAvailableSSLOptionsPropertiesFormat. +func (a ApplicationGatewayAvailableSSLOptionsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availableCipherSuites", a.AvailableCipherSuites) + populate(objectMap, "availableProtocols", a.AvailableProtocols) + populate(objectMap, "defaultPolicy", a.DefaultPolicy) + populate(objectMap, "predefinedPolicies", a.PredefinedPolicies) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAvailableSSLOptionsPropertiesFormat. +func (a *ApplicationGatewayAvailableSSLOptionsPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableCipherSuites": + err = unpopulate(val, "AvailableCipherSuites", &a.AvailableCipherSuites) + delete(rawMsg, key) + case "availableProtocols": + err = unpopulate(val, "AvailableProtocols", &a.AvailableProtocols) + delete(rawMsg, key) + case "defaultPolicy": + err = unpopulate(val, "DefaultPolicy", &a.DefaultPolicy) + delete(rawMsg, key) + case "predefinedPolicies": + err = unpopulate(val, "PredefinedPolicies", &a.PredefinedPolicies) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAvailableSSLPredefinedPolicies. +func (a ApplicationGatewayAvailableSSLPredefinedPolicies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAvailableSSLPredefinedPolicies. +func (a *ApplicationGatewayAvailableSSLPredefinedPolicies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayAvailableWafRuleSetsResult. +func (a ApplicationGatewayAvailableWafRuleSetsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayAvailableWafRuleSetsResult. +func (a *ApplicationGatewayAvailableWafRuleSetsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendAddress. +func (a ApplicationGatewayBackendAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdn", a.Fqdn) + populate(objectMap, "ipAddress", a.IPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendAddress. +func (a *ApplicationGatewayBackendAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &a.Fqdn) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &a.IPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendAddressPool. +func (a ApplicationGatewayBackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendAddressPool. +func (a *ApplicationGatewayBackendAddressPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendAddressPoolPropertiesFormat. +func (a ApplicationGatewayBackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddresses", a.BackendAddresses) + populate(objectMap, "backendIPConfigurations", a.BackendIPConfigurations) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendAddressPoolPropertiesFormat. +func (a *ApplicationGatewayBackendAddressPoolPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddresses": + err = unpopulate(val, "BackendAddresses", &a.BackendAddresses) + delete(rawMsg, key) + case "backendIPConfigurations": + err = unpopulate(val, "BackendIPConfigurations", &a.BackendIPConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHTTPSettings. +func (a ApplicationGatewayBackendHTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHTTPSettings. +func (a *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHTTPSettingsPropertiesFormat. +func (a ApplicationGatewayBackendHTTPSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "affinityCookieName", a.AffinityCookieName) + populate(objectMap, "authenticationCertificates", a.AuthenticationCertificates) + populate(objectMap, "connectionDraining", a.ConnectionDraining) + populate(objectMap, "cookieBasedAffinity", a.CookieBasedAffinity) + populate(objectMap, "hostName", a.HostName) + populate(objectMap, "path", a.Path) + populate(objectMap, "pickHostNameFromBackendAddress", a.PickHostNameFromBackendAddress) + populate(objectMap, "port", a.Port) + populate(objectMap, "probe", a.Probe) + populate(objectMap, "probeEnabled", a.ProbeEnabled) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "requestTimeout", a.RequestTimeout) + populate(objectMap, "trustedRootCertificates", a.TrustedRootCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHTTPSettingsPropertiesFormat. +func (a *ApplicationGatewayBackendHTTPSettingsPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affinityCookieName": + err = unpopulate(val, "AffinityCookieName", &a.AffinityCookieName) + delete(rawMsg, key) + case "authenticationCertificates": + err = unpopulate(val, "AuthenticationCertificates", &a.AuthenticationCertificates) + delete(rawMsg, key) + case "connectionDraining": + err = unpopulate(val, "ConnectionDraining", &a.ConnectionDraining) + delete(rawMsg, key) + case "cookieBasedAffinity": + err = unpopulate(val, "CookieBasedAffinity", &a.CookieBasedAffinity) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &a.HostName) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &a.Path) + delete(rawMsg, key) + case "pickHostNameFromBackendAddress": + err = unpopulate(val, "PickHostNameFromBackendAddress", &a.PickHostNameFromBackendAddress) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "probe": + err = unpopulate(val, "Probe", &a.Probe) + delete(rawMsg, key) + case "probeEnabled": + err = unpopulate(val, "ProbeEnabled", &a.ProbeEnabled) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "requestTimeout": + err = unpopulate(val, "RequestTimeout", &a.RequestTimeout) + delete(rawMsg, key) + case "trustedRootCertificates": + err = unpopulate(val, "TrustedRootCertificates", &a.TrustedRootCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHealth. +func (a ApplicationGatewayBackendHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPools", a.BackendAddressPools) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHealth. +func (a *ApplicationGatewayBackendHealth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPools": + err = unpopulate(val, "BackendAddressPools", &a.BackendAddressPools) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHealthHTTPSettings. +func (a ApplicationGatewayBackendHealthHTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendHttpSettings", a.BackendHTTPSettings) + populate(objectMap, "servers", a.Servers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHealthHTTPSettings. +func (a *ApplicationGatewayBackendHealthHTTPSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendHttpSettings": + err = unpopulate(val, "BackendHTTPSettings", &a.BackendHTTPSettings) + delete(rawMsg, key) + case "servers": + err = unpopulate(val, "Servers", &a.Servers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHealthOnDemand. +func (a ApplicationGatewayBackendHealthOnDemand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendHealthHttpSettings", a.BackendHealthHTTPSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHealthOnDemand. +func (a *ApplicationGatewayBackendHealthOnDemand) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendHealthHttpSettings": + err = unpopulate(val, "BackendHealthHTTPSettings", &a.BackendHealthHTTPSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHealthPool. +func (a ApplicationGatewayBackendHealthPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendHttpSettingsCollection", a.BackendHTTPSettingsCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHealthPool. +func (a *ApplicationGatewayBackendHealthPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendHttpSettingsCollection": + err = unpopulate(val, "BackendHTTPSettingsCollection", &a.BackendHTTPSettingsCollection) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendHealthServer. +func (a ApplicationGatewayBackendHealthServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", a.Address) + populate(objectMap, "health", a.Health) + populate(objectMap, "healthProbeLog", a.HealthProbeLog) + populate(objectMap, "ipConfiguration", a.IPConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendHealthServer. +func (a *ApplicationGatewayBackendHealthServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &a.Address) + delete(rawMsg, key) + case "health": + err = unpopulate(val, "Health", &a.Health) + delete(rawMsg, key) + case "healthProbeLog": + err = unpopulate(val, "HealthProbeLog", &a.HealthProbeLog) + delete(rawMsg, key) + case "ipConfiguration": + err = unpopulate(val, "IPConfiguration", &a.IPConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendSettings. +func (a ApplicationGatewayBackendSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendSettings. +func (a *ApplicationGatewayBackendSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayBackendSettingsPropertiesFormat. +func (a ApplicationGatewayBackendSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostName", a.HostName) + populate(objectMap, "pickHostNameFromBackendAddress", a.PickHostNameFromBackendAddress) + populate(objectMap, "port", a.Port) + populate(objectMap, "probe", a.Probe) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "timeout", a.Timeout) + populate(objectMap, "trustedRootCertificates", a.TrustedRootCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayBackendSettingsPropertiesFormat. +func (a *ApplicationGatewayBackendSettingsPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostName": + err = unpopulate(val, "HostName", &a.HostName) + delete(rawMsg, key) + case "pickHostNameFromBackendAddress": + err = unpopulate(val, "PickHostNameFromBackendAddress", &a.PickHostNameFromBackendAddress) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "probe": + err = unpopulate(val, "Probe", &a.Probe) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &a.Timeout) + delete(rawMsg, key) + case "trustedRootCertificates": + err = unpopulate(val, "TrustedRootCertificates", &a.TrustedRootCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayClientAuthConfiguration. +func (a ApplicationGatewayClientAuthConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "verifyClientCertIssuerDN", a.VerifyClientCertIssuerDN) + populate(objectMap, "verifyClientRevocation", a.VerifyClientRevocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayClientAuthConfiguration. +func (a *ApplicationGatewayClientAuthConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "verifyClientCertIssuerDN": + err = unpopulate(val, "VerifyClientCertIssuerDN", &a.VerifyClientCertIssuerDN) + delete(rawMsg, key) + case "verifyClientRevocation": + err = unpopulate(val, "VerifyClientRevocation", &a.VerifyClientRevocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayConnectionDraining. +func (a ApplicationGatewayConnectionDraining) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "drainTimeoutInSec", a.DrainTimeoutInSec) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayConnectionDraining. +func (a *ApplicationGatewayConnectionDraining) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "drainTimeoutInSec": + err = unpopulate(val, "DrainTimeoutInSec", &a.DrainTimeoutInSec) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayCustomError. +func (a ApplicationGatewayCustomError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customErrorPageUrl", a.CustomErrorPageURL) + populate(objectMap, "statusCode", a.StatusCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayCustomError. +func (a *ApplicationGatewayCustomError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customErrorPageUrl": + err = unpopulate(val, "CustomErrorPageURL", &a.CustomErrorPageURL) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &a.StatusCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallDisabledRuleGroup. +func (a ApplicationGatewayFirewallDisabledRuleGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroupName", a.RuleGroupName) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallDisabledRuleGroup. +func (a *ApplicationGatewayFirewallDisabledRuleGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &a.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallExclusion. +func (a ApplicationGatewayFirewallExclusion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchVariable", a.MatchVariable) + populate(objectMap, "selector", a.Selector) + populate(objectMap, "selectorMatchOperator", a.SelectorMatchOperator) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallExclusion. +func (a *ApplicationGatewayFirewallExclusion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "matchVariable": + err = unpopulate(val, "MatchVariable", &a.MatchVariable) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &a.Selector) + delete(rawMsg, key) + case "selectorMatchOperator": + err = unpopulate(val, "SelectorMatchOperator", &a.SelectorMatchOperator) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallManifestRuleSet. +func (a ApplicationGatewayFirewallManifestRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroups", a.RuleGroups) + populate(objectMap, "ruleSetType", a.RuleSetType) + populate(objectMap, "ruleSetVersion", a.RuleSetVersion) + populate(objectMap, "status", a.Status) + populate(objectMap, "tiers", a.Tiers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallManifestRuleSet. +func (a *ApplicationGatewayFirewallManifestRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &a.RuleGroups) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &a.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &a.RuleSetVersion) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "tiers": + err = unpopulate(val, "Tiers", &a.Tiers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallRule. +func (a ApplicationGatewayFirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", a.Action) + populate(objectMap, "description", a.Description) + populate(objectMap, "ruleId", a.RuleID) + populate(objectMap, "ruleIdString", a.RuleIDString) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallRule. +func (a *ApplicationGatewayFirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &a.RuleID) + delete(rawMsg, key) + case "ruleIdString": + err = unpopulate(val, "RuleIDString", &a.RuleIDString) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallRuleGroup. +func (a ApplicationGatewayFirewallRuleGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "ruleGroupName", a.RuleGroupName) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallRuleGroup. +func (a *ApplicationGatewayFirewallRuleGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &a.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallRuleSet. +func (a ApplicationGatewayFirewallRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallRuleSet. +func (a *ApplicationGatewayFirewallRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFirewallRuleSetPropertiesFormat. +func (a ApplicationGatewayFirewallRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "ruleGroups", a.RuleGroups) + populate(objectMap, "ruleSetType", a.RuleSetType) + populate(objectMap, "ruleSetVersion", a.RuleSetVersion) + populate(objectMap, "tiers", a.Tiers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFirewallRuleSetPropertiesFormat. +func (a *ApplicationGatewayFirewallRuleSetPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &a.RuleGroups) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &a.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &a.RuleSetVersion) + delete(rawMsg, key) + case "tiers": + err = unpopulate(val, "Tiers", &a.Tiers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFrontendIPConfiguration. +func (a ApplicationGatewayFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFrontendIPConfiguration. +func (a *ApplicationGatewayFrontendIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFrontendIPConfigurationPropertiesFormat. +func (a ApplicationGatewayFrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", a.PrivateIPAddress) + populate(objectMap, "privateIPAllocationMethod", a.PrivateIPAllocationMethod) + populate(objectMap, "privateLinkConfiguration", a.PrivateLinkConfiguration) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicIPAddress", a.PublicIPAddress) + populate(objectMap, "subnet", a.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFrontendIPConfigurationPropertiesFormat. +func (a *ApplicationGatewayFrontendIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &a.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &a.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "privateLinkConfiguration": + err = unpopulate(val, "PrivateLinkConfiguration", &a.PrivateLinkConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &a.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &a.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFrontendPort. +func (a ApplicationGatewayFrontendPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFrontendPort. +func (a *ApplicationGatewayFrontendPort) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayFrontendPortPropertiesFormat. +func (a ApplicationGatewayFrontendPortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", a.Port) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayFrontendPortPropertiesFormat. +func (a *ApplicationGatewayFrontendPortPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayGlobalConfiguration. +func (a ApplicationGatewayGlobalConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableRequestBuffering", a.EnableRequestBuffering) + populate(objectMap, "enableResponseBuffering", a.EnableResponseBuffering) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayGlobalConfiguration. +func (a *ApplicationGatewayGlobalConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableRequestBuffering": + err = unpopulate(val, "EnableRequestBuffering", &a.EnableRequestBuffering) + delete(rawMsg, key) + case "enableResponseBuffering": + err = unpopulate(val, "EnableResponseBuffering", &a.EnableResponseBuffering) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayHTTPListener. +func (a ApplicationGatewayHTTPListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayHTTPListener. +func (a *ApplicationGatewayHTTPListener) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayHTTPListenerPropertiesFormat. +func (a ApplicationGatewayHTTPListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customErrorConfigurations", a.CustomErrorConfigurations) + populate(objectMap, "firewallPolicy", a.FirewallPolicy) + populate(objectMap, "frontendIPConfiguration", a.FrontendIPConfiguration) + populate(objectMap, "frontendPort", a.FrontendPort) + populate(objectMap, "hostName", a.HostName) + populate(objectMap, "hostNames", a.HostNames) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "requireServerNameIndication", a.RequireServerNameIndication) + populate(objectMap, "sslCertificate", a.SSLCertificate) + populate(objectMap, "sslProfile", a.SSLProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayHTTPListenerPropertiesFormat. +func (a *ApplicationGatewayHTTPListenerPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customErrorConfigurations": + err = unpopulate(val, "CustomErrorConfigurations", &a.CustomErrorConfigurations) + delete(rawMsg, key) + case "firewallPolicy": + err = unpopulate(val, "FirewallPolicy", &a.FirewallPolicy) + delete(rawMsg, key) + case "frontendIPConfiguration": + err = unpopulate(val, "FrontendIPConfiguration", &a.FrontendIPConfiguration) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &a.FrontendPort) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &a.HostName) + delete(rawMsg, key) + case "hostNames": + err = unpopulate(val, "HostNames", &a.HostNames) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "requireServerNameIndication": + err = unpopulate(val, "RequireServerNameIndication", &a.RequireServerNameIndication) + delete(rawMsg, key) + case "sslCertificate": + err = unpopulate(val, "SSLCertificate", &a.SSLCertificate) + delete(rawMsg, key) + case "sslProfile": + err = unpopulate(val, "SSLProfile", &a.SSLProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayHeaderConfiguration. +func (a ApplicationGatewayHeaderConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "headerName", a.HeaderName) + populate(objectMap, "headerValue", a.HeaderValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayHeaderConfiguration. +func (a *ApplicationGatewayHeaderConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "headerName": + err = unpopulate(val, "HeaderName", &a.HeaderName) + delete(rawMsg, key) + case "headerValue": + err = unpopulate(val, "HeaderValue", &a.HeaderValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayIPConfiguration. +func (a ApplicationGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayIPConfiguration. +func (a *ApplicationGatewayIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayIPConfigurationPropertiesFormat. +func (a ApplicationGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "subnet", a.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayIPConfigurationPropertiesFormat. +func (a *ApplicationGatewayIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &a.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayListResult. +func (a ApplicationGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayListResult. +func (a *ApplicationGatewayListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayListener. +func (a ApplicationGatewayListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayListener. +func (a *ApplicationGatewayListener) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayListenerPropertiesFormat. +func (a ApplicationGatewayListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "frontendIPConfiguration", a.FrontendIPConfiguration) + populate(objectMap, "frontendPort", a.FrontendPort) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "sslCertificate", a.SSLCertificate) + populate(objectMap, "sslProfile", a.SSLProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayListenerPropertiesFormat. +func (a *ApplicationGatewayListenerPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frontendIPConfiguration": + err = unpopulate(val, "FrontendIPConfiguration", &a.FrontendIPConfiguration) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &a.FrontendPort) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "sslCertificate": + err = unpopulate(val, "SSLCertificate", &a.SSLCertificate) + delete(rawMsg, key) + case "sslProfile": + err = unpopulate(val, "SSLProfile", &a.SSLProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayLoadDistributionPolicy. +func (a ApplicationGatewayLoadDistributionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayLoadDistributionPolicy. +func (a *ApplicationGatewayLoadDistributionPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayLoadDistributionPolicyPropertiesFormat. +func (a ApplicationGatewayLoadDistributionPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loadDistributionAlgorithm", a.LoadDistributionAlgorithm) + populate(objectMap, "loadDistributionTargets", a.LoadDistributionTargets) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayLoadDistributionPolicyPropertiesFormat. +func (a *ApplicationGatewayLoadDistributionPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "loadDistributionAlgorithm": + err = unpopulate(val, "LoadDistributionAlgorithm", &a.LoadDistributionAlgorithm) + delete(rawMsg, key) + case "loadDistributionTargets": + err = unpopulate(val, "LoadDistributionTargets", &a.LoadDistributionTargets) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayLoadDistributionTarget. +func (a ApplicationGatewayLoadDistributionTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayLoadDistributionTarget. +func (a *ApplicationGatewayLoadDistributionTarget) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayLoadDistributionTargetPropertiesFormat. +func (a ApplicationGatewayLoadDistributionTargetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "weightPerServer", a.WeightPerServer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayLoadDistributionTargetPropertiesFormat. +func (a *ApplicationGatewayLoadDistributionTargetPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "weightPerServer": + err = unpopulate(val, "WeightPerServer", &a.WeightPerServer) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayOnDemandProbe. +func (a ApplicationGatewayOnDemandProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendHttpSettings", a.BackendHTTPSettings) + populate(objectMap, "host", a.Host) + populate(objectMap, "match", a.Match) + populate(objectMap, "path", a.Path) + populate(objectMap, "pickHostNameFromBackendHttpSettings", a.PickHostNameFromBackendHTTPSettings) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "timeout", a.Timeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayOnDemandProbe. +func (a *ApplicationGatewayOnDemandProbe) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendHttpSettings": + err = unpopulate(val, "BackendHTTPSettings", &a.BackendHTTPSettings) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &a.Host) + delete(rawMsg, key) + case "match": + err = unpopulate(val, "Match", &a.Match) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &a.Path) + delete(rawMsg, key) + case "pickHostNameFromBackendHttpSettings": + err = unpopulate(val, "PickHostNameFromBackendHTTPSettings", &a.PickHostNameFromBackendHTTPSettings) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &a.Timeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPathRule. +func (a ApplicationGatewayPathRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPathRule. +func (a *ApplicationGatewayPathRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPathRulePropertiesFormat. +func (a ApplicationGatewayPathRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendHttpSettings", a.BackendHTTPSettings) + populate(objectMap, "firewallPolicy", a.FirewallPolicy) + populate(objectMap, "loadDistributionPolicy", a.LoadDistributionPolicy) + populate(objectMap, "paths", a.Paths) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "redirectConfiguration", a.RedirectConfiguration) + populate(objectMap, "rewriteRuleSet", a.RewriteRuleSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPathRulePropertiesFormat. +func (a *ApplicationGatewayPathRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendHttpSettings": + err = unpopulate(val, "BackendHTTPSettings", &a.BackendHTTPSettings) + delete(rawMsg, key) + case "firewallPolicy": + err = unpopulate(val, "FirewallPolicy", &a.FirewallPolicy) + delete(rawMsg, key) + case "loadDistributionPolicy": + err = unpopulate(val, "LoadDistributionPolicy", &a.LoadDistributionPolicy) + delete(rawMsg, key) + case "paths": + err = unpopulate(val, "Paths", &a.Paths) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "redirectConfiguration": + err = unpopulate(val, "RedirectConfiguration", &a.RedirectConfiguration) + delete(rawMsg, key) + case "rewriteRuleSet": + err = unpopulate(val, "RewriteRuleSet", &a.RewriteRuleSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateEndpointConnection. +func (a ApplicationGatewayPrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateEndpointConnection. +func (a *ApplicationGatewayPrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateEndpointConnectionListResult. +func (a ApplicationGatewayPrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateEndpointConnectionListResult. +func (a *ApplicationGatewayPrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateEndpointConnectionProperties. +func (a ApplicationGatewayPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkIdentifier", a.LinkIdentifier) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", a.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateEndpointConnectionProperties. +func (a *ApplicationGatewayPrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &a.LinkIdentifier) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &a.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkConfiguration. +func (a ApplicationGatewayPrivateLinkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkConfiguration. +func (a *ApplicationGatewayPrivateLinkConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkConfigurationProperties. +func (a ApplicationGatewayPrivateLinkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipConfigurations", a.IPConfigurations) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkConfigurationProperties. +func (a *ApplicationGatewayPrivateLinkConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &a.IPConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkIPConfiguration. +func (a ApplicationGatewayPrivateLinkIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkIPConfiguration. +func (a *ApplicationGatewayPrivateLinkIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkIPConfigurationProperties. +func (a ApplicationGatewayPrivateLinkIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "primary", a.Primary) + populate(objectMap, "privateIPAddress", a.PrivateIPAddress) + populate(objectMap, "privateIPAllocationMethod", a.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "subnet", a.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkIPConfigurationProperties. +func (a *ApplicationGatewayPrivateLinkIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primary": + err = unpopulate(val, "Primary", &a.Primary) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &a.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &a.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &a.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkResource. +func (a ApplicationGatewayPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkResource. +func (a *ApplicationGatewayPrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkResourceListResult. +func (a ApplicationGatewayPrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkResourceListResult. +func (a *ApplicationGatewayPrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPrivateLinkResourceProperties. +func (a ApplicationGatewayPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", a.GroupID) + populate(objectMap, "requiredMembers", a.RequiredMembers) + populate(objectMap, "requiredZoneNames", a.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPrivateLinkResourceProperties. +func (a *ApplicationGatewayPrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &a.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &a.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &a.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayProbe. +func (a ApplicationGatewayProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayProbe. +func (a *ApplicationGatewayProbe) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayProbeHealthResponseMatch. +func (a ApplicationGatewayProbeHealthResponseMatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "body", a.Body) + populate(objectMap, "statusCodes", a.StatusCodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayProbeHealthResponseMatch. +func (a *ApplicationGatewayProbeHealthResponseMatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "body": + err = unpopulate(val, "Body", &a.Body) + delete(rawMsg, key) + case "statusCodes": + err = unpopulate(val, "StatusCodes", &a.StatusCodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayProbePropertiesFormat. +func (a ApplicationGatewayProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "host", a.Host) + populate(objectMap, "interval", a.Interval) + populate(objectMap, "match", a.Match) + populate(objectMap, "minServers", a.MinServers) + populate(objectMap, "path", a.Path) + populate(objectMap, "pickHostNameFromBackendHttpSettings", a.PickHostNameFromBackendHTTPSettings) + populate(objectMap, "pickHostNameFromBackendSettings", a.PickHostNameFromBackendSettings) + populate(objectMap, "port", a.Port) + populate(objectMap, "protocol", a.Protocol) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "timeout", a.Timeout) + populate(objectMap, "unhealthyThreshold", a.UnhealthyThreshold) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayProbePropertiesFormat. +func (a *ApplicationGatewayProbePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "host": + err = unpopulate(val, "Host", &a.Host) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &a.Interval) + delete(rawMsg, key) + case "match": + err = unpopulate(val, "Match", &a.Match) + delete(rawMsg, key) + case "minServers": + err = unpopulate(val, "MinServers", &a.MinServers) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &a.Path) + delete(rawMsg, key) + case "pickHostNameFromBackendHttpSettings": + err = unpopulate(val, "PickHostNameFromBackendHTTPSettings", &a.PickHostNameFromBackendHTTPSettings) + delete(rawMsg, key) + case "pickHostNameFromBackendSettings": + err = unpopulate(val, "PickHostNameFromBackendSettings", &a.PickHostNameFromBackendSettings) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &a.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &a.Timeout) + delete(rawMsg, key) + case "unhealthyThreshold": + err = unpopulate(val, "UnhealthyThreshold", &a.UnhealthyThreshold) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayPropertiesFormat. +func (a ApplicationGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationCertificates", a.AuthenticationCertificates) + populate(objectMap, "autoscaleConfiguration", a.AutoscaleConfiguration) + populate(objectMap, "backendAddressPools", a.BackendAddressPools) + populate(objectMap, "backendHttpSettingsCollection", a.BackendHTTPSettingsCollection) + populate(objectMap, "backendSettingsCollection", a.BackendSettingsCollection) + populate(objectMap, "customErrorConfigurations", a.CustomErrorConfigurations) + populate(objectMap, "enableFips", a.EnableFips) + populate(objectMap, "enableHttp2", a.EnableHTTP2) + populate(objectMap, "firewallPolicy", a.FirewallPolicy) + populate(objectMap, "forceFirewallPolicyAssociation", a.ForceFirewallPolicyAssociation) + populate(objectMap, "frontendIPConfigurations", a.FrontendIPConfigurations) + populate(objectMap, "frontendPorts", a.FrontendPorts) + populate(objectMap, "gatewayIPConfigurations", a.GatewayIPConfigurations) + populate(objectMap, "globalConfiguration", a.GlobalConfiguration) + populate(objectMap, "httpListeners", a.HTTPListeners) + populate(objectMap, "listeners", a.Listeners) + populate(objectMap, "loadDistributionPolicies", a.LoadDistributionPolicies) + populate(objectMap, "operationalState", a.OperationalState) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) + populate(objectMap, "privateLinkConfigurations", a.PrivateLinkConfigurations) + populate(objectMap, "probes", a.Probes) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "redirectConfigurations", a.RedirectConfigurations) + populate(objectMap, "requestRoutingRules", a.RequestRoutingRules) + populate(objectMap, "resourceGuid", a.ResourceGUID) + populate(objectMap, "rewriteRuleSets", a.RewriteRuleSets) + populate(objectMap, "routingRules", a.RoutingRules) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "sslCertificates", a.SSLCertificates) + populate(objectMap, "sslPolicy", a.SSLPolicy) + populate(objectMap, "sslProfiles", a.SSLProfiles) + populate(objectMap, "trustedClientCertificates", a.TrustedClientCertificates) + populate(objectMap, "trustedRootCertificates", a.TrustedRootCertificates) + populate(objectMap, "urlPathMaps", a.URLPathMaps) + populate(objectMap, "webApplicationFirewallConfiguration", a.WebApplicationFirewallConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayPropertiesFormat. +func (a *ApplicationGatewayPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationCertificates": + err = unpopulate(val, "AuthenticationCertificates", &a.AuthenticationCertificates) + delete(rawMsg, key) + case "autoscaleConfiguration": + err = unpopulate(val, "AutoscaleConfiguration", &a.AutoscaleConfiguration) + delete(rawMsg, key) + case "backendAddressPools": + err = unpopulate(val, "BackendAddressPools", &a.BackendAddressPools) + delete(rawMsg, key) + case "backendHttpSettingsCollection": + err = unpopulate(val, "BackendHTTPSettingsCollection", &a.BackendHTTPSettingsCollection) + delete(rawMsg, key) + case "backendSettingsCollection": + err = unpopulate(val, "BackendSettingsCollection", &a.BackendSettingsCollection) + delete(rawMsg, key) + case "customErrorConfigurations": + err = unpopulate(val, "CustomErrorConfigurations", &a.CustomErrorConfigurations) + delete(rawMsg, key) + case "enableFips": + err = unpopulate(val, "EnableFips", &a.EnableFips) + delete(rawMsg, key) + case "enableHttp2": + err = unpopulate(val, "EnableHTTP2", &a.EnableHTTP2) + delete(rawMsg, key) + case "firewallPolicy": + err = unpopulate(val, "FirewallPolicy", &a.FirewallPolicy) + delete(rawMsg, key) + case "forceFirewallPolicyAssociation": + err = unpopulate(val, "ForceFirewallPolicyAssociation", &a.ForceFirewallPolicyAssociation) + delete(rawMsg, key) + case "frontendIPConfigurations": + err = unpopulate(val, "FrontendIPConfigurations", &a.FrontendIPConfigurations) + delete(rawMsg, key) + case "frontendPorts": + err = unpopulate(val, "FrontendPorts", &a.FrontendPorts) + delete(rawMsg, key) + case "gatewayIPConfigurations": + err = unpopulate(val, "GatewayIPConfigurations", &a.GatewayIPConfigurations) + delete(rawMsg, key) + case "globalConfiguration": + err = unpopulate(val, "GlobalConfiguration", &a.GlobalConfiguration) + delete(rawMsg, key) + case "httpListeners": + err = unpopulate(val, "HTTPListeners", &a.HTTPListeners) + delete(rawMsg, key) + case "listeners": + err = unpopulate(val, "Listeners", &a.Listeners) + delete(rawMsg, key) + case "loadDistributionPolicies": + err = unpopulate(val, "LoadDistributionPolicies", &a.LoadDistributionPolicies) + delete(rawMsg, key) + case "operationalState": + err = unpopulate(val, "OperationalState", &a.OperationalState) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) + case "privateLinkConfigurations": + err = unpopulate(val, "PrivateLinkConfigurations", &a.PrivateLinkConfigurations) + delete(rawMsg, key) + case "probes": + err = unpopulate(val, "Probes", &a.Probes) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "redirectConfigurations": + err = unpopulate(val, "RedirectConfigurations", &a.RedirectConfigurations) + delete(rawMsg, key) + case "requestRoutingRules": + err = unpopulate(val, "RequestRoutingRules", &a.RequestRoutingRules) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &a.ResourceGUID) + delete(rawMsg, key) + case "rewriteRuleSets": + err = unpopulate(val, "RewriteRuleSets", &a.RewriteRuleSets) + delete(rawMsg, key) + case "routingRules": + err = unpopulate(val, "RoutingRules", &a.RoutingRules) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "sslCertificates": + err = unpopulate(val, "SSLCertificates", &a.SSLCertificates) + delete(rawMsg, key) + case "sslPolicy": + err = unpopulate(val, "SSLPolicy", &a.SSLPolicy) + delete(rawMsg, key) + case "sslProfiles": + err = unpopulate(val, "SSLProfiles", &a.SSLProfiles) + delete(rawMsg, key) + case "trustedClientCertificates": + err = unpopulate(val, "TrustedClientCertificates", &a.TrustedClientCertificates) + delete(rawMsg, key) + case "trustedRootCertificates": + err = unpopulate(val, "TrustedRootCertificates", &a.TrustedRootCertificates) + delete(rawMsg, key) + case "urlPathMaps": + err = unpopulate(val, "URLPathMaps", &a.URLPathMaps) + delete(rawMsg, key) + case "webApplicationFirewallConfiguration": + err = unpopulate(val, "WebApplicationFirewallConfiguration", &a.WebApplicationFirewallConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRedirectConfiguration. +func (a ApplicationGatewayRedirectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRedirectConfiguration. +func (a *ApplicationGatewayRedirectConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRedirectConfigurationPropertiesFormat. +func (a ApplicationGatewayRedirectConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "includePath", a.IncludePath) + populate(objectMap, "includeQueryString", a.IncludeQueryString) + populate(objectMap, "pathRules", a.PathRules) + populate(objectMap, "redirectType", a.RedirectType) + populate(objectMap, "requestRoutingRules", a.RequestRoutingRules) + populate(objectMap, "targetListener", a.TargetListener) + populate(objectMap, "targetUrl", a.TargetURL) + populate(objectMap, "urlPathMaps", a.URLPathMaps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRedirectConfigurationPropertiesFormat. +func (a *ApplicationGatewayRedirectConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "includePath": + err = unpopulate(val, "IncludePath", &a.IncludePath) + delete(rawMsg, key) + case "includeQueryString": + err = unpopulate(val, "IncludeQueryString", &a.IncludeQueryString) + delete(rawMsg, key) + case "pathRules": + err = unpopulate(val, "PathRules", &a.PathRules) + delete(rawMsg, key) + case "redirectType": + err = unpopulate(val, "RedirectType", &a.RedirectType) + delete(rawMsg, key) + case "requestRoutingRules": + err = unpopulate(val, "RequestRoutingRules", &a.RequestRoutingRules) + delete(rawMsg, key) + case "targetListener": + err = unpopulate(val, "TargetListener", &a.TargetListener) + delete(rawMsg, key) + case "targetUrl": + err = unpopulate(val, "TargetURL", &a.TargetURL) + delete(rawMsg, key) + case "urlPathMaps": + err = unpopulate(val, "URLPathMaps", &a.URLPathMaps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRequestRoutingRule. +func (a ApplicationGatewayRequestRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRequestRoutingRule. +func (a *ApplicationGatewayRequestRoutingRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRequestRoutingRulePropertiesFormat. +func (a ApplicationGatewayRequestRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendHttpSettings", a.BackendHTTPSettings) + populate(objectMap, "httpListener", a.HTTPListener) + populate(objectMap, "loadDistributionPolicy", a.LoadDistributionPolicy) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "redirectConfiguration", a.RedirectConfiguration) + populate(objectMap, "rewriteRuleSet", a.RewriteRuleSet) + populate(objectMap, "ruleType", a.RuleType) + populate(objectMap, "urlPathMap", a.URLPathMap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRequestRoutingRulePropertiesFormat. +func (a *ApplicationGatewayRequestRoutingRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendHttpSettings": + err = unpopulate(val, "BackendHTTPSettings", &a.BackendHTTPSettings) + delete(rawMsg, key) + case "httpListener": + err = unpopulate(val, "HTTPListener", &a.HTTPListener) + delete(rawMsg, key) + case "loadDistributionPolicy": + err = unpopulate(val, "LoadDistributionPolicy", &a.LoadDistributionPolicy) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "redirectConfiguration": + err = unpopulate(val, "RedirectConfiguration", &a.RedirectConfiguration) + delete(rawMsg, key) + case "rewriteRuleSet": + err = unpopulate(val, "RewriteRuleSet", &a.RewriteRuleSet) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "urlPathMap": + err = unpopulate(val, "URLPathMap", &a.URLPathMap) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRewriteRule. +func (a ApplicationGatewayRewriteRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionSet", a.ActionSet) + populate(objectMap, "conditions", a.Conditions) + populate(objectMap, "name", a.Name) + populate(objectMap, "ruleSequence", a.RuleSequence) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRewriteRule. +func (a *ApplicationGatewayRewriteRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionSet": + err = unpopulate(val, "ActionSet", &a.ActionSet) + delete(rawMsg, key) + case "conditions": + err = unpopulate(val, "Conditions", &a.Conditions) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "ruleSequence": + err = unpopulate(val, "RuleSequence", &a.RuleSequence) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRewriteRuleActionSet. +func (a ApplicationGatewayRewriteRuleActionSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "requestHeaderConfigurations", a.RequestHeaderConfigurations) + populate(objectMap, "responseHeaderConfigurations", a.ResponseHeaderConfigurations) + populate(objectMap, "urlConfiguration", a.URLConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRewriteRuleActionSet. +func (a *ApplicationGatewayRewriteRuleActionSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "requestHeaderConfigurations": + err = unpopulate(val, "RequestHeaderConfigurations", &a.RequestHeaderConfigurations) + delete(rawMsg, key) + case "responseHeaderConfigurations": + err = unpopulate(val, "ResponseHeaderConfigurations", &a.ResponseHeaderConfigurations) + delete(rawMsg, key) + case "urlConfiguration": + err = unpopulate(val, "URLConfiguration", &a.URLConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRewriteRuleCondition. +func (a ApplicationGatewayRewriteRuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ignoreCase", a.IgnoreCase) + populate(objectMap, "negate", a.Negate) + populate(objectMap, "pattern", a.Pattern) + populate(objectMap, "variable", a.Variable) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRewriteRuleCondition. +func (a *ApplicationGatewayRewriteRuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ignoreCase": + err = unpopulate(val, "IgnoreCase", &a.IgnoreCase) + delete(rawMsg, key) + case "negate": + err = unpopulate(val, "Negate", &a.Negate) + delete(rawMsg, key) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) + delete(rawMsg, key) + case "variable": + err = unpopulate(val, "Variable", &a.Variable) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRewriteRuleSet. +func (a ApplicationGatewayRewriteRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRewriteRuleSet. +func (a *ApplicationGatewayRewriteRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRewriteRuleSetPropertiesFormat. +func (a ApplicationGatewayRewriteRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "rewriteRules", a.RewriteRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRewriteRuleSetPropertiesFormat. +func (a *ApplicationGatewayRewriteRuleSetPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "rewriteRules": + err = unpopulate(val, "RewriteRules", &a.RewriteRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRoutingRule. +func (a ApplicationGatewayRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRoutingRule. +func (a *ApplicationGatewayRoutingRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayRoutingRulePropertiesFormat. +func (a ApplicationGatewayRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", a.BackendAddressPool) + populate(objectMap, "backendSettings", a.BackendSettings) + populate(objectMap, "listener", a.Listener) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "ruleType", a.RuleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayRoutingRulePropertiesFormat. +func (a *ApplicationGatewayRoutingRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &a.BackendAddressPool) + delete(rawMsg, key) + case "backendSettings": + err = unpopulate(val, "BackendSettings", &a.BackendSettings) + delete(rawMsg, key) + case "listener": + err = unpopulate(val, "Listener", &a.Listener) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySKU. +func (a ApplicationGatewaySKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", a.Capacity) + populate(objectMap, "name", a.Name) + populate(objectMap, "tier", a.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySKU. +func (a *ApplicationGatewaySKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &a.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLCertificate. +func (a ApplicationGatewaySSLCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLCertificate. +func (a *ApplicationGatewaySSLCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLCertificatePropertiesFormat. +func (a ApplicationGatewaySSLCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", a.Data) + populate(objectMap, "keyVaultSecretId", a.KeyVaultSecretID) + populate(objectMap, "password", a.Password) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicCertData", a.PublicCertData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLCertificatePropertiesFormat. +func (a *ApplicationGatewaySSLCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &a.Data) + delete(rawMsg, key) + case "keyVaultSecretId": + err = unpopulate(val, "KeyVaultSecretID", &a.KeyVaultSecretID) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &a.Password) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publicCertData": + err = unpopulate(val, "PublicCertData", &a.PublicCertData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLPolicy. +func (a ApplicationGatewaySSLPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cipherSuites", a.CipherSuites) + populate(objectMap, "disabledSslProtocols", a.DisabledSSLProtocols) + populate(objectMap, "minProtocolVersion", a.MinProtocolVersion) + populate(objectMap, "policyName", a.PolicyName) + populate(objectMap, "policyType", a.PolicyType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLPolicy. +func (a *ApplicationGatewaySSLPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cipherSuites": + err = unpopulate(val, "CipherSuites", &a.CipherSuites) + delete(rawMsg, key) + case "disabledSslProtocols": + err = unpopulate(val, "DisabledSSLProtocols", &a.DisabledSSLProtocols) + delete(rawMsg, key) + case "minProtocolVersion": + err = unpopulate(val, "MinProtocolVersion", &a.MinProtocolVersion) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &a.PolicyName) + delete(rawMsg, key) + case "policyType": + err = unpopulate(val, "PolicyType", &a.PolicyType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLPredefinedPolicy. +func (a ApplicationGatewaySSLPredefinedPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLPredefinedPolicy. +func (a *ApplicationGatewaySSLPredefinedPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLPredefinedPolicyPropertiesFormat. +func (a ApplicationGatewaySSLPredefinedPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cipherSuites", a.CipherSuites) + populate(objectMap, "minProtocolVersion", a.MinProtocolVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLPredefinedPolicyPropertiesFormat. +func (a *ApplicationGatewaySSLPredefinedPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cipherSuites": + err = unpopulate(val, "CipherSuites", &a.CipherSuites) + delete(rawMsg, key) + case "minProtocolVersion": + err = unpopulate(val, "MinProtocolVersion", &a.MinProtocolVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLProfile. +func (a ApplicationGatewaySSLProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLProfile. +func (a *ApplicationGatewaySSLProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewaySSLProfilePropertiesFormat. +func (a ApplicationGatewaySSLProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientAuthConfiguration", a.ClientAuthConfiguration) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "sslPolicy", a.SSLPolicy) + populate(objectMap, "trustedClientCertificates", a.TrustedClientCertificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewaySSLProfilePropertiesFormat. +func (a *ApplicationGatewaySSLProfilePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientAuthConfiguration": + err = unpopulate(val, "ClientAuthConfiguration", &a.ClientAuthConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "sslPolicy": + err = unpopulate(val, "SSLPolicy", &a.SSLPolicy) + delete(rawMsg, key) + case "trustedClientCertificates": + err = unpopulate(val, "TrustedClientCertificates", &a.TrustedClientCertificates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayTrustedClientCertificate. +func (a ApplicationGatewayTrustedClientCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayTrustedClientCertificate. +func (a *ApplicationGatewayTrustedClientCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayTrustedClientCertificatePropertiesFormat. +func (a ApplicationGatewayTrustedClientCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientCertIssuerDN", a.ClientCertIssuerDN) + populate(objectMap, "data", a.Data) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "validatedCertData", a.ValidatedCertData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayTrustedClientCertificatePropertiesFormat. +func (a *ApplicationGatewayTrustedClientCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientCertIssuerDN": + err = unpopulate(val, "ClientCertIssuerDN", &a.ClientCertIssuerDN) + delete(rawMsg, key) + case "data": + err = unpopulate(val, "Data", &a.Data) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "validatedCertData": + err = unpopulate(val, "ValidatedCertData", &a.ValidatedCertData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayTrustedRootCertificate. +func (a ApplicationGatewayTrustedRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayTrustedRootCertificate. +func (a *ApplicationGatewayTrustedRootCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayTrustedRootCertificatePropertiesFormat. +func (a ApplicationGatewayTrustedRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", a.Data) + populate(objectMap, "keyVaultSecretId", a.KeyVaultSecretID) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayTrustedRootCertificatePropertiesFormat. +func (a *ApplicationGatewayTrustedRootCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &a.Data) + delete(rawMsg, key) + case "keyVaultSecretId": + err = unpopulate(val, "KeyVaultSecretID", &a.KeyVaultSecretID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayURLConfiguration. +func (a ApplicationGatewayURLConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "modifiedPath", a.ModifiedPath) + populate(objectMap, "modifiedQueryString", a.ModifiedQueryString) + populate(objectMap, "reroute", a.Reroute) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayURLConfiguration. +func (a *ApplicationGatewayURLConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "modifiedPath": + err = unpopulate(val, "ModifiedPath", &a.ModifiedPath) + delete(rawMsg, key) + case "modifiedQueryString": + err = unpopulate(val, "ModifiedQueryString", &a.ModifiedQueryString) + delete(rawMsg, key) + case "reroute": + err = unpopulate(val, "Reroute", &a.Reroute) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayURLPathMap. +func (a ApplicationGatewayURLPathMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayURLPathMap. +func (a *ApplicationGatewayURLPathMap) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayURLPathMapPropertiesFormat. +func (a ApplicationGatewayURLPathMapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultBackendAddressPool", a.DefaultBackendAddressPool) + populate(objectMap, "defaultBackendHttpSettings", a.DefaultBackendHTTPSettings) + populate(objectMap, "defaultLoadDistributionPolicy", a.DefaultLoadDistributionPolicy) + populate(objectMap, "defaultRedirectConfiguration", a.DefaultRedirectConfiguration) + populate(objectMap, "defaultRewriteRuleSet", a.DefaultRewriteRuleSet) + populate(objectMap, "pathRules", a.PathRules) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayURLPathMapPropertiesFormat. +func (a *ApplicationGatewayURLPathMapPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultBackendAddressPool": + err = unpopulate(val, "DefaultBackendAddressPool", &a.DefaultBackendAddressPool) + delete(rawMsg, key) + case "defaultBackendHttpSettings": + err = unpopulate(val, "DefaultBackendHTTPSettings", &a.DefaultBackendHTTPSettings) + delete(rawMsg, key) + case "defaultLoadDistributionPolicy": + err = unpopulate(val, "DefaultLoadDistributionPolicy", &a.DefaultLoadDistributionPolicy) + delete(rawMsg, key) + case "defaultRedirectConfiguration": + err = unpopulate(val, "DefaultRedirectConfiguration", &a.DefaultRedirectConfiguration) + delete(rawMsg, key) + case "defaultRewriteRuleSet": + err = unpopulate(val, "DefaultRewriteRuleSet", &a.DefaultRewriteRuleSet) + delete(rawMsg, key) + case "pathRules": + err = unpopulate(val, "PathRules", &a.PathRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayWafDynamicManifestPropertiesResult. +func (a ApplicationGatewayWafDynamicManifestPropertiesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availableRuleSets", a.AvailableRuleSets) + populate(objectMap, "defaultRuleSet", a.DefaultRuleSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayWafDynamicManifestPropertiesResult. +func (a *ApplicationGatewayWafDynamicManifestPropertiesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableRuleSets": + err = unpopulate(val, "AvailableRuleSets", &a.AvailableRuleSets) + delete(rawMsg, key) + case "defaultRuleSet": + err = unpopulate(val, "DefaultRuleSet", &a.DefaultRuleSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayWafDynamicManifestResult. +func (a ApplicationGatewayWafDynamicManifestResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayWafDynamicManifestResult. +func (a *ApplicationGatewayWafDynamicManifestResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayWafDynamicManifestResultList. +func (a ApplicationGatewayWafDynamicManifestResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayWafDynamicManifestResultList. +func (a *ApplicationGatewayWafDynamicManifestResultList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationGatewayWebApplicationFirewallConfiguration. +func (a ApplicationGatewayWebApplicationFirewallConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disabledRuleGroups", a.DisabledRuleGroups) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "exclusions", a.Exclusions) + populate(objectMap, "fileUploadLimitInMb", a.FileUploadLimitInMb) + populate(objectMap, "firewallMode", a.FirewallMode) + populate(objectMap, "maxRequestBodySize", a.MaxRequestBodySize) + populate(objectMap, "maxRequestBodySizeInKb", a.MaxRequestBodySizeInKb) + populate(objectMap, "requestBodyCheck", a.RequestBodyCheck) + populate(objectMap, "ruleSetType", a.RuleSetType) + populate(objectMap, "ruleSetVersion", a.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationGatewayWebApplicationFirewallConfiguration. +func (a *ApplicationGatewayWebApplicationFirewallConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disabledRuleGroups": + err = unpopulate(val, "DisabledRuleGroups", &a.DisabledRuleGroups) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "exclusions": + err = unpopulate(val, "Exclusions", &a.Exclusions) + delete(rawMsg, key) + case "fileUploadLimitInMb": + err = unpopulate(val, "FileUploadLimitInMb", &a.FileUploadLimitInMb) + delete(rawMsg, key) + case "firewallMode": + err = unpopulate(val, "FirewallMode", &a.FirewallMode) + delete(rawMsg, key) + case "maxRequestBodySize": + err = unpopulate(val, "MaxRequestBodySize", &a.MaxRequestBodySize) + delete(rawMsg, key) + case "maxRequestBodySizeInKb": + err = unpopulate(val, "MaxRequestBodySizeInKb", &a.MaxRequestBodySizeInKb) + delete(rawMsg, key) + case "requestBodyCheck": + err = unpopulate(val, "RequestBodyCheck", &a.RequestBodyCheck) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &a.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &a.RuleSetVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationRule. +func (a ApplicationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "destinationAddresses", a.DestinationAddresses) + populate(objectMap, "fqdnTags", a.FqdnTags) + populate(objectMap, "name", a.Name) + populate(objectMap, "protocols", a.Protocols) + objectMap["ruleType"] = FirewallPolicyRuleTypeApplicationRule + populate(objectMap, "sourceAddresses", a.SourceAddresses) + populate(objectMap, "sourceIpGroups", a.SourceIPGroups) + populate(objectMap, "targetFqdns", a.TargetFqdns) + populate(objectMap, "targetUrls", a.TargetUrls) + populate(objectMap, "terminateTLS", a.TerminateTLS) + populate(objectMap, "webCategories", a.WebCategories) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationRule. +func (a *ApplicationRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &a.DestinationAddresses) + delete(rawMsg, key) + case "fqdnTags": + err = unpopulate(val, "FqdnTags", &a.FqdnTags) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &a.Protocols) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &a.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &a.SourceIPGroups) + delete(rawMsg, key) + case "targetFqdns": + err = unpopulate(val, "TargetFqdns", &a.TargetFqdns) + delete(rawMsg, key) + case "targetUrls": + err = unpopulate(val, "TargetUrls", &a.TargetUrls) + delete(rawMsg, key) + case "terminateTLS": + err = unpopulate(val, "TerminateTLS", &a.TerminateTLS) + delete(rawMsg, key) + case "webCategories": + err = unpopulate(val, "WebCategories", &a.WebCategories) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationSecurityGroup. +func (a ApplicationSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationSecurityGroup. +func (a *ApplicationSecurityGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationSecurityGroupListResult. +func (a ApplicationSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationSecurityGroupListResult. +func (a *ApplicationSecurityGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationSecurityGroupPropertiesFormat. +func (a ApplicationSecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceGuid", a.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationSecurityGroupPropertiesFormat. +func (a *ApplicationSecurityGroupPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &a.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationListResult. +func (a AuthorizationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationListResult. +func (a *AuthorizationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationPropertiesFormat. +func (a AuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationKey", a.AuthorizationKey) + populate(objectMap, "authorizationUseStatus", a.AuthorizationUseStatus) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationPropertiesFormat. +func (a *AuthorizationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &a.AuthorizationKey) + delete(rawMsg, key) + case "authorizationUseStatus": + err = unpopulate(val, "AuthorizationUseStatus", &a.AuthorizationUseStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoApprovedPrivateLinkService. +func (a AutoApprovedPrivateLinkService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateLinkService", a.PrivateLinkService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoApprovedPrivateLinkService. +func (a *AutoApprovedPrivateLinkService) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateLinkService": + err = unpopulate(val, "PrivateLinkService", &a.PrivateLinkService) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoApprovedPrivateLinkServicesResult. +func (a AutoApprovedPrivateLinkServicesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoApprovedPrivateLinkServicesResult. +func (a *AutoApprovedPrivateLinkServicesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Availability. +func (a Availability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobDuration", a.BlobDuration) + populate(objectMap, "retention", a.Retention) + populate(objectMap, "timeGrain", a.TimeGrain) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Availability. +func (a *Availability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobDuration": + err = unpopulate(val, "BlobDuration", &a.BlobDuration) + delete(rawMsg, key) + case "retention": + err = unpopulate(val, "Retention", &a.Retention) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &a.TimeGrain) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableDelegation. +func (a AvailableDelegation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", a.Actions) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "serviceName", a.ServiceName) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableDelegation. +func (a *AvailableDelegation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &a.Actions) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &a.ServiceName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableDelegationsResult. +func (a AvailableDelegationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableDelegationsResult. +func (a *AvailableDelegationsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailablePrivateEndpointType. +func (a AvailablePrivateEndpointType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "resourceName", a.ResourceName) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePrivateEndpointType. +func (a *AvailablePrivateEndpointType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &a.ResourceName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailablePrivateEndpointTypesResult. +func (a AvailablePrivateEndpointTypesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePrivateEndpointTypesResult. +func (a *AvailablePrivateEndpointTypesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableProvidersList. +func (a AvailableProvidersList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "countries", a.Countries) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableProvidersList. +func (a *AvailableProvidersList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "countries": + err = unpopulate(val, "Countries", &a.Countries) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableProvidersListCity. +func (a AvailableProvidersListCity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cityName", a.CityName) + populate(objectMap, "providers", a.Providers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableProvidersListCity. +func (a *AvailableProvidersListCity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cityName": + err = unpopulate(val, "CityName", &a.CityName) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &a.Providers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableProvidersListCountry. +func (a AvailableProvidersListCountry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "countryName", a.CountryName) + populate(objectMap, "providers", a.Providers) + populate(objectMap, "states", a.States) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableProvidersListCountry. +func (a *AvailableProvidersListCountry) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "countryName": + err = unpopulate(val, "CountryName", &a.CountryName) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &a.Providers) + delete(rawMsg, key) + case "states": + err = unpopulate(val, "States", &a.States) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableProvidersListParameters. +func (a AvailableProvidersListParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureLocations", a.AzureLocations) + populate(objectMap, "city", a.City) + populate(objectMap, "country", a.Country) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableProvidersListParameters. +func (a *AvailableProvidersListParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureLocations": + err = unpopulate(val, "AzureLocations", &a.AzureLocations) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &a.City) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &a.Country) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableProvidersListState. +func (a AvailableProvidersListState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cities", a.Cities) + populate(objectMap, "providers", a.Providers) + populate(objectMap, "stateName", a.StateName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableProvidersListState. +func (a *AvailableProvidersListState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cities": + err = unpopulate(val, "Cities", &a.Cities) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &a.Providers) + delete(rawMsg, key) + case "stateName": + err = unpopulate(val, "StateName", &a.StateName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableServiceAlias. +func (a AvailableServiceAlias) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "resourceName", a.ResourceName) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableServiceAlias. +func (a *AvailableServiceAlias) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &a.ResourceName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableServiceAliasesResult. +func (a AvailableServiceAliasesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableServiceAliasesResult. +func (a *AvailableServiceAliasesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureAsyncOperationResult. +func (a AzureAsyncOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", a.Error) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAsyncOperationResult. +func (a *AzureAsyncOperationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewall. +func (a AzureFirewall) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + populate(objectMap, "zones", a.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewall. +func (a *AzureFirewall) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &a.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallApplicationRule. +func (a AzureFirewallApplicationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "fqdnTags", a.FqdnTags) + populate(objectMap, "name", a.Name) + populate(objectMap, "protocols", a.Protocols) + populate(objectMap, "sourceAddresses", a.SourceAddresses) + populate(objectMap, "sourceIpGroups", a.SourceIPGroups) + populate(objectMap, "targetFqdns", a.TargetFqdns) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallApplicationRule. +func (a *AzureFirewallApplicationRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "fqdnTags": + err = unpopulate(val, "FqdnTags", &a.FqdnTags) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &a.Protocols) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &a.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &a.SourceIPGroups) + delete(rawMsg, key) + case "targetFqdns": + err = unpopulate(val, "TargetFqdns", &a.TargetFqdns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallApplicationRuleCollection. +func (a AzureFirewallApplicationRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallApplicationRuleCollection. +func (a *AzureFirewallApplicationRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallApplicationRuleCollectionPropertiesFormat. +func (a AzureFirewallApplicationRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", a.Action) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallApplicationRuleCollectionPropertiesFormat. +func (a *AzureFirewallApplicationRuleCollectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallApplicationRuleProtocol. +func (a AzureFirewallApplicationRuleProtocol) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", a.Port) + populate(objectMap, "protocolType", a.ProtocolType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallApplicationRuleProtocol. +func (a *AzureFirewallApplicationRuleProtocol) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "protocolType": + err = unpopulate(val, "ProtocolType", &a.ProtocolType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallFqdnTag. +func (a AzureFirewallFqdnTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallFqdnTag. +func (a *AzureFirewallFqdnTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallFqdnTagListResult. +func (a AzureFirewallFqdnTagListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallFqdnTagListResult. +func (a *AzureFirewallFqdnTagListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallFqdnTagPropertiesFormat. +func (a AzureFirewallFqdnTagPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdnTagName", a.FqdnTagName) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallFqdnTagPropertiesFormat. +func (a *AzureFirewallFqdnTagPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdnTagName": + err = unpopulate(val, "FqdnTagName", &a.FqdnTagName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallIPConfiguration. +func (a AzureFirewallIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallIPConfiguration. +func (a *AzureFirewallIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallIPConfigurationPropertiesFormat. +func (a AzureFirewallIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", a.PrivateIPAddress) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publicIPAddress", a.PublicIPAddress) + populate(objectMap, "subnet", a.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallIPConfigurationPropertiesFormat. +func (a *AzureFirewallIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &a.PrivateIPAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &a.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &a.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallIPGroups. +func (a AzureFirewallIPGroups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "changeNumber", a.ChangeNumber) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallIPGroups. +func (a *AzureFirewallIPGroups) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changeNumber": + err = unpopulate(val, "ChangeNumber", &a.ChangeNumber) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallListResult. +func (a AzureFirewallListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallListResult. +func (a *AzureFirewallListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNatRCAction. +func (a AzureFirewallNatRCAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNatRCAction. +func (a *AzureFirewallNatRCAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNatRule. +func (a AzureFirewallNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "destinationAddresses", a.DestinationAddresses) + populate(objectMap, "destinationPorts", a.DestinationPorts) + populate(objectMap, "name", a.Name) + populate(objectMap, "protocols", a.Protocols) + populate(objectMap, "sourceAddresses", a.SourceAddresses) + populate(objectMap, "sourceIpGroups", a.SourceIPGroups) + populate(objectMap, "translatedAddress", a.TranslatedAddress) + populate(objectMap, "translatedFqdn", a.TranslatedFqdn) + populate(objectMap, "translatedPort", a.TranslatedPort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNatRule. +func (a *AzureFirewallNatRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &a.DestinationAddresses) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &a.DestinationPorts) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &a.Protocols) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &a.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &a.SourceIPGroups) + delete(rawMsg, key) + case "translatedAddress": + err = unpopulate(val, "TranslatedAddress", &a.TranslatedAddress) + delete(rawMsg, key) + case "translatedFqdn": + err = unpopulate(val, "TranslatedFqdn", &a.TranslatedFqdn) + delete(rawMsg, key) + case "translatedPort": + err = unpopulate(val, "TranslatedPort", &a.TranslatedPort) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNatRuleCollection. +func (a AzureFirewallNatRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNatRuleCollection. +func (a *AzureFirewallNatRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNatRuleCollectionProperties. +func (a AzureFirewallNatRuleCollectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", a.Action) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNatRuleCollectionProperties. +func (a *AzureFirewallNatRuleCollectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNetworkRule. +func (a AzureFirewallNetworkRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "destinationAddresses", a.DestinationAddresses) + populate(objectMap, "destinationFqdns", a.DestinationFqdns) + populate(objectMap, "destinationIpGroups", a.DestinationIPGroups) + populate(objectMap, "destinationPorts", a.DestinationPorts) + populate(objectMap, "name", a.Name) + populate(objectMap, "protocols", a.Protocols) + populate(objectMap, "sourceAddresses", a.SourceAddresses) + populate(objectMap, "sourceIpGroups", a.SourceIPGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNetworkRule. +func (a *AzureFirewallNetworkRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &a.DestinationAddresses) + delete(rawMsg, key) + case "destinationFqdns": + err = unpopulate(val, "DestinationFqdns", &a.DestinationFqdns) + delete(rawMsg, key) + case "destinationIpGroups": + err = unpopulate(val, "DestinationIPGroups", &a.DestinationIPGroups) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &a.DestinationPorts) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &a.Protocols) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &a.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &a.SourceIPGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNetworkRuleCollection. +func (a AzureFirewallNetworkRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNetworkRuleCollection. +func (a *AzureFirewallNetworkRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallNetworkRuleCollectionPropertiesFormat. +func (a AzureFirewallNetworkRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", a.Action) + populate(objectMap, "priority", a.Priority) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallNetworkRuleCollectionPropertiesFormat. +func (a *AzureFirewallNetworkRuleCollectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &a.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallPropertiesFormat. +func (a AzureFirewallPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalProperties", a.AdditionalProperties) + populate(objectMap, "applicationRuleCollections", a.ApplicationRuleCollections) + populate(objectMap, "firewallPolicy", a.FirewallPolicy) + populate(objectMap, "hubIPAddresses", a.HubIPAddresses) + populate(objectMap, "ipConfigurations", a.IPConfigurations) + populate(objectMap, "ipGroups", a.IPGroups) + populate(objectMap, "managementIpConfiguration", a.ManagementIPConfiguration) + populate(objectMap, "natRuleCollections", a.NatRuleCollections) + populate(objectMap, "networkRuleCollections", a.NetworkRuleCollections) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "threatIntelMode", a.ThreatIntelMode) + populate(objectMap, "virtualHub", a.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallPropertiesFormat. +func (a *AzureFirewallPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalProperties": + err = unpopulate(val, "AdditionalProperties", &a.AdditionalProperties) + delete(rawMsg, key) + case "applicationRuleCollections": + err = unpopulate(val, "ApplicationRuleCollections", &a.ApplicationRuleCollections) + delete(rawMsg, key) + case "firewallPolicy": + err = unpopulate(val, "FirewallPolicy", &a.FirewallPolicy) + delete(rawMsg, key) + case "hubIPAddresses": + err = unpopulate(val, "HubIPAddresses", &a.HubIPAddresses) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &a.IPConfigurations) + delete(rawMsg, key) + case "ipGroups": + err = unpopulate(val, "IPGroups", &a.IPGroups) + delete(rawMsg, key) + case "managementIpConfiguration": + err = unpopulate(val, "ManagementIPConfiguration", &a.ManagementIPConfiguration) + delete(rawMsg, key) + case "natRuleCollections": + err = unpopulate(val, "NatRuleCollections", &a.NatRuleCollections) + delete(rawMsg, key) + case "networkRuleCollections": + err = unpopulate(val, "NetworkRuleCollections", &a.NetworkRuleCollections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "threatIntelMode": + err = unpopulate(val, "ThreatIntelMode", &a.ThreatIntelMode) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &a.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallPublicIPAddress. +func (a AzureFirewallPublicIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", a.Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallPublicIPAddress. +func (a *AzureFirewallPublicIPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &a.Address) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallRCAction. +func (a AzureFirewallRCAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallRCAction. +func (a *AzureFirewallRCAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFirewallSKU. +func (a AzureFirewallSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", a.Name) + populate(objectMap, "tier", a.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFirewallSKU. +func (a *AzureFirewallSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureReachabilityReport. +func (a AzureReachabilityReport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationLevel", a.AggregationLevel) + populate(objectMap, "providerLocation", a.ProviderLocation) + populate(objectMap, "reachabilityReport", a.ReachabilityReport) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureReachabilityReport. +func (a *AzureReachabilityReport) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationLevel": + err = unpopulate(val, "AggregationLevel", &a.AggregationLevel) + delete(rawMsg, key) + case "providerLocation": + err = unpopulate(val, "ProviderLocation", &a.ProviderLocation) + delete(rawMsg, key) + case "reachabilityReport": + err = unpopulate(val, "ReachabilityReport", &a.ReachabilityReport) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureReachabilityReportItem. +func (a AzureReachabilityReportItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureLocation", a.AzureLocation) + populate(objectMap, "latencies", a.Latencies) + populate(objectMap, "provider", a.Provider) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureReachabilityReportItem. +func (a *AzureReachabilityReportItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureLocation": + err = unpopulate(val, "AzureLocation", &a.AzureLocation) + delete(rawMsg, key) + case "latencies": + err = unpopulate(val, "Latencies", &a.Latencies) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &a.Provider) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureReachabilityReportLatencyInfo. +func (a AzureReachabilityReportLatencyInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "score", a.Score) + populateTimeRFC3339(objectMap, "timeStamp", a.TimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureReachabilityReportLatencyInfo. +func (a *AzureReachabilityReportLatencyInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "score": + err = unpopulate(val, "Score", &a.Score) + delete(rawMsg, key) + case "timeStamp": + err = unpopulateTimeRFC3339(val, "TimeStamp", &a.TimeStamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureReachabilityReportLocation. +func (a AzureReachabilityReportLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "city", a.City) + populate(objectMap, "country", a.Country) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureReachabilityReportLocation. +func (a *AzureReachabilityReportLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "city": + err = unpopulate(val, "City", &a.City) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &a.Country) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureReachabilityReportParameters. +func (a AzureReachabilityReportParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureLocations", a.AzureLocations) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "providerLocation", a.ProviderLocation) + populate(objectMap, "providers", a.Providers) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureReachabilityReportParameters. +func (a *AzureReachabilityReportParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureLocations": + err = unpopulate(val, "AzureLocations", &a.AzureLocations) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "providerLocation": + err = unpopulate(val, "ProviderLocation", &a.ProviderLocation) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &a.Providers) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureWebCategory. +func (a AzureWebCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWebCategory. +func (a *AzureWebCategory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureWebCategoryListResult. +func (a AzureWebCategoryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWebCategoryListResult. +func (a *AzureWebCategoryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureWebCategoryPropertiesFormat. +func (a AzureWebCategoryPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "group", a.Group) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureWebCategoryPropertiesFormat. +func (a *AzureWebCategoryPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "group": + err = unpopulate(val, "Group", &a.Group) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BGPCommunity. +func (b BGPCommunity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "communityName", b.CommunityName) + populate(objectMap, "communityPrefixes", b.CommunityPrefixes) + populate(objectMap, "communityValue", b.CommunityValue) + populate(objectMap, "isAuthorizedToUse", b.IsAuthorizedToUse) + populate(objectMap, "serviceGroup", b.ServiceGroup) + populate(objectMap, "serviceSupportedRegion", b.ServiceSupportedRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BGPCommunity. +func (b *BGPCommunity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "communityName": + err = unpopulate(val, "CommunityName", &b.CommunityName) + delete(rawMsg, key) + case "communityPrefixes": + err = unpopulate(val, "CommunityPrefixes", &b.CommunityPrefixes) + delete(rawMsg, key) + case "communityValue": + err = unpopulate(val, "CommunityValue", &b.CommunityValue) + delete(rawMsg, key) + case "isAuthorizedToUse": + err = unpopulate(val, "IsAuthorizedToUse", &b.IsAuthorizedToUse) + delete(rawMsg, key) + case "serviceGroup": + err = unpopulate(val, "ServiceGroup", &b.ServiceGroup) + delete(rawMsg, key) + case "serviceSupportedRegion": + err = unpopulate(val, "ServiceSupportedRegion", &b.ServiceSupportedRegion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendAddressInboundNatRulePortMappings. +func (b BackendAddressInboundNatRulePortMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inboundNatRulePortMappings", b.InboundNatRulePortMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendAddressInboundNatRulePortMappings. +func (b *BackendAddressInboundNatRulePortMappings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "inboundNatRulePortMappings": + err = unpopulate(val, "InboundNatRulePortMappings", &b.InboundNatRulePortMappings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendAddressPool. +func (b BackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendAddressPool. +func (b *BackendAddressPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackendAddressPoolPropertiesFormat. +func (b BackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendIPConfigurations", b.BackendIPConfigurations) + populate(objectMap, "drainPeriodInSeconds", b.DrainPeriodInSeconds) + populate(objectMap, "inboundNatRules", b.InboundNatRules) + populate(objectMap, "loadBalancerBackendAddresses", b.LoadBalancerBackendAddresses) + populate(objectMap, "loadBalancingRules", b.LoadBalancingRules) + populate(objectMap, "location", b.Location) + populate(objectMap, "outboundRule", b.OutboundRule) + populate(objectMap, "outboundRules", b.OutboundRules) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "tunnelInterfaces", b.TunnelInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackendAddressPoolPropertiesFormat. +func (b *BackendAddressPoolPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendIPConfigurations": + err = unpopulate(val, "BackendIPConfigurations", &b.BackendIPConfigurations) + delete(rawMsg, key) + case "drainPeriodInSeconds": + err = unpopulate(val, "DrainPeriodInSeconds", &b.DrainPeriodInSeconds) + delete(rawMsg, key) + case "inboundNatRules": + err = unpopulate(val, "InboundNatRules", &b.InboundNatRules) + delete(rawMsg, key) + case "loadBalancerBackendAddresses": + err = unpopulate(val, "LoadBalancerBackendAddresses", &b.LoadBalancerBackendAddresses) + delete(rawMsg, key) + case "loadBalancingRules": + err = unpopulate(val, "LoadBalancingRules", &b.LoadBalancingRules) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "outboundRule": + err = unpopulate(val, "OutboundRule", &b.OutboundRule) + delete(rawMsg, key) + case "outboundRules": + err = unpopulate(val, "OutboundRules", &b.OutboundRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "tunnelInterfaces": + err = unpopulate(val, "TunnelInterfaces", &b.TunnelInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseAdminRule. +func (b BaseAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + objectMap["kind"] = b.Kind + populate(objectMap, "name", b.Name) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseAdminRule. +func (b *BaseAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionActiveSession. +func (b BastionActiveSession) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "protocol", b.Protocol) + populate(objectMap, "resourceType", b.ResourceType) + populate(objectMap, "sessionDurationInMins", b.SessionDurationInMins) + populate(objectMap, "sessionId", b.SessionID) + populate(objectMap, "startTime", &b.StartTime) + populate(objectMap, "targetHostName", b.TargetHostName) + populate(objectMap, "targetIpAddress", b.TargetIPAddress) + populate(objectMap, "targetResourceGroup", b.TargetResourceGroup) + populate(objectMap, "targetResourceId", b.TargetResourceID) + populate(objectMap, "targetSubscriptionId", b.TargetSubscriptionID) + populate(objectMap, "userName", b.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionActiveSession. +func (b *BastionActiveSession) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "protocol": + err = unpopulate(val, "Protocol", &b.Protocol) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &b.ResourceType) + delete(rawMsg, key) + case "sessionDurationInMins": + err = unpopulate(val, "SessionDurationInMins", &b.SessionDurationInMins) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &b.SessionID) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + case "targetHostName": + err = unpopulate(val, "TargetHostName", &b.TargetHostName) + delete(rawMsg, key) + case "targetIpAddress": + err = unpopulate(val, "TargetIPAddress", &b.TargetIPAddress) + delete(rawMsg, key) + case "targetResourceGroup": + err = unpopulate(val, "TargetResourceGroup", &b.TargetResourceGroup) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &b.TargetResourceID) + delete(rawMsg, key) + case "targetSubscriptionId": + err = unpopulate(val, "TargetSubscriptionID", &b.TargetSubscriptionID) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &b.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionActiveSessionListResult. +func (b BastionActiveSessionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionActiveSessionListResult. +func (b *BastionActiveSessionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionHost. +func (b BastionHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "sku", b.SKU) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHost. +func (b *BastionHost) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &b.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionHostIPConfiguration. +func (b BastionHostIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHostIPConfiguration. +func (b *BastionHostIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionHostIPConfigurationPropertiesFormat. +func (b BastionHostIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAllocationMethod", b.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "publicIPAddress", b.PublicIPAddress) + populate(objectMap, "subnet", b.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHostIPConfigurationPropertiesFormat. +func (b *BastionHostIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &b.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &b.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &b.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionHostListResult. +func (b BastionHostListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHostListResult. +func (b *BastionHostListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionHostPropertiesFormat. +func (b BastionHostPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsName", b.DNSName) + populate(objectMap, "disableCopyPaste", b.DisableCopyPaste) + populate(objectMap, "enableFileCopy", b.EnableFileCopy) + populate(objectMap, "enableIpConnect", b.EnableIPConnect) + populate(objectMap, "enableShareableLink", b.EnableShareableLink) + populate(objectMap, "enableTunneling", b.EnableTunneling) + populate(objectMap, "ipConfigurations", b.IPConfigurations) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "scaleUnits", b.ScaleUnits) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionHostPropertiesFormat. +func (b *BastionHostPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsName": + err = unpopulate(val, "DNSName", &b.DNSName) + delete(rawMsg, key) + case "disableCopyPaste": + err = unpopulate(val, "DisableCopyPaste", &b.DisableCopyPaste) + delete(rawMsg, key) + case "enableFileCopy": + err = unpopulate(val, "EnableFileCopy", &b.EnableFileCopy) + delete(rawMsg, key) + case "enableIpConnect": + err = unpopulate(val, "EnableIPConnect", &b.EnableIPConnect) + delete(rawMsg, key) + case "enableShareableLink": + err = unpopulate(val, "EnableShareableLink", &b.EnableShareableLink) + delete(rawMsg, key) + case "enableTunneling": + err = unpopulate(val, "EnableTunneling", &b.EnableTunneling) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &b.IPConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "scaleUnits": + err = unpopulate(val, "ScaleUnits", &b.ScaleUnits) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionSessionDeleteResult. +func (b BastionSessionDeleteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionSessionDeleteResult. +func (b *BastionSessionDeleteResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionSessionState. +func (b BastionSessionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", b.Message) + populate(objectMap, "sessionId", b.SessionID) + populate(objectMap, "state", b.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionSessionState. +func (b *BastionSessionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &b.Message) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &b.SessionID) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &b.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionShareableLink. +func (b BastionShareableLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bsl", b.Bsl) + populate(objectMap, "createdAt", b.CreatedAt) + populate(objectMap, "message", b.Message) + populate(objectMap, "vm", b.VM) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionShareableLink. +func (b *BastionShareableLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bsl": + err = unpopulate(val, "Bsl", &b.Bsl) + delete(rawMsg, key) + case "createdAt": + err = unpopulate(val, "CreatedAt", &b.CreatedAt) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &b.Message) + delete(rawMsg, key) + case "vm": + err = unpopulate(val, "VM", &b.VM) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionShareableLinkListRequest. +func (b BastionShareableLinkListRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vms", b.VMs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionShareableLinkListRequest. +func (b *BastionShareableLinkListRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vms": + err = unpopulate(val, "VMs", &b.VMs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BastionShareableLinkListResult. +func (b BastionShareableLinkListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BastionShareableLinkListResult. +func (b *BastionShareableLinkListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpConnection. +func (b BgpConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpConnection. +func (b *BgpConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpConnectionProperties. +func (b BgpConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionState", b.ConnectionState) + populate(objectMap, "hubVirtualNetworkConnection", b.HubVirtualNetworkConnection) + populate(objectMap, "peerAsn", b.PeerAsn) + populate(objectMap, "peerIp", b.PeerIP) + populate(objectMap, "provisioningState", b.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpConnectionProperties. +func (b *BgpConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionState": + err = unpopulate(val, "ConnectionState", &b.ConnectionState) + delete(rawMsg, key) + case "hubVirtualNetworkConnection": + err = unpopulate(val, "HubVirtualNetworkConnection", &b.HubVirtualNetworkConnection) + delete(rawMsg, key) + case "peerAsn": + err = unpopulate(val, "PeerAsn", &b.PeerAsn) + delete(rawMsg, key) + case "peerIp": + err = unpopulate(val, "PeerIP", &b.PeerIP) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpPeerStatus. +func (b BgpPeerStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", b.Asn) + populate(objectMap, "connectedDuration", b.ConnectedDuration) + populate(objectMap, "localAddress", b.LocalAddress) + populate(objectMap, "messagesReceived", b.MessagesReceived) + populate(objectMap, "messagesSent", b.MessagesSent) + populate(objectMap, "neighbor", b.Neighbor) + populate(objectMap, "routesReceived", b.RoutesReceived) + populate(objectMap, "state", b.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpPeerStatus. +func (b *BgpPeerStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &b.Asn) + delete(rawMsg, key) + case "connectedDuration": + err = unpopulate(val, "ConnectedDuration", &b.ConnectedDuration) + delete(rawMsg, key) + case "localAddress": + err = unpopulate(val, "LocalAddress", &b.LocalAddress) + delete(rawMsg, key) + case "messagesReceived": + err = unpopulate(val, "MessagesReceived", &b.MessagesReceived) + delete(rawMsg, key) + case "messagesSent": + err = unpopulate(val, "MessagesSent", &b.MessagesSent) + delete(rawMsg, key) + case "neighbor": + err = unpopulate(val, "Neighbor", &b.Neighbor) + delete(rawMsg, key) + case "routesReceived": + err = unpopulate(val, "RoutesReceived", &b.RoutesReceived) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &b.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpPeerStatusListResult. +func (b BgpPeerStatusListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpPeerStatusListResult. +func (b *BgpPeerStatusListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpServiceCommunity. +func (b BgpServiceCommunity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpServiceCommunity. +func (b *BgpServiceCommunity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpServiceCommunityListResult. +func (b BgpServiceCommunityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpServiceCommunityListResult. +func (b *BgpServiceCommunityListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpServiceCommunityPropertiesFormat. +func (b BgpServiceCommunityPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bgpCommunities", b.BgpCommunities) + populate(objectMap, "serviceName", b.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpServiceCommunityPropertiesFormat. +func (b *BgpServiceCommunityPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpCommunities": + err = unpopulate(val, "BgpCommunities", &b.BgpCommunities) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &b.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BgpSettings. +func (b BgpSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", b.Asn) + populate(objectMap, "bgpPeeringAddress", b.BgpPeeringAddress) + populate(objectMap, "bgpPeeringAddresses", b.BgpPeeringAddresses) + populate(objectMap, "peerWeight", b.PeerWeight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BgpSettings. +func (b *BgpSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &b.Asn) + delete(rawMsg, key) + case "bgpPeeringAddress": + err = unpopulate(val, "BgpPeeringAddress", &b.BgpPeeringAddress) + delete(rawMsg, key) + case "bgpPeeringAddresses": + err = unpopulate(val, "BgpPeeringAddresses", &b.BgpPeeringAddresses) + delete(rawMsg, key) + case "peerWeight": + err = unpopulate(val, "PeerWeight", &b.PeerWeight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BreakOutCategoryPolicies. +func (b BreakOutCategoryPolicies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", b.Allow) + populate(objectMap, "default", b.Default) + populate(objectMap, "optimize", b.Optimize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BreakOutCategoryPolicies. +func (b *BreakOutCategoryPolicies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allow": + err = unpopulate(val, "Allow", &b.Allow) + delete(rawMsg, key) + case "default": + err = unpopulate(val, "Default", &b.Default) + delete(rawMsg, key) + case "optimize": + err = unpopulate(val, "Optimize", &b.Optimize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckPrivateLinkServiceVisibilityRequest. +func (c CheckPrivateLinkServiceVisibilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateLinkServiceAlias", c.PrivateLinkServiceAlias) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckPrivateLinkServiceVisibilityRequest. +func (c *CheckPrivateLinkServiceVisibilityRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateLinkServiceAlias": + err = unpopulate(val, "PrivateLinkServiceAlias", &c.PrivateLinkServiceAlias) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChildResource. +func (c ChildResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChildResource. +func (c *ChildResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "principalId", c.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c *Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationDiagnosticParameters. +func (c ConfigurationDiagnosticParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "profiles", c.Profiles) + populate(objectMap, "targetResourceId", c.TargetResourceID) + populate(objectMap, "verbosityLevel", c.VerbosityLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationDiagnosticParameters. +func (c *ConfigurationDiagnosticParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "profiles": + err = unpopulate(val, "Profiles", &c.Profiles) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &c.TargetResourceID) + delete(rawMsg, key) + case "verbosityLevel": + err = unpopulate(val, "VerbosityLevel", &c.VerbosityLevel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationDiagnosticProfile. +func (c ConfigurationDiagnosticProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "destinationPort", c.DestinationPort) + populate(objectMap, "direction", c.Direction) + populate(objectMap, "protocol", c.Protocol) + populate(objectMap, "source", c.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationDiagnosticProfile. +func (c *ConfigurationDiagnosticProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &c.Destination) + delete(rawMsg, key) + case "destinationPort": + err = unpopulate(val, "DestinationPort", &c.DestinationPort) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &c.Direction) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &c.Protocol) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationDiagnosticResponse. +func (c ConfigurationDiagnosticResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "results", c.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationDiagnosticResponse. +func (c *ConfigurationDiagnosticResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "results": + err = unpopulate(val, "Results", &c.Results) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationDiagnosticResult. +func (c ConfigurationDiagnosticResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkSecurityGroupResult", c.NetworkSecurityGroupResult) + populate(objectMap, "profile", c.Profile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationDiagnosticResult. +func (c *ConfigurationDiagnosticResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkSecurityGroupResult": + err = unpopulate(val, "NetworkSecurityGroupResult", &c.NetworkSecurityGroupResult) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, "Profile", &c.Profile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationGroup. +func (c ConfigurationGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationGroup. +func (c *ConfigurationGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitor. +func (c ConnectionMonitor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", c.Location) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitor. +func (c *ConnectionMonitor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorDestination. +func (c ConnectionMonitorDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "port", c.Port) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorDestination. +func (c *ConnectionMonitorDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorEndpoint. +func (c ConnectionMonitorEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "coverageLevel", c.CoverageLevel) + populate(objectMap, "filter", c.Filter) + populate(objectMap, "name", c.Name) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "scope", c.Scope) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorEndpoint. +func (c *ConnectionMonitorEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "coverageLevel": + err = unpopulate(val, "CoverageLevel", &c.CoverageLevel) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &c.Filter) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &c.Scope) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorEndpointFilter. +func (c ConnectionMonitorEndpointFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "items", c.Items) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorEndpointFilter. +func (c *ConnectionMonitorEndpointFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "items": + err = unpopulate(val, "Items", &c.Items) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorEndpointFilterItem. +func (c ConnectionMonitorEndpointFilterItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorEndpointFilterItem. +func (c *ConnectionMonitorEndpointFilterItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorEndpointScope. +func (c ConnectionMonitorEndpointScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclude", c.Exclude) + populate(objectMap, "include", c.Include) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorEndpointScope. +func (c *ConnectionMonitorEndpointScope) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclude": + err = unpopulate(val, "Exclude", &c.Exclude) + delete(rawMsg, key) + case "include": + err = unpopulate(val, "Include", &c.Include) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorEndpointScopeItem. +func (c ConnectionMonitorEndpointScopeItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorEndpointScopeItem. +func (c *ConnectionMonitorEndpointScopeItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorHTTPConfiguration. +func (c ConnectionMonitorHTTPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "method", c.Method) + populate(objectMap, "path", c.Path) + populate(objectMap, "port", c.Port) + populate(objectMap, "preferHTTPS", c.PreferHTTPS) + populate(objectMap, "requestHeaders", c.RequestHeaders) + populate(objectMap, "validStatusCodeRanges", c.ValidStatusCodeRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorHTTPConfiguration. +func (c *ConnectionMonitorHTTPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "method": + err = unpopulate(val, "Method", &c.Method) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &c.Path) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "preferHTTPS": + err = unpopulate(val, "PreferHTTPS", &c.PreferHTTPS) + delete(rawMsg, key) + case "requestHeaders": + err = unpopulate(val, "RequestHeaders", &c.RequestHeaders) + delete(rawMsg, key) + case "validStatusCodeRanges": + err = unpopulate(val, "ValidStatusCodeRanges", &c.ValidStatusCodeRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorIcmpConfiguration. +func (c ConnectionMonitorIcmpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableTraceRoute", c.DisableTraceRoute) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorIcmpConfiguration. +func (c *ConnectionMonitorIcmpConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disableTraceRoute": + err = unpopulate(val, "DisableTraceRoute", &c.DisableTraceRoute) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorListResult. +func (c ConnectionMonitorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorListResult. +func (c *ConnectionMonitorListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorOutput. +func (c ConnectionMonitorOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", c.Type) + populate(objectMap, "workspaceSettings", c.WorkspaceSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorOutput. +func (c *ConnectionMonitorOutput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "workspaceSettings": + err = unpopulate(val, "WorkspaceSettings", &c.WorkspaceSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorParameters. +func (c ConnectionMonitorParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoStart", c.AutoStart) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "endpoints", c.Endpoints) + populate(objectMap, "monitoringIntervalInSeconds", c.MonitoringIntervalInSeconds) + populate(objectMap, "notes", c.Notes) + populate(objectMap, "outputs", c.Outputs) + populate(objectMap, "source", c.Source) + populate(objectMap, "testConfigurations", c.TestConfigurations) + populate(objectMap, "testGroups", c.TestGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorParameters. +func (c *ConnectionMonitorParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoStart": + err = unpopulate(val, "AutoStart", &c.AutoStart) + delete(rawMsg, key) + case "destination": + err = unpopulate(val, "Destination", &c.Destination) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &c.Endpoints) + delete(rawMsg, key) + case "monitoringIntervalInSeconds": + err = unpopulate(val, "MonitoringIntervalInSeconds", &c.MonitoringIntervalInSeconds) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, "Notes", &c.Notes) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, "Outputs", &c.Outputs) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + case "testConfigurations": + err = unpopulate(val, "TestConfigurations", &c.TestConfigurations) + delete(rawMsg, key) + case "testGroups": + err = unpopulate(val, "TestGroups", &c.TestGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorQueryResult. +func (c ConnectionMonitorQueryResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceStatus", c.SourceStatus) + populate(objectMap, "states", c.States) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorQueryResult. +func (c *ConnectionMonitorQueryResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sourceStatus": + err = unpopulate(val, "SourceStatus", &c.SourceStatus) + delete(rawMsg, key) + case "states": + err = unpopulate(val, "States", &c.States) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorResult. +func (c ConnectionMonitorResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorResult. +func (c *ConnectionMonitorResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorResultProperties. +func (c ConnectionMonitorResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoStart", c.AutoStart) + populate(objectMap, "connectionMonitorType", c.ConnectionMonitorType) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "endpoints", c.Endpoints) + populate(objectMap, "monitoringIntervalInSeconds", c.MonitoringIntervalInSeconds) + populate(objectMap, "monitoringStatus", c.MonitoringStatus) + populate(objectMap, "notes", c.Notes) + populate(objectMap, "outputs", c.Outputs) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "source", c.Source) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) + populate(objectMap, "testConfigurations", c.TestConfigurations) + populate(objectMap, "testGroups", c.TestGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorResultProperties. +func (c *ConnectionMonitorResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoStart": + err = unpopulate(val, "AutoStart", &c.AutoStart) + delete(rawMsg, key) + case "connectionMonitorType": + err = unpopulate(val, "ConnectionMonitorType", &c.ConnectionMonitorType) + delete(rawMsg, key) + case "destination": + err = unpopulate(val, "Destination", &c.Destination) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &c.Endpoints) + delete(rawMsg, key) + case "monitoringIntervalInSeconds": + err = unpopulate(val, "MonitoringIntervalInSeconds", &c.MonitoringIntervalInSeconds) + delete(rawMsg, key) + case "monitoringStatus": + err = unpopulate(val, "MonitoringStatus", &c.MonitoringStatus) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, "Notes", &c.Notes) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, "Outputs", &c.Outputs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) + delete(rawMsg, key) + case "testConfigurations": + err = unpopulate(val, "TestConfigurations", &c.TestConfigurations) + delete(rawMsg, key) + case "testGroups": + err = unpopulate(val, "TestGroups", &c.TestGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorSource. +func (c ConnectionMonitorSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", c.Port) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorSource. +func (c *ConnectionMonitorSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorSuccessThreshold. +func (c ConnectionMonitorSuccessThreshold) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "checksFailedPercent", c.ChecksFailedPercent) + populate(objectMap, "roundTripTimeMs", c.RoundTripTimeMs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorSuccessThreshold. +func (c *ConnectionMonitorSuccessThreshold) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "checksFailedPercent": + err = unpopulate(val, "ChecksFailedPercent", &c.ChecksFailedPercent) + delete(rawMsg, key) + case "roundTripTimeMs": + err = unpopulate(val, "RoundTripTimeMs", &c.RoundTripTimeMs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorTCPConfiguration. +func (c ConnectionMonitorTCPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationPortBehavior", c.DestinationPortBehavior) + populate(objectMap, "disableTraceRoute", c.DisableTraceRoute) + populate(objectMap, "port", c.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorTCPConfiguration. +func (c *ConnectionMonitorTCPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationPortBehavior": + err = unpopulate(val, "DestinationPortBehavior", &c.DestinationPortBehavior) + delete(rawMsg, key) + case "disableTraceRoute": + err = unpopulate(val, "DisableTraceRoute", &c.DisableTraceRoute) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorTestConfiguration. +func (c ConnectionMonitorTestConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "httpConfiguration", c.HTTPConfiguration) + populate(objectMap, "icmpConfiguration", c.IcmpConfiguration) + populate(objectMap, "name", c.Name) + populate(objectMap, "preferredIPVersion", c.PreferredIPVersion) + populate(objectMap, "protocol", c.Protocol) + populate(objectMap, "successThreshold", c.SuccessThreshold) + populate(objectMap, "tcpConfiguration", c.TCPConfiguration) + populate(objectMap, "testFrequencySec", c.TestFrequencySec) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorTestConfiguration. +func (c *ConnectionMonitorTestConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "httpConfiguration": + err = unpopulate(val, "HTTPConfiguration", &c.HTTPConfiguration) + delete(rawMsg, key) + case "icmpConfiguration": + err = unpopulate(val, "IcmpConfiguration", &c.IcmpConfiguration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "preferredIPVersion": + err = unpopulate(val, "PreferredIPVersion", &c.PreferredIPVersion) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &c.Protocol) + delete(rawMsg, key) + case "successThreshold": + err = unpopulate(val, "SuccessThreshold", &c.SuccessThreshold) + delete(rawMsg, key) + case "tcpConfiguration": + err = unpopulate(val, "TCPConfiguration", &c.TCPConfiguration) + delete(rawMsg, key) + case "testFrequencySec": + err = unpopulate(val, "TestFrequencySec", &c.TestFrequencySec) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorTestGroup. +func (c ConnectionMonitorTestGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinations", c.Destinations) + populate(objectMap, "disable", c.Disable) + populate(objectMap, "name", c.Name) + populate(objectMap, "sources", c.Sources) + populate(objectMap, "testConfigurations", c.TestConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorTestGroup. +func (c *ConnectionMonitorTestGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinations": + err = unpopulate(val, "Destinations", &c.Destinations) + delete(rawMsg, key) + case "disable": + err = unpopulate(val, "Disable", &c.Disable) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &c.Sources) + delete(rawMsg, key) + case "testConfigurations": + err = unpopulate(val, "TestConfigurations", &c.TestConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorWorkspaceSettings. +func (c ConnectionMonitorWorkspaceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "workspaceResourceId", c.WorkspaceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionMonitorWorkspaceSettings. +func (c *ConnectionMonitorWorkspaceSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "workspaceResourceId": + err = unpopulate(val, "WorkspaceResourceID", &c.WorkspaceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionResetSharedKey. +func (c ConnectionResetSharedKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyLength", c.KeyLength) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionResetSharedKey. +func (c *ConnectionResetSharedKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyLength": + err = unpopulate(val, "KeyLength", &c.KeyLength) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionSharedKey. +func (c ConnectionSharedKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionSharedKey. +func (c *ConnectionSharedKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionStateSnapshot. +func (c ConnectionStateSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "avgLatencyInMs", c.AvgLatencyInMs) + populate(objectMap, "connectionState", c.ConnectionState) + populateTimeRFC3339(objectMap, "endTime", c.EndTime) + populate(objectMap, "evaluationState", c.EvaluationState) + populate(objectMap, "hops", c.Hops) + populate(objectMap, "maxLatencyInMs", c.MaxLatencyInMs) + populate(objectMap, "minLatencyInMs", c.MinLatencyInMs) + populate(objectMap, "probesFailed", c.ProbesFailed) + populate(objectMap, "probesSent", c.ProbesSent) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionStateSnapshot. +func (c *ConnectionStateSnapshot) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "avgLatencyInMs": + err = unpopulate(val, "AvgLatencyInMs", &c.AvgLatencyInMs) + delete(rawMsg, key) + case "connectionState": + err = unpopulate(val, "ConnectionState", &c.ConnectionState) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &c.EndTime) + delete(rawMsg, key) + case "evaluationState": + err = unpopulate(val, "EvaluationState", &c.EvaluationState) + delete(rawMsg, key) + case "hops": + err = unpopulate(val, "Hops", &c.Hops) + delete(rawMsg, key) + case "maxLatencyInMs": + err = unpopulate(val, "MaxLatencyInMs", &c.MaxLatencyInMs) + delete(rawMsg, key) + case "minLatencyInMs": + err = unpopulate(val, "MinLatencyInMs", &c.MinLatencyInMs) + delete(rawMsg, key) + case "probesFailed": + err = unpopulate(val, "ProbesFailed", &c.ProbesFailed) + delete(rawMsg, key) + case "probesSent": + err = unpopulate(val, "ProbesSent", &c.ProbesSent) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityConfiguration. +func (c ConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityConfiguration. +func (c *ConnectivityConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityConfigurationListResult. +func (c ConnectivityConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityConfigurationListResult. +func (c *ConnectivityConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityConfigurationProperties. +func (c ConnectivityConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliesToGroups", c.AppliesToGroups) + populate(objectMap, "connectivityTopology", c.ConnectivityTopology) + populate(objectMap, "deleteExistingPeering", c.DeleteExistingPeering) + populate(objectMap, "description", c.Description) + populate(objectMap, "hubs", c.Hubs) + populate(objectMap, "isGlobal", c.IsGlobal) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityConfigurationProperties. +func (c *ConnectivityConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliesToGroups": + err = unpopulate(val, "AppliesToGroups", &c.AppliesToGroups) + delete(rawMsg, key) + case "connectivityTopology": + err = unpopulate(val, "ConnectivityTopology", &c.ConnectivityTopology) + delete(rawMsg, key) + case "deleteExistingPeering": + err = unpopulate(val, "DeleteExistingPeering", &c.DeleteExistingPeering) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "hubs": + err = unpopulate(val, "Hubs", &c.Hubs) + delete(rawMsg, key) + case "isGlobal": + err = unpopulate(val, "IsGlobal", &c.IsGlobal) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityDestination. +func (c ConnectivityDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "port", c.Port) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityDestination. +func (c *ConnectivityDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityGroupItem. +func (c ConnectivityGroupItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupConnectivity", c.GroupConnectivity) + populate(objectMap, "isGlobal", c.IsGlobal) + populate(objectMap, "networkGroupId", c.NetworkGroupID) + populate(objectMap, "useHubGateway", c.UseHubGateway) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityGroupItem. +func (c *ConnectivityGroupItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupConnectivity": + err = unpopulate(val, "GroupConnectivity", &c.GroupConnectivity) + delete(rawMsg, key) + case "isGlobal": + err = unpopulate(val, "IsGlobal", &c.IsGlobal) + delete(rawMsg, key) + case "networkGroupId": + err = unpopulate(val, "NetworkGroupID", &c.NetworkGroupID) + delete(rawMsg, key) + case "useHubGateway": + err = unpopulate(val, "UseHubGateway", &c.UseHubGateway) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityHop. +func (c ConnectivityHop) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "id", c.ID) + populate(objectMap, "issues", c.Issues) + populate(objectMap, "links", c.Links) + populate(objectMap, "nextHopIds", c.NextHopIDs) + populate(objectMap, "previousHopIds", c.PreviousHopIDs) + populate(objectMap, "previousLinks", c.PreviousLinks) + populate(objectMap, "resourceId", c.ResourceID) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityHop. +func (c *ConnectivityHop) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &c.Address) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "issues": + err = unpopulate(val, "Issues", &c.Issues) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &c.Links) + delete(rawMsg, key) + case "nextHopIds": + err = unpopulate(val, "NextHopIDs", &c.NextHopIDs) + delete(rawMsg, key) + case "previousHopIds": + err = unpopulate(val, "PreviousHopIDs", &c.PreviousHopIDs) + delete(rawMsg, key) + case "previousLinks": + err = unpopulate(val, "PreviousLinks", &c.PreviousLinks) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityInformation. +func (c ConnectivityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "avgLatencyInMs", c.AvgLatencyInMs) + populate(objectMap, "connectionStatus", c.ConnectionStatus) + populate(objectMap, "hops", c.Hops) + populate(objectMap, "maxLatencyInMs", c.MaxLatencyInMs) + populate(objectMap, "minLatencyInMs", c.MinLatencyInMs) + populate(objectMap, "probesFailed", c.ProbesFailed) + populate(objectMap, "probesSent", c.ProbesSent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityInformation. +func (c *ConnectivityInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "avgLatencyInMs": + err = unpopulate(val, "AvgLatencyInMs", &c.AvgLatencyInMs) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &c.ConnectionStatus) + delete(rawMsg, key) + case "hops": + err = unpopulate(val, "Hops", &c.Hops) + delete(rawMsg, key) + case "maxLatencyInMs": + err = unpopulate(val, "MaxLatencyInMs", &c.MaxLatencyInMs) + delete(rawMsg, key) + case "minLatencyInMs": + err = unpopulate(val, "MinLatencyInMs", &c.MinLatencyInMs) + delete(rawMsg, key) + case "probesFailed": + err = unpopulate(val, "ProbesFailed", &c.ProbesFailed) + delete(rawMsg, key) + case "probesSent": + err = unpopulate(val, "ProbesSent", &c.ProbesSent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityIssue. +func (c ConnectivityIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "context", c.Context) + populate(objectMap, "origin", c.Origin) + populate(objectMap, "severity", c.Severity) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityIssue. +func (c *ConnectivityIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "context": + err = unpopulate(val, "Context", &c.Context) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &c.Origin) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &c.Severity) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivityParameters. +func (c ConnectivityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "preferredIPVersion", c.PreferredIPVersion) + populate(objectMap, "protocol", c.Protocol) + populate(objectMap, "protocolConfiguration", c.ProtocolConfiguration) + populate(objectMap, "source", c.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityParameters. +func (c *ConnectivityParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + err = unpopulate(val, "Destination", &c.Destination) + delete(rawMsg, key) + case "preferredIPVersion": + err = unpopulate(val, "PreferredIPVersion", &c.PreferredIPVersion) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &c.Protocol) + delete(rawMsg, key) + case "protocolConfiguration": + err = unpopulate(val, "ProtocolConfiguration", &c.ProtocolConfiguration) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectivitySource. +func (c ConnectivitySource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", c.Port) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivitySource. +func (c *ConnectivitySource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Container. +func (c *Container) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterface. +func (c ContainerNetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterface. +func (c *ContainerNetworkInterface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterfaceConfiguration. +func (c ContainerNetworkInterfaceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterfaceConfiguration. +func (c *ContainerNetworkInterfaceConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterfaceConfigurationPropertiesFormat. +func (c ContainerNetworkInterfaceConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerNetworkInterfaces", c.ContainerNetworkInterfaces) + populate(objectMap, "ipConfigurations", c.IPConfigurations) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterfaceConfigurationPropertiesFormat. +func (c *ContainerNetworkInterfaceConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containerNetworkInterfaces": + err = unpopulate(val, "ContainerNetworkInterfaces", &c.ContainerNetworkInterfaces) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &c.IPConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterfaceIPConfiguration. +func (c ContainerNetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterfaceIPConfiguration. +func (c *ContainerNetworkInterfaceIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterfaceIPConfigurationPropertiesFormat. +func (c ContainerNetworkInterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterfaceIPConfigurationPropertiesFormat. +func (c *ContainerNetworkInterfaceIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerNetworkInterfacePropertiesFormat. +func (c ContainerNetworkInterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "container", c.Container) + populate(objectMap, "containerNetworkInterfaceConfiguration", c.ContainerNetworkInterfaceConfiguration) + populate(objectMap, "ipConfigurations", c.IPConfigurations) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerNetworkInterfacePropertiesFormat. +func (c *ContainerNetworkInterfacePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "container": + err = unpopulate(val, "Container", &c.Container) + delete(rawMsg, key) + case "containerNetworkInterfaceConfiguration": + err = unpopulate(val, "ContainerNetworkInterfaceConfiguration", &c.ContainerNetworkInterfaceConfiguration) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &c.IPConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Criterion. +func (c Criterion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asPath", c.AsPath) + populate(objectMap, "community", c.Community) + populate(objectMap, "matchCondition", c.MatchCondition) + populate(objectMap, "routePrefix", c.RoutePrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Criterion. +func (c *Criterion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asPath": + err = unpopulate(val, "AsPath", &c.AsPath) + delete(rawMsg, key) + case "community": + err = unpopulate(val, "Community", &c.Community) + delete(rawMsg, key) + case "matchCondition": + err = unpopulate(val, "MatchCondition", &c.MatchCondition) + delete(rawMsg, key) + case "routePrefix": + err = unpopulate(val, "RoutePrefix", &c.RoutePrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CrossTenantScopes. +func (c CrossTenantScopes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managementGroups", c.ManagementGroups) + populate(objectMap, "subscriptions", c.Subscriptions) + populate(objectMap, "tenantId", c.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossTenantScopes. +func (c *CrossTenantScopes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "managementGroups": + err = unpopulate(val, "ManagementGroups", &c.ManagementGroups) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &c.Subscriptions) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomDNSConfigPropertiesFormat. +func (c CustomDNSConfigPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdn", c.Fqdn) + populate(objectMap, "ipAddresses", c.IPAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDNSConfigPropertiesFormat. +func (c *CustomDNSConfigPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &c.Fqdn) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &c.IPAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomIPPrefix. +func (c CustomIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "extendedLocation", c.ExtendedLocation) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomIPPrefix. +func (c *CustomIPPrefix) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &c.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomIPPrefixListResult. +func (c CustomIPPrefixListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomIPPrefixListResult. +func (c *CustomIPPrefixListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomIPPrefixPropertiesFormat. +func (c CustomIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", c.Asn) + populate(objectMap, "authorizationMessage", c.AuthorizationMessage) + populate(objectMap, "childCustomIpPrefixes", c.ChildCustomIPPrefixes) + populate(objectMap, "cidr", c.Cidr) + populate(objectMap, "commissionedState", c.CommissionedState) + populate(objectMap, "customIpPrefixParent", c.CustomIPPrefixParent) + populate(objectMap, "expressRouteAdvertise", c.ExpressRouteAdvertise) + populate(objectMap, "failedReason", c.FailedReason) + populate(objectMap, "geo", c.Geo) + populate(objectMap, "noInternetAdvertise", c.NoInternetAdvertise) + populate(objectMap, "prefixType", c.PrefixType) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publicIpPrefixes", c.PublicIPPrefixes) + populate(objectMap, "resourceGuid", c.ResourceGUID) + populate(objectMap, "signedMessage", c.SignedMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomIPPrefixPropertiesFormat. +func (c *CustomIPPrefixPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &c.Asn) + delete(rawMsg, key) + case "authorizationMessage": + err = unpopulate(val, "AuthorizationMessage", &c.AuthorizationMessage) + delete(rawMsg, key) + case "childCustomIpPrefixes": + err = unpopulate(val, "ChildCustomIPPrefixes", &c.ChildCustomIPPrefixes) + delete(rawMsg, key) + case "cidr": + err = unpopulate(val, "Cidr", &c.Cidr) + delete(rawMsg, key) + case "commissionedState": + err = unpopulate(val, "CommissionedState", &c.CommissionedState) + delete(rawMsg, key) + case "customIpPrefixParent": + err = unpopulate(val, "CustomIPPrefixParent", &c.CustomIPPrefixParent) + delete(rawMsg, key) + case "expressRouteAdvertise": + err = unpopulate(val, "ExpressRouteAdvertise", &c.ExpressRouteAdvertise) + delete(rawMsg, key) + case "failedReason": + err = unpopulate(val, "FailedReason", &c.FailedReason) + delete(rawMsg, key) + case "geo": + err = unpopulate(val, "Geo", &c.Geo) + delete(rawMsg, key) + case "noInternetAdvertise": + err = unpopulate(val, "NoInternetAdvertise", &c.NoInternetAdvertise) + delete(rawMsg, key) + case "prefixType": + err = unpopulate(val, "PrefixType", &c.PrefixType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publicIpPrefixes": + err = unpopulate(val, "PublicIPPrefixes", &c.PublicIPPrefixes) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &c.ResourceGUID) + delete(rawMsg, key) + case "signedMessage": + err = unpopulate(val, "SignedMessage", &c.SignedMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSNameAvailabilityResult. +func (d DNSNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "available", d.Available) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSNameAvailabilityResult. +func (d *DNSNameAvailabilityResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "available": + err = unpopulate(val, "Available", &d.Available) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSSettings. +func (d DNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableProxy", d.EnableProxy) + populate(objectMap, "requireProxyForNetworkRules", d.RequireProxyForNetworkRules) + populate(objectMap, "servers", d.Servers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSSettings. +func (d *DNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableProxy": + err = unpopulate(val, "EnableProxy", &d.EnableProxy) + delete(rawMsg, key) + case "requireProxyForNetworkRules": + err = unpopulate(val, "RequireProxyForNetworkRules", &d.RequireProxyForNetworkRules) + delete(rawMsg, key) + case "servers": + err = unpopulate(val, "Servers", &d.Servers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosCustomPolicy. +func (d DdosCustomPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosCustomPolicy. +func (d *DdosCustomPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosCustomPolicyPropertiesFormat. +func (d DdosCustomPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "resourceGuid", d.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosCustomPolicyPropertiesFormat. +func (d *DdosCustomPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &d.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosProtectionPlan. +func (d DdosProtectionPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosProtectionPlan. +func (d *DdosProtectionPlan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosProtectionPlanListResult. +func (d DdosProtectionPlanListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosProtectionPlanListResult. +func (d *DdosProtectionPlanListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosProtectionPlanPropertiesFormat. +func (d DdosProtectionPlanPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicIpAddresses", d.PublicIPAddresses) + populate(objectMap, "resourceGuid", d.ResourceGUID) + populate(objectMap, "virtualNetworks", d.VirtualNetworks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosProtectionPlanPropertiesFormat. +func (d *DdosProtectionPlanPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publicIpAddresses": + err = unpopulate(val, "PublicIPAddresses", &d.PublicIPAddresses) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &d.ResourceGUID) + delete(rawMsg, key) + case "virtualNetworks": + err = unpopulate(val, "VirtualNetworks", &d.VirtualNetworks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DdosSettings. +func (d DdosSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ddosProtectionPlan", d.DdosProtectionPlan) + populate(objectMap, "protectionMode", d.ProtectionMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DdosSettings. +func (d *DdosSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ddosProtectionPlan": + err = unpopulate(val, "DdosProtectionPlan", &d.DdosProtectionPlan) + delete(rawMsg, key) + case "protectionMode": + err = unpopulate(val, "ProtectionMode", &d.ProtectionMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultAdminPropertiesFormat. +func (d DefaultAdminPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", d.Access) + populate(objectMap, "description", d.Description) + populate(objectMap, "destinationPortRanges", d.DestinationPortRanges) + populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "direction", d.Direction) + populate(objectMap, "flag", d.Flag) + populate(objectMap, "priority", d.Priority) + populate(objectMap, "protocol", d.Protocol) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "sourcePortRanges", d.SourcePortRanges) + populate(objectMap, "sources", d.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultAdminPropertiesFormat. +func (d *DefaultAdminPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &d.Access) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &d.DestinationPortRanges) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &d.Destinations) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &d.Direction) + delete(rawMsg, key) + case "flag": + err = unpopulate(val, "Flag", &d.Flag) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &d.Priority) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &d.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &d.SourcePortRanges) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &d.Sources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultAdminRule. +func (d DefaultAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + objectMap["kind"] = AdminRuleKindDefault + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultAdminRule. +func (d *DefaultAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DefaultRuleSetPropertyFormat. +func (d DefaultRuleSetPropertyFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleSetType", d.RuleSetType) + populate(objectMap, "ruleSetVersion", d.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultRuleSetPropertyFormat. +func (d *DefaultRuleSetPropertyFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &d.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &d.RuleSetVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Delegation. +func (d Delegation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Delegation. +func (d *Delegation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeviceProperties. +func (d DeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceModel", d.DeviceModel) + populate(objectMap, "deviceVendor", d.DeviceVendor) + populate(objectMap, "linkSpeedInMbps", d.LinkSpeedInMbps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceProperties. +func (d *DeviceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceModel": + err = unpopulate(val, "DeviceModel", &d.DeviceModel) + delete(rawMsg, key) + case "deviceVendor": + err = unpopulate(val, "DeviceVendor", &d.DeviceVendor) + delete(rawMsg, key) + case "linkSpeedInMbps": + err = unpopulate(val, "LinkSpeedInMbps", &d.LinkSpeedInMbps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DhcpOptions. +func (d DhcpOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsServers", d.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DhcpOptions. +func (d *DhcpOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &d.DNSServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "internalName", d.InternalName) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. +func (d *Dimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "internalName": + err = unpopulate(val, "InternalName", &d.InternalName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DscpConfiguration. +func (d DscpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DscpConfiguration. +func (d *DscpConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DscpConfigurationListResult. +func (d DscpConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DscpConfigurationListResult. +func (d *DscpConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DscpConfigurationPropertiesFormat. +func (d DscpConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associatedNetworkInterfaces", d.AssociatedNetworkInterfaces) + populate(objectMap, "destinationIpRanges", d.DestinationIPRanges) + populate(objectMap, "destinationPortRanges", d.DestinationPortRanges) + populate(objectMap, "markings", d.Markings) + populate(objectMap, "protocol", d.Protocol) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "qosCollectionId", d.QosCollectionID) + populate(objectMap, "qosDefinitionCollection", d.QosDefinitionCollection) + populate(objectMap, "resourceGuid", d.ResourceGUID) + populate(objectMap, "sourceIpRanges", d.SourceIPRanges) + populate(objectMap, "sourcePortRanges", d.SourcePortRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DscpConfigurationPropertiesFormat. +func (d *DscpConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associatedNetworkInterfaces": + err = unpopulate(val, "AssociatedNetworkInterfaces", &d.AssociatedNetworkInterfaces) + delete(rawMsg, key) + case "destinationIpRanges": + err = unpopulate(val, "DestinationIPRanges", &d.DestinationIPRanges) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &d.DestinationPortRanges) + delete(rawMsg, key) + case "markings": + err = unpopulate(val, "Markings", &d.Markings) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &d.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "qosCollectionId": + err = unpopulate(val, "QosCollectionID", &d.QosCollectionID) + delete(rawMsg, key) + case "qosDefinitionCollection": + err = unpopulate(val, "QosDefinitionCollection", &d.QosDefinitionCollection) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &d.ResourceGUID) + delete(rawMsg, key) + case "sourceIpRanges": + err = unpopulate(val, "SourceIPRanges", &d.SourceIPRanges) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &d.SourcePortRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveBaseSecurityAdminRule. +func (e EffectiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationDescription", e.ConfigurationDescription) + populate(objectMap, "id", e.ID) + objectMap["kind"] = e.Kind + populate(objectMap, "ruleCollectionAppliesToGroups", e.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", e.RuleCollectionDescription) + populate(objectMap, "ruleGroups", e.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveBaseSecurityAdminRule. +func (e *EffectiveBaseSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &e.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &e.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &e.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &e.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveConnectivityConfiguration. +func (e EffectiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationGroups", e.ConfigurationGroups) + populate(objectMap, "id", e.ID) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveConnectivityConfiguration. +func (e *EffectiveConnectivityConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationGroups": + err = unpopulate(val, "ConfigurationGroups", &e.ConfigurationGroups) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveDefaultSecurityAdminRule. +func (e EffectiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationDescription", e.ConfigurationDescription) + populate(objectMap, "id", e.ID) + objectMap["kind"] = EffectiveAdminRuleKindDefault + populate(objectMap, "properties", e.Properties) + populate(objectMap, "ruleCollectionAppliesToGroups", e.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", e.RuleCollectionDescription) + populate(objectMap, "ruleGroups", e.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveDefaultSecurityAdminRule. +func (e *EffectiveDefaultSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &e.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &e.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &e.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &e.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityGroup. +func (e EffectiveNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "association", e.Association) + populate(objectMap, "effectiveSecurityRules", e.EffectiveSecurityRules) + populate(objectMap, "networkSecurityGroup", e.NetworkSecurityGroup) + populate(objectMap, "tagMap", e.TagMap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveNetworkSecurityGroup. +func (e *EffectiveNetworkSecurityGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "association": + err = unpopulate(val, "Association", &e.Association) + delete(rawMsg, key) + case "effectiveSecurityRules": + err = unpopulate(val, "EffectiveSecurityRules", &e.EffectiveSecurityRules) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &e.NetworkSecurityGroup) + delete(rawMsg, key) + case "tagMap": + err = unpopulate(val, "TagMap", &e.TagMap) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityGroupAssociation. +func (e EffectiveNetworkSecurityGroupAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterface", e.NetworkInterface) + populate(objectMap, "networkManager", e.NetworkManager) + populate(objectMap, "subnet", e.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveNetworkSecurityGroupAssociation. +func (e *EffectiveNetworkSecurityGroupAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterface": + err = unpopulate(val, "NetworkInterface", &e.NetworkInterface) + delete(rawMsg, key) + case "networkManager": + err = unpopulate(val, "NetworkManager", &e.NetworkManager) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &e.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityGroupListResult. +func (e EffectiveNetworkSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveNetworkSecurityGroupListResult. +func (e *EffectiveNetworkSecurityGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityRule. +func (e EffectiveNetworkSecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", e.Access) + populate(objectMap, "destinationAddressPrefix", e.DestinationAddressPrefix) + populate(objectMap, "destinationAddressPrefixes", e.DestinationAddressPrefixes) + populate(objectMap, "destinationPortRange", e.DestinationPortRange) + populate(objectMap, "destinationPortRanges", e.DestinationPortRanges) + populate(objectMap, "direction", e.Direction) + populate(objectMap, "expandedDestinationAddressPrefix", e.ExpandedDestinationAddressPrefix) + populate(objectMap, "expandedSourceAddressPrefix", e.ExpandedSourceAddressPrefix) + populate(objectMap, "name", e.Name) + populate(objectMap, "priority", e.Priority) + populate(objectMap, "protocol", e.Protocol) + populate(objectMap, "sourceAddressPrefix", e.SourceAddressPrefix) + populate(objectMap, "sourceAddressPrefixes", e.SourceAddressPrefixes) + populate(objectMap, "sourcePortRange", e.SourcePortRange) + populate(objectMap, "sourcePortRanges", e.SourcePortRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveNetworkSecurityRule. +func (e *EffectiveNetworkSecurityRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &e.Access) + delete(rawMsg, key) + case "destinationAddressPrefix": + err = unpopulate(val, "DestinationAddressPrefix", &e.DestinationAddressPrefix) + delete(rawMsg, key) + case "destinationAddressPrefixes": + err = unpopulate(val, "DestinationAddressPrefixes", &e.DestinationAddressPrefixes) + delete(rawMsg, key) + case "destinationPortRange": + err = unpopulate(val, "DestinationPortRange", &e.DestinationPortRange) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &e.DestinationPortRanges) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &e.Direction) + delete(rawMsg, key) + case "expandedDestinationAddressPrefix": + err = unpopulate(val, "ExpandedDestinationAddressPrefix", &e.ExpandedDestinationAddressPrefix) + delete(rawMsg, key) + case "expandedSourceAddressPrefix": + err = unpopulate(val, "ExpandedSourceAddressPrefix", &e.ExpandedSourceAddressPrefix) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &e.Priority) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &e.Protocol) + delete(rawMsg, key) + case "sourceAddressPrefix": + err = unpopulate(val, "SourceAddressPrefix", &e.SourceAddressPrefix) + delete(rawMsg, key) + case "sourceAddressPrefixes": + err = unpopulate(val, "SourceAddressPrefixes", &e.SourceAddressPrefixes) + delete(rawMsg, key) + case "sourcePortRange": + err = unpopulate(val, "SourcePortRange", &e.SourcePortRange) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &e.SourcePortRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveRoute. +func (e EffectiveRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", e.AddressPrefix) + populate(objectMap, "disableBgpRoutePropagation", e.DisableBgpRoutePropagation) + populate(objectMap, "name", e.Name) + populate(objectMap, "nextHopIpAddress", e.NextHopIPAddress) + populate(objectMap, "nextHopType", e.NextHopType) + populate(objectMap, "source", e.Source) + populate(objectMap, "state", e.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveRoute. +func (e *EffectiveRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &e.AddressPrefix) + delete(rawMsg, key) + case "disableBgpRoutePropagation": + err = unpopulate(val, "DisableBgpRoutePropagation", &e.DisableBgpRoutePropagation) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &e.NextHopIPAddress) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &e.NextHopType) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &e.Source) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveRouteListResult. +func (e EffectiveRouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveRouteListResult. +func (e *EffectiveRouteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveRouteMapRoute. +func (e EffectiveRouteMapRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asPath", e.AsPath) + populate(objectMap, "bgpCommunities", e.BgpCommunities) + populate(objectMap, "prefix", e.Prefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveRouteMapRoute. +func (e *EffectiveRouteMapRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asPath": + err = unpopulate(val, "AsPath", &e.AsPath) + delete(rawMsg, key) + case "bgpCommunities": + err = unpopulate(val, "BgpCommunities", &e.BgpCommunities) + delete(rawMsg, key) + case "prefix": + err = unpopulate(val, "Prefix", &e.Prefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveRoutesParameters. +func (e EffectiveRoutesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceId", e.ResourceID) + populate(objectMap, "virtualWanResourceType", e.VirtualWanResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveRoutesParameters. +func (e *EffectiveRoutesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) + delete(rawMsg, key) + case "virtualWanResourceType": + err = unpopulate(val, "VirtualWanResourceType", &e.VirtualWanResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveSecurityAdminRule. +func (e EffectiveSecurityAdminRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationDescription", e.ConfigurationDescription) + populate(objectMap, "id", e.ID) + objectMap["kind"] = EffectiveAdminRuleKindCustom + populate(objectMap, "properties", e.Properties) + populate(objectMap, "ruleCollectionAppliesToGroups", e.RuleCollectionAppliesToGroups) + populate(objectMap, "ruleCollectionDescription", e.RuleCollectionDescription) + populate(objectMap, "ruleGroups", e.RuleGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveSecurityAdminRule. +func (e *EffectiveSecurityAdminRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationDescription": + err = unpopulate(val, "ConfigurationDescription", &e.ConfigurationDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "ruleCollectionAppliesToGroups": + err = unpopulate(val, "RuleCollectionAppliesToGroups", &e.RuleCollectionAppliesToGroups) + delete(rawMsg, key) + case "ruleCollectionDescription": + err = unpopulate(val, "RuleCollectionDescription", &e.RuleCollectionDescription) + delete(rawMsg, key) + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &e.RuleGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointServiceResult. +func (e EndpointServiceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointServiceResult. +func (e *EndpointServiceResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointServicesListResult. +func (e EndpointServicesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointServicesListResult. +func (e *EndpointServicesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "innerError", e.InnerError) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "innerError": + err = unpopulate(val, "InnerError", &e.InnerError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EvaluatedNetworkSecurityGroup. +func (e EvaluatedNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedTo", e.AppliedTo) + populate(objectMap, "matchedRule", e.MatchedRule) + populate(objectMap, "networkSecurityGroupId", e.NetworkSecurityGroupID) + populate(objectMap, "rulesEvaluationResult", e.RulesEvaluationResult) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EvaluatedNetworkSecurityGroup. +func (e *EvaluatedNetworkSecurityGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedTo": + err = unpopulate(val, "AppliedTo", &e.AppliedTo) + delete(rawMsg, key) + case "matchedRule": + err = unpopulate(val, "MatchedRule", &e.MatchedRule) + delete(rawMsg, key) + case "networkSecurityGroupId": + err = unpopulate(val, "NetworkSecurityGroupID", &e.NetworkSecurityGroupID) + delete(rawMsg, key) + case "rulesEvaluationResult": + err = unpopulate(val, "RulesEvaluationResult", &e.RulesEvaluationResult) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExclusionManagedRule. +func (e ExclusionManagedRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleId", e.RuleID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExclusionManagedRule. +func (e *ExclusionManagedRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleId": + err = unpopulate(val, "RuleID", &e.RuleID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExclusionManagedRuleGroup. +func (e ExclusionManagedRuleGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroupName", e.RuleGroupName) + populate(objectMap, "rules", e.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExclusionManagedRuleGroup. +func (e *ExclusionManagedRuleGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &e.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &e.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExclusionManagedRuleSet. +func (e ExclusionManagedRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroups", e.RuleGroups) + populate(objectMap, "ruleSetType", e.RuleSetType) + populate(objectMap, "ruleSetVersion", e.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExclusionManagedRuleSet. +func (e *ExclusionManagedRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroups": + err = unpopulate(val, "RuleGroups", &e.RuleGroups) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &e.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &e.RuleSetVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExplicitProxySettings. +func (e ExplicitProxySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableExplicitProxy", e.EnableExplicitProxy) + populate(objectMap, "enablePacFile", e.EnablePacFile) + populate(objectMap, "httpPort", e.HTTPPort) + populate(objectMap, "httpsPort", e.HTTPSPort) + populate(objectMap, "pacFile", e.PacFile) + populate(objectMap, "pacFilePort", e.PacFilePort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExplicitProxySettings. +func (e *ExplicitProxySettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableExplicitProxy": + err = unpopulate(val, "EnableExplicitProxy", &e.EnableExplicitProxy) + delete(rawMsg, key) + case "enablePacFile": + err = unpopulate(val, "EnablePacFile", &e.EnablePacFile) + delete(rawMsg, key) + case "httpPort": + err = unpopulate(val, "HTTPPort", &e.HTTPPort) + delete(rawMsg, key) + case "httpsPort": + err = unpopulate(val, "HTTPSPort", &e.HTTPSPort) + delete(rawMsg, key) + case "pacFile": + err = unpopulate(val, "PacFile", &e.PacFile) + delete(rawMsg, key) + case "pacFilePort": + err = unpopulate(val, "PacFilePort", &e.PacFilePort) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuit. +func (e ExpressRouteCircuit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "sku", e.SKU) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuit. +func (e *ExpressRouteCircuit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &e.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitArpTable. +func (e ExpressRouteCircuitArpTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "age", e.Age) + populate(objectMap, "ipAddress", e.IPAddress) + populate(objectMap, "interface", e.Interface) + populate(objectMap, "macAddress", e.MacAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitArpTable. +func (e *ExpressRouteCircuitArpTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &e.IPAddress) + delete(rawMsg, key) + case "interface": + err = unpopulate(val, "Interface", &e.Interface) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &e.MacAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitAuthorization. +func (e ExpressRouteCircuitAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitAuthorization. +func (e *ExpressRouteCircuitAuthorization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitConnection. +func (e ExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitConnection. +func (e *ExpressRouteCircuitConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitConnectionListResult. +func (e ExpressRouteCircuitConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitConnectionListResult. +func (e *ExpressRouteCircuitConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitConnectionPropertiesFormat. +func (e ExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", e.AddressPrefix) + populate(objectMap, "authorizationKey", e.AuthorizationKey) + populate(objectMap, "circuitConnectionStatus", e.CircuitConnectionStatus) + populate(objectMap, "expressRouteCircuitPeering", e.ExpressRouteCircuitPeering) + populate(objectMap, "ipv6CircuitConnectionConfig", e.IPv6CircuitConnectionConfig) + populate(objectMap, "peerExpressRouteCircuitPeering", e.PeerExpressRouteCircuitPeering) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitConnectionPropertiesFormat. +func (e *ExpressRouteCircuitConnectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &e.AddressPrefix) + delete(rawMsg, key) + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &e.AuthorizationKey) + delete(rawMsg, key) + case "circuitConnectionStatus": + err = unpopulate(val, "CircuitConnectionStatus", &e.CircuitConnectionStatus) + delete(rawMsg, key) + case "expressRouteCircuitPeering": + err = unpopulate(val, "ExpressRouteCircuitPeering", &e.ExpressRouteCircuitPeering) + delete(rawMsg, key) + case "ipv6CircuitConnectionConfig": + err = unpopulate(val, "IPv6CircuitConnectionConfig", &e.IPv6CircuitConnectionConfig) + delete(rawMsg, key) + case "peerExpressRouteCircuitPeering": + err = unpopulate(val, "PeerExpressRouteCircuitPeering", &e.PeerExpressRouteCircuitPeering) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitListResult. +func (e ExpressRouteCircuitListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitListResult. +func (e *ExpressRouteCircuitListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPeering. +func (e ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPeering. +func (e *ExpressRouteCircuitPeering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPeeringConfig. +func (e ExpressRouteCircuitPeeringConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "advertisedCommunities", e.AdvertisedCommunities) + populate(objectMap, "advertisedPublicPrefixes", e.AdvertisedPublicPrefixes) + populate(objectMap, "advertisedPublicPrefixesState", e.AdvertisedPublicPrefixesState) + populate(objectMap, "customerASN", e.CustomerASN) + populate(objectMap, "legacyMode", e.LegacyMode) + populate(objectMap, "routingRegistryName", e.RoutingRegistryName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPeeringConfig. +func (e *ExpressRouteCircuitPeeringConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "advertisedCommunities": + err = unpopulate(val, "AdvertisedCommunities", &e.AdvertisedCommunities) + delete(rawMsg, key) + case "advertisedPublicPrefixes": + err = unpopulate(val, "AdvertisedPublicPrefixes", &e.AdvertisedPublicPrefixes) + delete(rawMsg, key) + case "advertisedPublicPrefixesState": + err = unpopulate(val, "AdvertisedPublicPrefixesState", &e.AdvertisedPublicPrefixesState) + delete(rawMsg, key) + case "customerASN": + err = unpopulate(val, "CustomerASN", &e.CustomerASN) + delete(rawMsg, key) + case "legacyMode": + err = unpopulate(val, "LegacyMode", &e.LegacyMode) + delete(rawMsg, key) + case "routingRegistryName": + err = unpopulate(val, "RoutingRegistryName", &e.RoutingRegistryName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPeeringID. +func (e ExpressRouteCircuitPeeringID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPeeringID. +func (e *ExpressRouteCircuitPeeringID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPeeringListResult. +func (e ExpressRouteCircuitPeeringListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPeeringListResult. +func (e *ExpressRouteCircuitPeeringListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPeeringPropertiesFormat. +func (e ExpressRouteCircuitPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureASN", e.AzureASN) + populate(objectMap, "connections", e.Connections) + populate(objectMap, "expressRouteConnection", e.ExpressRouteConnection) + populate(objectMap, "gatewayManagerEtag", e.GatewayManagerEtag) + populate(objectMap, "ipv6PeeringConfig", e.IPv6PeeringConfig) + populate(objectMap, "lastModifiedBy", e.LastModifiedBy) + populate(objectMap, "microsoftPeeringConfig", e.MicrosoftPeeringConfig) + populate(objectMap, "peerASN", e.PeerASN) + populate(objectMap, "peeredConnections", e.PeeredConnections) + populate(objectMap, "peeringType", e.PeeringType) + populate(objectMap, "primaryAzurePort", e.PrimaryAzurePort) + populate(objectMap, "primaryPeerAddressPrefix", e.PrimaryPeerAddressPrefix) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "routeFilter", e.RouteFilter) + populate(objectMap, "secondaryAzurePort", e.SecondaryAzurePort) + populate(objectMap, "secondaryPeerAddressPrefix", e.SecondaryPeerAddressPrefix) + populate(objectMap, "sharedKey", e.SharedKey) + populate(objectMap, "state", e.State) + populate(objectMap, "stats", e.Stats) + populate(objectMap, "vlanId", e.VlanID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPeeringPropertiesFormat. +func (e *ExpressRouteCircuitPeeringPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureASN": + err = unpopulate(val, "AzureASN", &e.AzureASN) + delete(rawMsg, key) + case "connections": + err = unpopulate(val, "Connections", &e.Connections) + delete(rawMsg, key) + case "expressRouteConnection": + err = unpopulate(val, "ExpressRouteConnection", &e.ExpressRouteConnection) + delete(rawMsg, key) + case "gatewayManagerEtag": + err = unpopulate(val, "GatewayManagerEtag", &e.GatewayManagerEtag) + delete(rawMsg, key) + case "ipv6PeeringConfig": + err = unpopulate(val, "IPv6PeeringConfig", &e.IPv6PeeringConfig) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) + delete(rawMsg, key) + case "microsoftPeeringConfig": + err = unpopulate(val, "MicrosoftPeeringConfig", &e.MicrosoftPeeringConfig) + delete(rawMsg, key) + case "peerASN": + err = unpopulate(val, "PeerASN", &e.PeerASN) + delete(rawMsg, key) + case "peeredConnections": + err = unpopulate(val, "PeeredConnections", &e.PeeredConnections) + delete(rawMsg, key) + case "peeringType": + err = unpopulate(val, "PeeringType", &e.PeeringType) + delete(rawMsg, key) + case "primaryAzurePort": + err = unpopulate(val, "PrimaryAzurePort", &e.PrimaryAzurePort) + delete(rawMsg, key) + case "primaryPeerAddressPrefix": + err = unpopulate(val, "PrimaryPeerAddressPrefix", &e.PrimaryPeerAddressPrefix) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "routeFilter": + err = unpopulate(val, "RouteFilter", &e.RouteFilter) + delete(rawMsg, key) + case "secondaryAzurePort": + err = unpopulate(val, "SecondaryAzurePort", &e.SecondaryAzurePort) + delete(rawMsg, key) + case "secondaryPeerAddressPrefix": + err = unpopulate(val, "SecondaryPeerAddressPrefix", &e.SecondaryPeerAddressPrefix) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &e.SharedKey) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + case "stats": + err = unpopulate(val, "Stats", &e.Stats) + delete(rawMsg, key) + case "vlanId": + err = unpopulate(val, "VlanID", &e.VlanID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitPropertiesFormat. +func (e ExpressRouteCircuitPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowClassicOperations", e.AllowClassicOperations) + populate(objectMap, "authorizationKey", e.AuthorizationKey) + populate(objectMap, "authorizations", e.Authorizations) + populate(objectMap, "bandwidthInGbps", e.BandwidthInGbps) + populate(objectMap, "circuitProvisioningState", e.CircuitProvisioningState) + populate(objectMap, "expressRoutePort", e.ExpressRoutePort) + populate(objectMap, "gatewayManagerEtag", e.GatewayManagerEtag) + populate(objectMap, "globalReachEnabled", e.GlobalReachEnabled) + populate(objectMap, "peerings", e.Peerings) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "serviceKey", e.ServiceKey) + populate(objectMap, "serviceProviderNotes", e.ServiceProviderNotes) + populate(objectMap, "serviceProviderProperties", e.ServiceProviderProperties) + populate(objectMap, "serviceProviderProvisioningState", e.ServiceProviderProvisioningState) + populate(objectMap, "stag", e.Stag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitPropertiesFormat. +func (e *ExpressRouteCircuitPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowClassicOperations": + err = unpopulate(val, "AllowClassicOperations", &e.AllowClassicOperations) + delete(rawMsg, key) + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &e.AuthorizationKey) + delete(rawMsg, key) + case "authorizations": + err = unpopulate(val, "Authorizations", &e.Authorizations) + delete(rawMsg, key) + case "bandwidthInGbps": + err = unpopulate(val, "BandwidthInGbps", &e.BandwidthInGbps) + delete(rawMsg, key) + case "circuitProvisioningState": + err = unpopulate(val, "CircuitProvisioningState", &e.CircuitProvisioningState) + delete(rawMsg, key) + case "expressRoutePort": + err = unpopulate(val, "ExpressRoutePort", &e.ExpressRoutePort) + delete(rawMsg, key) + case "gatewayManagerEtag": + err = unpopulate(val, "GatewayManagerEtag", &e.GatewayManagerEtag) + delete(rawMsg, key) + case "globalReachEnabled": + err = unpopulate(val, "GlobalReachEnabled", &e.GlobalReachEnabled) + delete(rawMsg, key) + case "peerings": + err = unpopulate(val, "Peerings", &e.Peerings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "serviceKey": + err = unpopulate(val, "ServiceKey", &e.ServiceKey) + delete(rawMsg, key) + case "serviceProviderNotes": + err = unpopulate(val, "ServiceProviderNotes", &e.ServiceProviderNotes) + delete(rawMsg, key) + case "serviceProviderProperties": + err = unpopulate(val, "ServiceProviderProperties", &e.ServiceProviderProperties) + delete(rawMsg, key) + case "serviceProviderProvisioningState": + err = unpopulate(val, "ServiceProviderProvisioningState", &e.ServiceProviderProvisioningState) + delete(rawMsg, key) + case "stag": + err = unpopulate(val, "Stag", &e.Stag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitReference. +func (e ExpressRouteCircuitReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitReference. +func (e *ExpressRouteCircuitReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitRoutesTable. +func (e ExpressRouteCircuitRoutesTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "locPrf", e.LocPrf) + populate(objectMap, "network", e.Network) + populate(objectMap, "nextHop", e.NextHop) + populate(objectMap, "path", e.Path) + populate(objectMap, "weight", e.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitRoutesTable. +func (e *ExpressRouteCircuitRoutesTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locPrf": + err = unpopulate(val, "LocPrf", &e.LocPrf) + delete(rawMsg, key) + case "network": + err = unpopulate(val, "Network", &e.Network) + delete(rawMsg, key) + case "nextHop": + err = unpopulate(val, "NextHop", &e.NextHop) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &e.Path) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &e.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitRoutesTableSummary. +func (e ExpressRouteCircuitRoutesTableSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "as", e.As) + populate(objectMap, "neighbor", e.Neighbor) + populate(objectMap, "statePfxRcd", e.StatePfxRcd) + populate(objectMap, "upDown", e.UpDown) + populate(objectMap, "v", e.V) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitRoutesTableSummary. +func (e *ExpressRouteCircuitRoutesTableSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "as": + err = unpopulate(val, "As", &e.As) + delete(rawMsg, key) + case "neighbor": + err = unpopulate(val, "Neighbor", &e.Neighbor) + delete(rawMsg, key) + case "statePfxRcd": + err = unpopulate(val, "StatePfxRcd", &e.StatePfxRcd) + delete(rawMsg, key) + case "upDown": + err = unpopulate(val, "UpDown", &e.UpDown) + delete(rawMsg, key) + case "v": + err = unpopulate(val, "V", &e.V) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitSKU. +func (e ExpressRouteCircuitSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "family", e.Family) + populate(objectMap, "name", e.Name) + populate(objectMap, "tier", e.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitSKU. +func (e *ExpressRouteCircuitSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "family": + err = unpopulate(val, "Family", &e.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &e.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitServiceProviderProperties. +func (e ExpressRouteCircuitServiceProviderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bandwidthInMbps", e.BandwidthInMbps) + populate(objectMap, "peeringLocation", e.PeeringLocation) + populate(objectMap, "serviceProviderName", e.ServiceProviderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitServiceProviderProperties. +func (e *ExpressRouteCircuitServiceProviderProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bandwidthInMbps": + err = unpopulate(val, "BandwidthInMbps", &e.BandwidthInMbps) + delete(rawMsg, key) + case "peeringLocation": + err = unpopulate(val, "PeeringLocation", &e.PeeringLocation) + delete(rawMsg, key) + case "serviceProviderName": + err = unpopulate(val, "ServiceProviderName", &e.ServiceProviderName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitStats. +func (e ExpressRouteCircuitStats) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "primarybytesIn", e.PrimarybytesIn) + populate(objectMap, "primarybytesOut", e.PrimarybytesOut) + populate(objectMap, "secondarybytesIn", e.SecondarybytesIn) + populate(objectMap, "secondarybytesOut", e.SecondarybytesOut) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitStats. +func (e *ExpressRouteCircuitStats) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primarybytesIn": + err = unpopulate(val, "PrimarybytesIn", &e.PrimarybytesIn) + delete(rawMsg, key) + case "primarybytesOut": + err = unpopulate(val, "PrimarybytesOut", &e.PrimarybytesOut) + delete(rawMsg, key) + case "secondarybytesIn": + err = unpopulate(val, "SecondarybytesIn", &e.SecondarybytesIn) + delete(rawMsg, key) + case "secondarybytesOut": + err = unpopulate(val, "SecondarybytesOut", &e.SecondarybytesOut) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitsArpTableListResult. +func (e ExpressRouteCircuitsArpTableListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitsArpTableListResult. +func (e *ExpressRouteCircuitsArpTableListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitsRoutesTableListResult. +func (e ExpressRouteCircuitsRoutesTableListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitsRoutesTableListResult. +func (e *ExpressRouteCircuitsRoutesTableListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCircuitsRoutesTableSummaryListResult. +func (e ExpressRouteCircuitsRoutesTableSummaryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCircuitsRoutesTableSummaryListResult. +func (e *ExpressRouteCircuitsRoutesTableSummaryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteConnection. +func (e ExpressRouteConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteConnection. +func (e *ExpressRouteConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteConnectionID. +func (e ExpressRouteConnectionID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteConnectionID. +func (e *ExpressRouteConnectionID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteConnectionList. +func (e ExpressRouteConnectionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteConnectionList. +func (e *ExpressRouteConnectionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteConnectionProperties. +func (e ExpressRouteConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationKey", e.AuthorizationKey) + populate(objectMap, "enableInternetSecurity", e.EnableInternetSecurity) + populate(objectMap, "enablePrivateLinkFastPath", e.EnablePrivateLinkFastPath) + populate(objectMap, "expressRouteCircuitPeering", e.ExpressRouteCircuitPeering) + populate(objectMap, "expressRouteGatewayBypass", e.ExpressRouteGatewayBypass) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "routingConfiguration", e.RoutingConfiguration) + populate(objectMap, "routingWeight", e.RoutingWeight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteConnectionProperties. +func (e *ExpressRouteConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &e.AuthorizationKey) + delete(rawMsg, key) + case "enableInternetSecurity": + err = unpopulate(val, "EnableInternetSecurity", &e.EnableInternetSecurity) + delete(rawMsg, key) + case "enablePrivateLinkFastPath": + err = unpopulate(val, "EnablePrivateLinkFastPath", &e.EnablePrivateLinkFastPath) + delete(rawMsg, key) + case "expressRouteCircuitPeering": + err = unpopulate(val, "ExpressRouteCircuitPeering", &e.ExpressRouteCircuitPeering) + delete(rawMsg, key) + case "expressRouteGatewayBypass": + err = unpopulate(val, "ExpressRouteGatewayBypass", &e.ExpressRouteGatewayBypass) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "routingConfiguration": + err = unpopulate(val, "RoutingConfiguration", &e.RoutingConfiguration) + delete(rawMsg, key) + case "routingWeight": + err = unpopulate(val, "RoutingWeight", &e.RoutingWeight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnection. +func (e ExpressRouteCrossConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnection. +func (e *ExpressRouteCrossConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionListResult. +func (e ExpressRouteCrossConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionListResult. +func (e *ExpressRouteCrossConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionPeering. +func (e ExpressRouteCrossConnectionPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionPeering. +func (e *ExpressRouteCrossConnectionPeering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionPeeringList. +func (e ExpressRouteCrossConnectionPeeringList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionPeeringList. +func (e *ExpressRouteCrossConnectionPeeringList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionPeeringProperties. +func (e ExpressRouteCrossConnectionPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureASN", e.AzureASN) + populate(objectMap, "gatewayManagerEtag", e.GatewayManagerEtag) + populate(objectMap, "ipv6PeeringConfig", e.IPv6PeeringConfig) + populate(objectMap, "lastModifiedBy", e.LastModifiedBy) + populate(objectMap, "microsoftPeeringConfig", e.MicrosoftPeeringConfig) + populate(objectMap, "peerASN", e.PeerASN) + populate(objectMap, "peeringType", e.PeeringType) + populate(objectMap, "primaryAzurePort", e.PrimaryAzurePort) + populate(objectMap, "primaryPeerAddressPrefix", e.PrimaryPeerAddressPrefix) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "secondaryAzurePort", e.SecondaryAzurePort) + populate(objectMap, "secondaryPeerAddressPrefix", e.SecondaryPeerAddressPrefix) + populate(objectMap, "sharedKey", e.SharedKey) + populate(objectMap, "state", e.State) + populate(objectMap, "vlanId", e.VlanID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionPeeringProperties. +func (e *ExpressRouteCrossConnectionPeeringProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureASN": + err = unpopulate(val, "AzureASN", &e.AzureASN) + delete(rawMsg, key) + case "gatewayManagerEtag": + err = unpopulate(val, "GatewayManagerEtag", &e.GatewayManagerEtag) + delete(rawMsg, key) + case "ipv6PeeringConfig": + err = unpopulate(val, "IPv6PeeringConfig", &e.IPv6PeeringConfig) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) + delete(rawMsg, key) + case "microsoftPeeringConfig": + err = unpopulate(val, "MicrosoftPeeringConfig", &e.MicrosoftPeeringConfig) + delete(rawMsg, key) + case "peerASN": + err = unpopulate(val, "PeerASN", &e.PeerASN) + delete(rawMsg, key) + case "peeringType": + err = unpopulate(val, "PeeringType", &e.PeeringType) + delete(rawMsg, key) + case "primaryAzurePort": + err = unpopulate(val, "PrimaryAzurePort", &e.PrimaryAzurePort) + delete(rawMsg, key) + case "primaryPeerAddressPrefix": + err = unpopulate(val, "PrimaryPeerAddressPrefix", &e.PrimaryPeerAddressPrefix) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "secondaryAzurePort": + err = unpopulate(val, "SecondaryAzurePort", &e.SecondaryAzurePort) + delete(rawMsg, key) + case "secondaryPeerAddressPrefix": + err = unpopulate(val, "SecondaryPeerAddressPrefix", &e.SecondaryPeerAddressPrefix) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &e.SharedKey) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + case "vlanId": + err = unpopulate(val, "VlanID", &e.VlanID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionProperties. +func (e ExpressRouteCrossConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bandwidthInMbps", e.BandwidthInMbps) + populate(objectMap, "expressRouteCircuit", e.ExpressRouteCircuit) + populate(objectMap, "peeringLocation", e.PeeringLocation) + populate(objectMap, "peerings", e.Peerings) + populate(objectMap, "primaryAzurePort", e.PrimaryAzurePort) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "sTag", e.STag) + populate(objectMap, "secondaryAzurePort", e.SecondaryAzurePort) + populate(objectMap, "serviceProviderNotes", e.ServiceProviderNotes) + populate(objectMap, "serviceProviderProvisioningState", e.ServiceProviderProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionProperties. +func (e *ExpressRouteCrossConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bandwidthInMbps": + err = unpopulate(val, "BandwidthInMbps", &e.BandwidthInMbps) + delete(rawMsg, key) + case "expressRouteCircuit": + err = unpopulate(val, "ExpressRouteCircuit", &e.ExpressRouteCircuit) + delete(rawMsg, key) + case "peeringLocation": + err = unpopulate(val, "PeeringLocation", &e.PeeringLocation) + delete(rawMsg, key) + case "peerings": + err = unpopulate(val, "Peerings", &e.Peerings) + delete(rawMsg, key) + case "primaryAzurePort": + err = unpopulate(val, "PrimaryAzurePort", &e.PrimaryAzurePort) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "sTag": + err = unpopulate(val, "STag", &e.STag) + delete(rawMsg, key) + case "secondaryAzurePort": + err = unpopulate(val, "SecondaryAzurePort", &e.SecondaryAzurePort) + delete(rawMsg, key) + case "serviceProviderNotes": + err = unpopulate(val, "ServiceProviderNotes", &e.ServiceProviderNotes) + delete(rawMsg, key) + case "serviceProviderProvisioningState": + err = unpopulate(val, "ServiceProviderProvisioningState", &e.ServiceProviderProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionRoutesTableSummary. +func (e ExpressRouteCrossConnectionRoutesTableSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", e.Asn) + populate(objectMap, "neighbor", e.Neighbor) + populate(objectMap, "stateOrPrefixesReceived", e.StateOrPrefixesReceived) + populate(objectMap, "upDown", e.UpDown) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionRoutesTableSummary. +func (e *ExpressRouteCrossConnectionRoutesTableSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &e.Asn) + delete(rawMsg, key) + case "neighbor": + err = unpopulate(val, "Neighbor", &e.Neighbor) + delete(rawMsg, key) + case "stateOrPrefixesReceived": + err = unpopulate(val, "StateOrPrefixesReceived", &e.StateOrPrefixesReceived) + delete(rawMsg, key) + case "upDown": + err = unpopulate(val, "UpDown", &e.UpDown) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteCrossConnectionsRoutesTableSummaryListResult. +func (e ExpressRouteCrossConnectionsRoutesTableSummaryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteCrossConnectionsRoutesTableSummaryListResult. +func (e *ExpressRouteCrossConnectionsRoutesTableSummaryListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteGateway. +func (e ExpressRouteGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteGateway. +func (e *ExpressRouteGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteGatewayList. +func (e ExpressRouteGatewayList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteGatewayList. +func (e *ExpressRouteGatewayList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteGatewayProperties. +func (e ExpressRouteGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowNonVirtualWanTraffic", e.AllowNonVirtualWanTraffic) + populate(objectMap, "autoScaleConfiguration", e.AutoScaleConfiguration) + populate(objectMap, "expressRouteConnections", e.ExpressRouteConnections) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "virtualHub", e.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteGatewayProperties. +func (e *ExpressRouteGatewayProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowNonVirtualWanTraffic": + err = unpopulate(val, "AllowNonVirtualWanTraffic", &e.AllowNonVirtualWanTraffic) + delete(rawMsg, key) + case "autoScaleConfiguration": + err = unpopulate(val, "AutoScaleConfiguration", &e.AutoScaleConfiguration) + delete(rawMsg, key) + case "expressRouteConnections": + err = unpopulate(val, "ExpressRouteConnections", &e.ExpressRouteConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &e.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteGatewayPropertiesAutoScaleConfiguration. +func (e ExpressRouteGatewayPropertiesAutoScaleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bounds", e.Bounds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteGatewayPropertiesAutoScaleConfiguration. +func (e *ExpressRouteGatewayPropertiesAutoScaleConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bounds": + err = unpopulate(val, "Bounds", &e.Bounds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds. +func (e ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "max", e.Max) + populate(objectMap, "min", e.Min) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds. +func (e *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "max": + err = unpopulate(val, "Max", &e.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &e.Min) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteLink. +func (e ExpressRouteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteLink. +func (e *ExpressRouteLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteLinkListResult. +func (e ExpressRouteLinkListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteLinkListResult. +func (e *ExpressRouteLinkListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteLinkMacSecConfig. +func (e ExpressRouteLinkMacSecConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cakSecretIdentifier", e.CakSecretIdentifier) + populate(objectMap, "cipher", e.Cipher) + populate(objectMap, "cknSecretIdentifier", e.CknSecretIdentifier) + populate(objectMap, "sciState", e.SciState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteLinkMacSecConfig. +func (e *ExpressRouteLinkMacSecConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cakSecretIdentifier": + err = unpopulate(val, "CakSecretIdentifier", &e.CakSecretIdentifier) + delete(rawMsg, key) + case "cipher": + err = unpopulate(val, "Cipher", &e.Cipher) + delete(rawMsg, key) + case "cknSecretIdentifier": + err = unpopulate(val, "CknSecretIdentifier", &e.CknSecretIdentifier) + delete(rawMsg, key) + case "sciState": + err = unpopulate(val, "SciState", &e.SciState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteLinkPropertiesFormat. +func (e ExpressRouteLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminState", e.AdminState) + populate(objectMap, "coloLocation", e.ColoLocation) + populate(objectMap, "connectorType", e.ConnectorType) + populate(objectMap, "interfaceName", e.InterfaceName) + populate(objectMap, "macSecConfig", e.MacSecConfig) + populate(objectMap, "patchPanelId", e.PatchPanelID) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "rackId", e.RackID) + populate(objectMap, "routerName", e.RouterName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteLinkPropertiesFormat. +func (e *ExpressRouteLinkPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminState": + err = unpopulate(val, "AdminState", &e.AdminState) + delete(rawMsg, key) + case "coloLocation": + err = unpopulate(val, "ColoLocation", &e.ColoLocation) + delete(rawMsg, key) + case "connectorType": + err = unpopulate(val, "ConnectorType", &e.ConnectorType) + delete(rawMsg, key) + case "interfaceName": + err = unpopulate(val, "InterfaceName", &e.InterfaceName) + delete(rawMsg, key) + case "macSecConfig": + err = unpopulate(val, "MacSecConfig", &e.MacSecConfig) + delete(rawMsg, key) + case "patchPanelId": + err = unpopulate(val, "PatchPanelID", &e.PatchPanelID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "rackId": + err = unpopulate(val, "RackID", &e.RackID) + delete(rawMsg, key) + case "routerName": + err = unpopulate(val, "RouterName", &e.RouterName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePort. +func (e ExpressRoutePort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePort. +func (e *ExpressRoutePort) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortAuthorization. +func (e ExpressRoutePortAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortAuthorization. +func (e *ExpressRoutePortAuthorization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortAuthorizationListResult. +func (e ExpressRoutePortAuthorizationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortAuthorizationListResult. +func (e *ExpressRoutePortAuthorizationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortAuthorizationPropertiesFormat. +func (e ExpressRoutePortAuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationKey", e.AuthorizationKey) + populate(objectMap, "authorizationUseStatus", e.AuthorizationUseStatus) + populate(objectMap, "circuitResourceUri", e.CircuitResourceURI) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortAuthorizationPropertiesFormat. +func (e *ExpressRoutePortAuthorizationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &e.AuthorizationKey) + delete(rawMsg, key) + case "authorizationUseStatus": + err = unpopulate(val, "AuthorizationUseStatus", &e.AuthorizationUseStatus) + delete(rawMsg, key) + case "circuitResourceUri": + err = unpopulate(val, "CircuitResourceURI", &e.CircuitResourceURI) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortListResult. +func (e ExpressRoutePortListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortListResult. +func (e *ExpressRoutePortListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortPropertiesFormat. +func (e ExpressRoutePortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocationDate", e.AllocationDate) + populate(objectMap, "bandwidthInGbps", e.BandwidthInGbps) + populate(objectMap, "billingType", e.BillingType) + populate(objectMap, "circuits", e.Circuits) + populate(objectMap, "encapsulation", e.Encapsulation) + populate(objectMap, "etherType", e.EtherType) + populate(objectMap, "links", e.Links) + populate(objectMap, "mtu", e.Mtu) + populate(objectMap, "peeringLocation", e.PeeringLocation) + populate(objectMap, "provisionedBandwidthInGbps", e.ProvisionedBandwidthInGbps) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "resourceGuid", e.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortPropertiesFormat. +func (e *ExpressRoutePortPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocationDate": + err = unpopulate(val, "AllocationDate", &e.AllocationDate) + delete(rawMsg, key) + case "bandwidthInGbps": + err = unpopulate(val, "BandwidthInGbps", &e.BandwidthInGbps) + delete(rawMsg, key) + case "billingType": + err = unpopulate(val, "BillingType", &e.BillingType) + delete(rawMsg, key) + case "circuits": + err = unpopulate(val, "Circuits", &e.Circuits) + delete(rawMsg, key) + case "encapsulation": + err = unpopulate(val, "Encapsulation", &e.Encapsulation) + delete(rawMsg, key) + case "etherType": + err = unpopulate(val, "EtherType", &e.EtherType) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &e.Links) + delete(rawMsg, key) + case "mtu": + err = unpopulate(val, "Mtu", &e.Mtu) + delete(rawMsg, key) + case "peeringLocation": + err = unpopulate(val, "PeeringLocation", &e.PeeringLocation) + delete(rawMsg, key) + case "provisionedBandwidthInGbps": + err = unpopulate(val, "ProvisionedBandwidthInGbps", &e.ProvisionedBandwidthInGbps) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &e.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortsLocation. +func (e ExpressRoutePortsLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortsLocation. +func (e *ExpressRoutePortsLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortsLocationBandwidths. +func (e ExpressRoutePortsLocationBandwidths) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offerName", e.OfferName) + populate(objectMap, "valueInGbps", e.ValueInGbps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortsLocationBandwidths. +func (e *ExpressRoutePortsLocationBandwidths) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "offerName": + err = unpopulate(val, "OfferName", &e.OfferName) + delete(rawMsg, key) + case "valueInGbps": + err = unpopulate(val, "ValueInGbps", &e.ValueInGbps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortsLocationListResult. +func (e ExpressRoutePortsLocationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortsLocationListResult. +func (e *ExpressRoutePortsLocationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRoutePortsLocationPropertiesFormat. +func (e ExpressRoutePortsLocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", e.Address) + populate(objectMap, "availableBandwidths", e.AvailableBandwidths) + populate(objectMap, "contact", e.Contact) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRoutePortsLocationPropertiesFormat. +func (e *ExpressRoutePortsLocationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &e.Address) + delete(rawMsg, key) + case "availableBandwidths": + err = unpopulate(val, "AvailableBandwidths", &e.AvailableBandwidths) + delete(rawMsg, key) + case "contact": + err = unpopulate(val, "Contact", &e.Contact) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteProviderPort. +func (e ExpressRouteProviderPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteProviderPort. +func (e *ExpressRouteProviderPort) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteProviderPortListResult. +func (e ExpressRouteProviderPortListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteProviderPortListResult. +func (e *ExpressRouteProviderPortListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteProviderPortProperties. +func (e ExpressRouteProviderPortProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "overprovisionFactor", e.OverprovisionFactor) + populate(objectMap, "peeringLocation", e.PeeringLocation) + populate(objectMap, "portBandwidthInMbps", e.PortBandwidthInMbps) + populate(objectMap, "portPairDescriptor", e.PortPairDescriptor) + populate(objectMap, "primaryAzurePort", e.PrimaryAzurePort) + populate(objectMap, "remainingBandwidthInMbps", e.RemainingBandwidthInMbps) + populate(objectMap, "secondaryAzurePort", e.SecondaryAzurePort) + populate(objectMap, "usedBandwidthInMbps", e.UsedBandwidthInMbps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteProviderPortProperties. +func (e *ExpressRouteProviderPortProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "overprovisionFactor": + err = unpopulate(val, "OverprovisionFactor", &e.OverprovisionFactor) + delete(rawMsg, key) + case "peeringLocation": + err = unpopulate(val, "PeeringLocation", &e.PeeringLocation) + delete(rawMsg, key) + case "portBandwidthInMbps": + err = unpopulate(val, "PortBandwidthInMbps", &e.PortBandwidthInMbps) + delete(rawMsg, key) + case "portPairDescriptor": + err = unpopulate(val, "PortPairDescriptor", &e.PortPairDescriptor) + delete(rawMsg, key) + case "primaryAzurePort": + err = unpopulate(val, "PrimaryAzurePort", &e.PrimaryAzurePort) + delete(rawMsg, key) + case "remainingBandwidthInMbps": + err = unpopulate(val, "RemainingBandwidthInMbps", &e.RemainingBandwidthInMbps) + delete(rawMsg, key) + case "secondaryAzurePort": + err = unpopulate(val, "SecondaryAzurePort", &e.SecondaryAzurePort) + delete(rawMsg, key) + case "usedBandwidthInMbps": + err = unpopulate(val, "UsedBandwidthInMbps", &e.UsedBandwidthInMbps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteServiceProvider. +func (e ExpressRouteServiceProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteServiceProvider. +func (e *ExpressRouteServiceProvider) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteServiceProviderBandwidthsOffered. +func (e ExpressRouteServiceProviderBandwidthsOffered) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offerName", e.OfferName) + populate(objectMap, "valueInMbps", e.ValueInMbps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteServiceProviderBandwidthsOffered. +func (e *ExpressRouteServiceProviderBandwidthsOffered) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "offerName": + err = unpopulate(val, "OfferName", &e.OfferName) + delete(rawMsg, key) + case "valueInMbps": + err = unpopulate(val, "ValueInMbps", &e.ValueInMbps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteServiceProviderListResult. +func (e ExpressRouteServiceProviderListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteServiceProviderListResult. +func (e *ExpressRouteServiceProviderListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpressRouteServiceProviderPropertiesFormat. +func (e ExpressRouteServiceProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bandwidthsOffered", e.BandwidthsOffered) + populate(objectMap, "peeringLocations", e.PeeringLocations) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpressRouteServiceProviderPropertiesFormat. +func (e *ExpressRouteServiceProviderPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bandwidthsOffered": + err = unpopulate(val, "BandwidthsOffered", &e.BandwidthsOffered) + delete(rawMsg, key) + case "peeringLocations": + err = unpopulate(val, "PeeringLocations", &e.PeeringLocations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FilterItems. +func (f FilterItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "field", f.Field) + populate(objectMap, "values", f.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilterItems. +func (f *FilterItems) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "field": + err = unpopulate(val, "Field", &f.Field) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicy. +func (f FirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "id", f.ID) + populate(objectMap, "identity", f.Identity) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicy. +func (f *FirewallPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyCertificateAuthority. +func (f FirewallPolicyCertificateAuthority) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyVaultSecretId", f.KeyVaultSecretID) + populate(objectMap, "name", f.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyCertificateAuthority. +func (f *FirewallPolicyCertificateAuthority) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyVaultSecretId": + err = unpopulate(val, "KeyVaultSecretID", &f.KeyVaultSecretID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyFilterRuleCollection. +func (f FirewallPolicyFilterRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", f.Action) + populate(objectMap, "name", f.Name) + populate(objectMap, "priority", f.Priority) + objectMap["ruleCollectionType"] = FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection + populate(objectMap, "rules", f.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyFilterRuleCollection. +func (f *FirewallPolicyFilterRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &f.Action) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &f.Priority) + delete(rawMsg, key) + case "ruleCollectionType": + err = unpopulate(val, "RuleCollectionType", &f.RuleCollectionType) + delete(rawMsg, key) + case "rules": + f.Rules, err = unmarshalFirewallPolicyRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyFilterRuleCollectionAction. +func (f FirewallPolicyFilterRuleCollectionAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyFilterRuleCollectionAction. +func (f *FirewallPolicyFilterRuleCollectionAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyInsights. +func (f FirewallPolicyInsights) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isEnabled", f.IsEnabled) + populate(objectMap, "logAnalyticsResources", f.LogAnalyticsResources) + populate(objectMap, "retentionDays", f.RetentionDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyInsights. +func (f *FirewallPolicyInsights) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isEnabled": + err = unpopulate(val, "IsEnabled", &f.IsEnabled) + delete(rawMsg, key) + case "logAnalyticsResources": + err = unpopulate(val, "LogAnalyticsResources", &f.LogAnalyticsResources) + delete(rawMsg, key) + case "retentionDays": + err = unpopulate(val, "RetentionDays", &f.RetentionDays) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyIntrusionDetection. +func (f FirewallPolicyIntrusionDetection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", f.Configuration) + populate(objectMap, "mode", f.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyIntrusionDetection. +func (f *FirewallPolicyIntrusionDetection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configuration": + err = unpopulate(val, "Configuration", &f.Configuration) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &f.Mode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications. +func (f FirewallPolicyIntrusionDetectionBypassTrafficSpecifications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", f.Description) + populate(objectMap, "destinationAddresses", f.DestinationAddresses) + populate(objectMap, "destinationIpGroups", f.DestinationIPGroups) + populate(objectMap, "destinationPorts", f.DestinationPorts) + populate(objectMap, "name", f.Name) + populate(objectMap, "protocol", f.Protocol) + populate(objectMap, "sourceAddresses", f.SourceAddresses) + populate(objectMap, "sourceIpGroups", f.SourceIPGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications. +func (f *FirewallPolicyIntrusionDetectionBypassTrafficSpecifications) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &f.DestinationAddresses) + delete(rawMsg, key) + case "destinationIpGroups": + err = unpopulate(val, "DestinationIPGroups", &f.DestinationIPGroups) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &f.DestinationPorts) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &f.Protocol) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &f.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &f.SourceIPGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyIntrusionDetectionConfiguration. +func (f FirewallPolicyIntrusionDetectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bypassTrafficSettings", f.BypassTrafficSettings) + populate(objectMap, "privateRanges", f.PrivateRanges) + populate(objectMap, "signatureOverrides", f.SignatureOverrides) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyIntrusionDetectionConfiguration. +func (f *FirewallPolicyIntrusionDetectionConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bypassTrafficSettings": + err = unpopulate(val, "BypassTrafficSettings", &f.BypassTrafficSettings) + delete(rawMsg, key) + case "privateRanges": + err = unpopulate(val, "PrivateRanges", &f.PrivateRanges) + delete(rawMsg, key) + case "signatureOverrides": + err = unpopulate(val, "SignatureOverrides", &f.SignatureOverrides) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyIntrusionDetectionSignatureSpecification. +func (f FirewallPolicyIntrusionDetectionSignatureSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + populate(objectMap, "mode", f.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyIntrusionDetectionSignatureSpecification. +func (f *FirewallPolicyIntrusionDetectionSignatureSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &f.Mode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyListResult. +func (f FirewallPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyListResult. +func (f *FirewallPolicyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyLogAnalyticsResources. +func (f FirewallPolicyLogAnalyticsResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultWorkspaceId", f.DefaultWorkspaceID) + populate(objectMap, "workspaces", f.Workspaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyLogAnalyticsResources. +func (f *FirewallPolicyLogAnalyticsResources) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultWorkspaceId": + err = unpopulate(val, "DefaultWorkspaceID", &f.DefaultWorkspaceID) + delete(rawMsg, key) + case "workspaces": + err = unpopulate(val, "Workspaces", &f.Workspaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyLogAnalyticsWorkspace. +func (f FirewallPolicyLogAnalyticsWorkspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "region", f.Region) + populate(objectMap, "workspaceId", f.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyLogAnalyticsWorkspace. +func (f *FirewallPolicyLogAnalyticsWorkspace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "region": + err = unpopulate(val, "Region", &f.Region) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &f.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyNatRuleCollection. +func (f FirewallPolicyNatRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", f.Action) + populate(objectMap, "name", f.Name) + populate(objectMap, "priority", f.Priority) + objectMap["ruleCollectionType"] = FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection + populate(objectMap, "rules", f.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyNatRuleCollection. +func (f *FirewallPolicyNatRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &f.Action) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &f.Priority) + delete(rawMsg, key) + case "ruleCollectionType": + err = unpopulate(val, "RuleCollectionType", &f.RuleCollectionType) + delete(rawMsg, key) + case "rules": + f.Rules, err = unmarshalFirewallPolicyRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyNatRuleCollectionAction. +func (f FirewallPolicyNatRuleCollectionAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyNatRuleCollectionAction. +func (f *FirewallPolicyNatRuleCollectionAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyPropertiesFormat. +func (f FirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "basePolicy", f.BasePolicy) + populate(objectMap, "childPolicies", f.ChildPolicies) + populate(objectMap, "dnsSettings", f.DNSSettings) + populate(objectMap, "explicitProxySettings", f.ExplicitProxySettings) + populate(objectMap, "firewalls", f.Firewalls) + populate(objectMap, "insights", f.Insights) + populate(objectMap, "intrusionDetection", f.IntrusionDetection) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "ruleCollectionGroups", f.RuleCollectionGroups) + populate(objectMap, "sku", f.SKU) + populate(objectMap, "sql", f.SQL) + populate(objectMap, "snat", f.Snat) + populate(objectMap, "threatIntelMode", f.ThreatIntelMode) + populate(objectMap, "threatIntelWhitelist", f.ThreatIntelWhitelist) + populate(objectMap, "transportSecurity", f.TransportSecurity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyPropertiesFormat. +func (f *FirewallPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "basePolicy": + err = unpopulate(val, "BasePolicy", &f.BasePolicy) + delete(rawMsg, key) + case "childPolicies": + err = unpopulate(val, "ChildPolicies", &f.ChildPolicies) + delete(rawMsg, key) + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &f.DNSSettings) + delete(rawMsg, key) + case "explicitProxySettings": + err = unpopulate(val, "ExplicitProxySettings", &f.ExplicitProxySettings) + delete(rawMsg, key) + case "firewalls": + err = unpopulate(val, "Firewalls", &f.Firewalls) + delete(rawMsg, key) + case "insights": + err = unpopulate(val, "Insights", &f.Insights) + delete(rawMsg, key) + case "intrusionDetection": + err = unpopulate(val, "IntrusionDetection", &f.IntrusionDetection) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "ruleCollectionGroups": + err = unpopulate(val, "RuleCollectionGroups", &f.RuleCollectionGroups) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &f.SKU) + delete(rawMsg, key) + case "sql": + err = unpopulate(val, "SQL", &f.SQL) + delete(rawMsg, key) + case "snat": + err = unpopulate(val, "Snat", &f.Snat) + delete(rawMsg, key) + case "threatIntelMode": + err = unpopulate(val, "ThreatIntelMode", &f.ThreatIntelMode) + delete(rawMsg, key) + case "threatIntelWhitelist": + err = unpopulate(val, "ThreatIntelWhitelist", &f.ThreatIntelWhitelist) + delete(rawMsg, key) + case "transportSecurity": + err = unpopulate(val, "TransportSecurity", &f.TransportSecurity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRule. +func (f FirewallPolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", f.Description) + populate(objectMap, "name", f.Name) + objectMap["ruleType"] = f.RuleType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRule. +func (f *FirewallPolicyRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &f.RuleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRuleApplicationProtocol. +func (f FirewallPolicyRuleApplicationProtocol) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", f.Port) + populate(objectMap, "protocolType", f.ProtocolType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRuleApplicationProtocol. +func (f *FirewallPolicyRuleApplicationProtocol) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &f.Port) + delete(rawMsg, key) + case "protocolType": + err = unpopulate(val, "ProtocolType", &f.ProtocolType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRuleCollection. +func (f FirewallPolicyRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", f.Name) + populate(objectMap, "priority", f.Priority) + objectMap["ruleCollectionType"] = f.RuleCollectionType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRuleCollection. +func (f *FirewallPolicyRuleCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &f.Priority) + delete(rawMsg, key) + case "ruleCollectionType": + err = unpopulate(val, "RuleCollectionType", &f.RuleCollectionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRuleCollectionGroup. +func (f FirewallPolicyRuleCollectionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRuleCollectionGroup. +func (f *FirewallPolicyRuleCollectionGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRuleCollectionGroupListResult. +func (f FirewallPolicyRuleCollectionGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRuleCollectionGroupListResult. +func (f *FirewallPolicyRuleCollectionGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyRuleCollectionGroupProperties. +func (f FirewallPolicyRuleCollectionGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "priority", f.Priority) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "ruleCollections", f.RuleCollections) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyRuleCollectionGroupProperties. +func (f *FirewallPolicyRuleCollectionGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "priority": + err = unpopulate(val, "Priority", &f.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "ruleCollections": + f.RuleCollections, err = unmarshalFirewallPolicyRuleCollectionClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicySKU. +func (f FirewallPolicySKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tier", f.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicySKU. +func (f *FirewallPolicySKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tier": + err = unpopulate(val, "Tier", &f.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicySNAT. +func (f FirewallPolicySNAT) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoLearnPrivateRanges", f.AutoLearnPrivateRanges) + populate(objectMap, "privateRanges", f.PrivateRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicySNAT. +func (f *FirewallPolicySNAT) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoLearnPrivateRanges": + err = unpopulate(val, "AutoLearnPrivateRanges", &f.AutoLearnPrivateRanges) + delete(rawMsg, key) + case "privateRanges": + err = unpopulate(val, "PrivateRanges", &f.PrivateRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicySQL. +func (f FirewallPolicySQL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowSqlRedirect", f.AllowSQLRedirect) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicySQL. +func (f *FirewallPolicySQL) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowSqlRedirect": + err = unpopulate(val, "AllowSQLRedirect", &f.AllowSQLRedirect) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyThreatIntelWhitelist. +func (f FirewallPolicyThreatIntelWhitelist) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdns", f.Fqdns) + populate(objectMap, "ipAddresses", f.IPAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyThreatIntelWhitelist. +func (f *FirewallPolicyThreatIntelWhitelist) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdns": + err = unpopulate(val, "Fqdns", &f.Fqdns) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &f.IPAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallPolicyTransportSecurity. +func (f FirewallPolicyTransportSecurity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificateAuthority", f.CertificateAuthority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallPolicyTransportSecurity. +func (f *FirewallPolicyTransportSecurity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certificateAuthority": + err = unpopulate(val, "CertificateAuthority", &f.CertificateAuthority) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLog. +func (f FlowLog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLog. +func (f *FlowLog) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogFormatParameters. +func (f FlowLogFormatParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", f.Type) + populate(objectMap, "version", f.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogFormatParameters. +func (f *FlowLogFormatParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &f.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogInformation. +func (f FlowLogInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "flowAnalyticsConfiguration", f.FlowAnalyticsConfiguration) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "targetResourceId", f.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogInformation. +func (f *FlowLogInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "flowAnalyticsConfiguration": + err = unpopulate(val, "FlowAnalyticsConfiguration", &f.FlowAnalyticsConfiguration) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &f.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogListResult. +func (f FlowLogListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogListResult. +func (f *FlowLogListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogProperties. +func (f FlowLogProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "format", f.Format) + populate(objectMap, "retentionPolicy", f.RetentionPolicy) + populate(objectMap, "storageId", f.StorageID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogProperties. +func (f *FlowLogProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &f.Format) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &f.RetentionPolicy) + delete(rawMsg, key) + case "storageId": + err = unpopulate(val, "StorageID", &f.StorageID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogPropertiesFormat. +func (f FlowLogPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "flowAnalyticsConfiguration", f.FlowAnalyticsConfiguration) + populate(objectMap, "format", f.Format) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "retentionPolicy", f.RetentionPolicy) + populate(objectMap, "storageId", f.StorageID) + populate(objectMap, "targetResourceGuid", f.TargetResourceGUID) + populate(objectMap, "targetResourceId", f.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogPropertiesFormat. +func (f *FlowLogPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "flowAnalyticsConfiguration": + err = unpopulate(val, "FlowAnalyticsConfiguration", &f.FlowAnalyticsConfiguration) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &f.Format) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &f.RetentionPolicy) + delete(rawMsg, key) + case "storageId": + err = unpopulate(val, "StorageID", &f.StorageID) + delete(rawMsg, key) + case "targetResourceGuid": + err = unpopulate(val, "TargetResourceGUID", &f.TargetResourceGUID) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &f.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowLogStatusParameters. +func (f FlowLogStatusParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targetResourceId", f.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowLogStatusParameters. +func (f *FlowLogStatusParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &f.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FrontendIPConfiguration. +func (f FrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "type", f.Type) + populate(objectMap, "zones", f.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendIPConfiguration. +func (f *FrontendIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &f.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FrontendIPConfigurationPropertiesFormat. +func (f FrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "gatewayLoadBalancer", f.GatewayLoadBalancer) + populate(objectMap, "inboundNatPools", f.InboundNatPools) + populate(objectMap, "inboundNatRules", f.InboundNatRules) + populate(objectMap, "loadBalancingRules", f.LoadBalancingRules) + populate(objectMap, "outboundRules", f.OutboundRules) + populate(objectMap, "privateIPAddress", f.PrivateIPAddress) + populate(objectMap, "privateIPAddressVersion", f.PrivateIPAddressVersion) + populate(objectMap, "privateIPAllocationMethod", f.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "publicIPAddress", f.PublicIPAddress) + populate(objectMap, "publicIPPrefix", f.PublicIPPrefix) + populate(objectMap, "subnet", f.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendIPConfigurationPropertiesFormat. +func (f *FrontendIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gatewayLoadBalancer": + err = unpopulate(val, "GatewayLoadBalancer", &f.GatewayLoadBalancer) + delete(rawMsg, key) + case "inboundNatPools": + err = unpopulate(val, "InboundNatPools", &f.InboundNatPools) + delete(rawMsg, key) + case "inboundNatRules": + err = unpopulate(val, "InboundNatRules", &f.InboundNatRules) + delete(rawMsg, key) + case "loadBalancingRules": + err = unpopulate(val, "LoadBalancingRules", &f.LoadBalancingRules) + delete(rawMsg, key) + case "outboundRules": + err = unpopulate(val, "OutboundRules", &f.OutboundRules) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &f.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &f.PrivateIPAddressVersion) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &f.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &f.PublicIPAddress) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &f.PublicIPPrefix) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &f.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayCustomBgpIPAddressIPConfiguration. +func (g GatewayCustomBgpIPAddressIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customBgpIpAddress", g.CustomBgpIPAddress) + populate(objectMap, "ipConfigurationId", g.IPConfigurationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayCustomBgpIPAddressIPConfiguration. +func (g *GatewayCustomBgpIPAddressIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customBgpIpAddress": + err = unpopulate(val, "CustomBgpIPAddress", &g.CustomBgpIPAddress) + delete(rawMsg, key) + case "ipConfigurationId": + err = unpopulate(val, "IPConfigurationID", &g.IPConfigurationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayLoadBalancerTunnelInterface. +func (g GatewayLoadBalancerTunnelInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", g.Identifier) + populate(objectMap, "port", g.Port) + populate(objectMap, "protocol", g.Protocol) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayLoadBalancerTunnelInterface. +func (g *GatewayLoadBalancerTunnelInterface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &g.Identifier) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &g.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &g.Protocol) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayRoute. +func (g GatewayRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asPath", g.AsPath) + populate(objectMap, "localAddress", g.LocalAddress) + populate(objectMap, "network", g.Network) + populate(objectMap, "nextHop", g.NextHop) + populate(objectMap, "origin", g.Origin) + populate(objectMap, "sourcePeer", g.SourcePeer) + populate(objectMap, "weight", g.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayRoute. +func (g *GatewayRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asPath": + err = unpopulate(val, "AsPath", &g.AsPath) + delete(rawMsg, key) + case "localAddress": + err = unpopulate(val, "LocalAddress", &g.LocalAddress) + delete(rawMsg, key) + case "network": + err = unpopulate(val, "Network", &g.Network) + delete(rawMsg, key) + case "nextHop": + err = unpopulate(val, "NextHop", &g.NextHop) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &g.Origin) + delete(rawMsg, key) + case "sourcePeer": + err = unpopulate(val, "SourcePeer", &g.SourcePeer) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &g.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayRouteListResult. +func (g GatewayRouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayRouteListResult. +func (g *GatewayRouteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateExpressRoutePortsLOARequest. +func (g GenerateExpressRoutePortsLOARequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customerName", g.CustomerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateExpressRoutePortsLOARequest. +func (g *GenerateExpressRoutePortsLOARequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerName": + err = unpopulate(val, "CustomerName", &g.CustomerName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GenerateExpressRoutePortsLOAResult. +func (g GenerateExpressRoutePortsLOAResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encodedContent", g.EncodedContent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateExpressRoutePortsLOAResult. +func (g *GenerateExpressRoutePortsLOAResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "encodedContent": + err = unpopulate(val, "EncodedContent", &g.EncodedContent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetInboundRoutesParameters. +func (g GetInboundRoutesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionType", g.ConnectionType) + populate(objectMap, "resourceUri", g.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetInboundRoutesParameters. +func (g *GetInboundRoutesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionType": + err = unpopulate(val, "ConnectionType", &g.ConnectionType) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &g.ResourceURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetOutboundRoutesParameters. +func (g GetOutboundRoutesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionType", g.ConnectionType) + populate(objectMap, "resourceUri", g.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetOutboundRoutesParameters. +func (g *GetOutboundRoutesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionType": + err = unpopulate(val, "ConnectionType", &g.ConnectionType) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &g.ResourceURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetVPNSitesConfigurationRequest. +func (g GetVPNSitesConfigurationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "outputBlobSasUrl", g.OutputBlobSasURL) + populate(objectMap, "vpnSites", g.VPNSites) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetVPNSitesConfigurationRequest. +func (g *GetVPNSitesConfigurationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "outputBlobSasUrl": + err = unpopulate(val, "OutputBlobSasURL", &g.OutputBlobSasURL) + delete(rawMsg, key) + case "vpnSites": + err = unpopulate(val, "VPNSites", &g.VPNSites) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Group. +func (g Group) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", g.Etag) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Group. +func (g *Group) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &g.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupListResult. +func (g GroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupListResult. +func (g *GroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupProperties. +func (g GroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", g.Description) + populate(objectMap, "provisioningState", g.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupProperties. +func (g *GroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPConfiguration. +func (h HTTPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "headers", h.Headers) + populate(objectMap, "method", h.Method) + populate(objectMap, "validStatusCodes", h.ValidStatusCodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPConfiguration. +func (h *HTTPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "headers": + err = unpopulate(val, "Headers", &h.Headers) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &h.Method) + delete(rawMsg, key) + case "validStatusCodes": + err = unpopulate(val, "ValidStatusCodes", &h.ValidStatusCodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPHeader. +func (h HTTPHeader) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", h.Name) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPHeader. +func (h *HTTPHeader) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HopLink. +func (h HopLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "context", h.Context) + populate(objectMap, "issues", h.Issues) + populate(objectMap, "linkType", h.LinkType) + populate(objectMap, "nextHopId", h.NextHopID) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "resourceId", h.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HopLink. +func (h *HopLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "context": + err = unpopulate(val, "Context", &h.Context) + delete(rawMsg, key) + case "issues": + err = unpopulate(val, "Issues", &h.Issues) + delete(rawMsg, key) + case "linkType": + err = unpopulate(val, "LinkType", &h.LinkType) + delete(rawMsg, key) + case "nextHopId": + err = unpopulate(val, "NextHopID", &h.NextHopID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &h.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HopLinkProperties. +func (h HopLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "roundTripTimeAvg", h.RoundTripTimeAvg) + populate(objectMap, "roundTripTimeMax", h.RoundTripTimeMax) + populate(objectMap, "roundTripTimeMin", h.RoundTripTimeMin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HopLinkProperties. +func (h *HopLinkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roundTripTimeAvg": + err = unpopulate(val, "RoundTripTimeAvg", &h.RoundTripTimeAvg) + delete(rawMsg, key) + case "roundTripTimeMax": + err = unpopulate(val, "RoundTripTimeMax", &h.RoundTripTimeMax) + delete(rawMsg, key) + case "roundTripTimeMin": + err = unpopulate(val, "RoundTripTimeMin", &h.RoundTripTimeMin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Hub. +func (h Hub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceId", h.ResourceID) + populate(objectMap, "resourceType", h.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Hub. +func (h *Hub) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceId": + err = unpopulate(val, "ResourceID", &h.ResourceID) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &h.ResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubIPAddresses. +func (h HubIPAddresses) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", h.PrivateIPAddress) + populate(objectMap, "publicIPs", h.PublicIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubIPAddresses. +func (h *HubIPAddresses) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &h.PrivateIPAddress) + delete(rawMsg, key) + case "publicIPs": + err = unpopulate(val, "PublicIPs", &h.PublicIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubIPConfiguration. +func (h HubIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", h.Etag) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubIPConfiguration. +func (h *HubIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &h.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubIPConfigurationPropertiesFormat. +func (h HubIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", h.PrivateIPAddress) + populate(objectMap, "privateIPAllocationMethod", h.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "publicIPAddress", h.PublicIPAddress) + populate(objectMap, "subnet", h.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubIPConfigurationPropertiesFormat. +func (h *HubIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &h.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &h.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &h.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &h.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubPublicIPAddresses. +func (h HubPublicIPAddresses) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addresses", h.Addresses) + populate(objectMap, "count", h.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubPublicIPAddresses. +func (h *HubPublicIPAddresses) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addresses": + err = unpopulate(val, "Addresses", &h.Addresses) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &h.Count) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubRoute. +func (h HubRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationType", h.DestinationType) + populate(objectMap, "destinations", h.Destinations) + populate(objectMap, "name", h.Name) + populate(objectMap, "nextHop", h.NextHop) + populate(objectMap, "nextHopType", h.NextHopType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubRoute. +func (h *HubRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationType": + err = unpopulate(val, "DestinationType", &h.DestinationType) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &h.Destinations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "nextHop": + err = unpopulate(val, "NextHop", &h.NextHop) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &h.NextHopType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubRouteTable. +func (h HubRouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", h.Etag) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubRouteTable. +func (h *HubRouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &h.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubRouteTableProperties. +func (h HubRouteTableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associatedConnections", h.AssociatedConnections) + populate(objectMap, "labels", h.Labels) + populate(objectMap, "propagatingConnections", h.PropagatingConnections) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "routes", h.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubRouteTableProperties. +func (h *HubRouteTableProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associatedConnections": + err = unpopulate(val, "AssociatedConnections", &h.AssociatedConnections) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &h.Labels) + delete(rawMsg, key) + case "propagatingConnections": + err = unpopulate(val, "PropagatingConnections", &h.PropagatingConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &h.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubVirtualNetworkConnection. +func (h HubVirtualNetworkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", h.Etag) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubVirtualNetworkConnection. +func (h *HubVirtualNetworkConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &h.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HubVirtualNetworkConnectionProperties. +func (h HubVirtualNetworkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowHubToRemoteVnetTransit", h.AllowHubToRemoteVnetTransit) + populate(objectMap, "allowRemoteVnetToUseHubVnetGateways", h.AllowRemoteVnetToUseHubVnetGateways) + populate(objectMap, "enableInternetSecurity", h.EnableInternetSecurity) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "remoteVirtualNetwork", h.RemoteVirtualNetwork) + populate(objectMap, "routingConfiguration", h.RoutingConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HubVirtualNetworkConnectionProperties. +func (h *HubVirtualNetworkConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowHubToRemoteVnetTransit": + err = unpopulate(val, "AllowHubToRemoteVnetTransit", &h.AllowHubToRemoteVnetTransit) + delete(rawMsg, key) + case "allowRemoteVnetToUseHubVnetGateways": + err = unpopulate(val, "AllowRemoteVnetToUseHubVnetGateways", &h.AllowRemoteVnetToUseHubVnetGateways) + delete(rawMsg, key) + case "enableInternetSecurity": + err = unpopulate(val, "EnableInternetSecurity", &h.EnableInternetSecurity) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "remoteVirtualNetwork": + err = unpopulate(val, "RemoteVirtualNetwork", &h.RemoteVirtualNetwork) + delete(rawMsg, key) + case "routingConfiguration": + err = unpopulate(val, "RoutingConfiguration", &h.RoutingConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IDPSQueryObject. +func (i IDPSQueryObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filters", i.Filters) + populate(objectMap, "orderBy", i.OrderBy) + populate(objectMap, "resultsPerPage", i.ResultsPerPage) + populate(objectMap, "search", i.Search) + populate(objectMap, "skip", i.Skip) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IDPSQueryObject. +func (i *IDPSQueryObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filters": + err = unpopulate(val, "Filters", &i.Filters) + delete(rawMsg, key) + case "orderBy": + err = unpopulate(val, "OrderBy", &i.OrderBy) + delete(rawMsg, key) + case "resultsPerPage": + err = unpopulate(val, "ResultsPerPage", &i.ResultsPerPage) + delete(rawMsg, key) + case "search": + err = unpopulate(val, "Search", &i.Search) + delete(rawMsg, key) + case "skip": + err = unpopulate(val, "Skip", &i.Skip) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAddressAvailabilityResult. +func (i IPAddressAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "available", i.Available) + populate(objectMap, "availableIPAddresses", i.AvailableIPAddresses) + populate(objectMap, "isPlatformReserved", i.IsPlatformReserved) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddressAvailabilityResult. +func (i *IPAddressAvailabilityResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "available": + err = unpopulate(val, "Available", &i.Available) + delete(rawMsg, key) + case "availableIPAddresses": + err = unpopulate(val, "AvailableIPAddresses", &i.AvailableIPAddresses) + delete(rawMsg, key) + case "isPlatformReserved": + err = unpopulate(val, "IsPlatformReserved", &i.IsPlatformReserved) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAllocation. +func (i IPAllocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAllocation. +func (i *IPAllocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAllocationListResult. +func (i IPAllocationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAllocationListResult. +func (i *IPAllocationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAllocationPropertiesFormat. +func (i IPAllocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocationTags", i.AllocationTags) + populate(objectMap, "ipamAllocationId", i.IpamAllocationID) + populate(objectMap, "prefix", i.Prefix) + populate(objectMap, "prefixLength", i.PrefixLength) + populate(objectMap, "prefixType", i.PrefixType) + populate(objectMap, "subnet", i.Subnet) + populate(objectMap, "type", i.Type) + populate(objectMap, "virtualNetwork", i.VirtualNetwork) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAllocationPropertiesFormat. +func (i *IPAllocationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocationTags": + err = unpopulate(val, "AllocationTags", &i.AllocationTags) + delete(rawMsg, key) + case "ipamAllocationId": + err = unpopulate(val, "IpamAllocationID", &i.IpamAllocationID) + delete(rawMsg, key) + case "prefix": + err = unpopulate(val, "Prefix", &i.Prefix) + delete(rawMsg, key) + case "prefixLength": + err = unpopulate(val, "PrefixLength", &i.PrefixLength) + delete(rawMsg, key) + case "prefixType": + err = unpopulate(val, "PrefixType", &i.PrefixType) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "virtualNetwork": + err = unpopulate(val, "VirtualNetwork", &i.VirtualNetwork) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfiguration. +func (i IPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfiguration. +func (i *IPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationBgpPeeringAddress. +func (i IPConfigurationBgpPeeringAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customBgpIpAddresses", i.CustomBgpIPAddresses) + populate(objectMap, "defaultBgpIpAddresses", i.DefaultBgpIPAddresses) + populate(objectMap, "ipconfigurationId", i.IPConfigurationID) + populate(objectMap, "tunnelIpAddresses", i.TunnelIPAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationBgpPeeringAddress. +func (i *IPConfigurationBgpPeeringAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customBgpIpAddresses": + err = unpopulate(val, "CustomBgpIPAddresses", &i.CustomBgpIPAddresses) + delete(rawMsg, key) + case "defaultBgpIpAddresses": + err = unpopulate(val, "DefaultBgpIPAddresses", &i.DefaultBgpIPAddresses) + delete(rawMsg, key) + case "ipconfigurationId": + err = unpopulate(val, "IPConfigurationID", &i.IPConfigurationID) + delete(rawMsg, key) + case "tunnelIpAddresses": + err = unpopulate(val, "TunnelIPAddresses", &i.TunnelIPAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationProfile. +func (i IPConfigurationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProfile. +func (i *IPConfigurationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationProfilePropertiesFormat. +func (i IPConfigurationProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "subnet", i.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProfilePropertiesFormat. +func (i *IPConfigurationProfilePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPConfigurationPropertiesFormat. +func (i IPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", i.PrivateIPAddress) + populate(objectMap, "privateIPAllocationMethod", i.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "publicIPAddress", i.PublicIPAddress) + populate(objectMap, "subnet", i.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationPropertiesFormat. +func (i *IPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &i.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &i.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPGroup. +func (i IPGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPGroup. +func (i *IPGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPGroupListResult. +func (i IPGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPGroupListResult. +func (i *IPGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPGroupPropertiesFormat. +func (i IPGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "firewallPolicies", i.FirewallPolicies) + populate(objectMap, "firewalls", i.Firewalls) + populate(objectMap, "ipAddresses", i.IPAddresses) + populate(objectMap, "provisioningState", i.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPGroupPropertiesFormat. +func (i *IPGroupPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "firewallPolicies": + err = unpopulate(val, "FirewallPolicies", &i.FirewallPolicies) + delete(rawMsg, key) + case "firewalls": + err = unpopulate(val, "Firewalls", &i.Firewalls) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &i.IPAddresses) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPPrefixesList. +func (i IPPrefixesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipPrefixes", i.IPPrefixes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPrefixesList. +func (i *IPPrefixesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipPrefixes": + err = unpopulate(val, "IPPrefixes", &i.IPPrefixes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPSecPolicy. +func (i IPSecPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dhGroup", i.DhGroup) + populate(objectMap, "ipsecEncryption", i.IPSecEncryption) + populate(objectMap, "ipsecIntegrity", i.IPSecIntegrity) + populate(objectMap, "ikeEncryption", i.IkeEncryption) + populate(objectMap, "ikeIntegrity", i.IkeIntegrity) + populate(objectMap, "pfsGroup", i.PfsGroup) + populate(objectMap, "saDataSizeKilobytes", i.SaDataSizeKilobytes) + populate(objectMap, "saLifeTimeSeconds", i.SaLifeTimeSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPSecPolicy. +func (i *IPSecPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhGroup": + err = unpopulate(val, "DhGroup", &i.DhGroup) + delete(rawMsg, key) + case "ipsecEncryption": + err = unpopulate(val, "IPSecEncryption", &i.IPSecEncryption) + delete(rawMsg, key) + case "ipsecIntegrity": + err = unpopulate(val, "IPSecIntegrity", &i.IPSecIntegrity) + delete(rawMsg, key) + case "ikeEncryption": + err = unpopulate(val, "IkeEncryption", &i.IkeEncryption) + delete(rawMsg, key) + case "ikeIntegrity": + err = unpopulate(val, "IkeIntegrity", &i.IkeIntegrity) + delete(rawMsg, key) + case "pfsGroup": + err = unpopulate(val, "PfsGroup", &i.PfsGroup) + delete(rawMsg, key) + case "saDataSizeKilobytes": + err = unpopulate(val, "SaDataSizeKilobytes", &i.SaDataSizeKilobytes) + delete(rawMsg, key) + case "saLifeTimeSeconds": + err = unpopulate(val, "SaLifeTimeSeconds", &i.SaLifeTimeSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPTag. +func (i IPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipTagType", i.IPTagType) + populate(objectMap, "tag", i.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPTag. +func (i *IPTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipTagType": + err = unpopulate(val, "IPTagType", &i.IPTagType) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &i.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPv6CircuitConnectionConfig. +func (i IPv6CircuitConnectionConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", i.AddressPrefix) + populate(objectMap, "circuitConnectionStatus", i.CircuitConnectionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPv6CircuitConnectionConfig. +func (i *IPv6CircuitConnectionConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &i.AddressPrefix) + delete(rawMsg, key) + case "circuitConnectionStatus": + err = unpopulate(val, "CircuitConnectionStatus", &i.CircuitConnectionStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPv6ExpressRouteCircuitPeeringConfig. +func (i IPv6ExpressRouteCircuitPeeringConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "microsoftPeeringConfig", i.MicrosoftPeeringConfig) + populate(objectMap, "primaryPeerAddressPrefix", i.PrimaryPeerAddressPrefix) + populate(objectMap, "routeFilter", i.RouteFilter) + populate(objectMap, "secondaryPeerAddressPrefix", i.SecondaryPeerAddressPrefix) + populate(objectMap, "state", i.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPv6ExpressRouteCircuitPeeringConfig. +func (i *IPv6ExpressRouteCircuitPeeringConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "microsoftPeeringConfig": + err = unpopulate(val, "MicrosoftPeeringConfig", &i.MicrosoftPeeringConfig) + delete(rawMsg, key) + case "primaryPeerAddressPrefix": + err = unpopulate(val, "PrimaryPeerAddressPrefix", &i.PrimaryPeerAddressPrefix) + delete(rawMsg, key) + case "routeFilter": + err = unpopulate(val, "RouteFilter", &i.RouteFilter) + delete(rawMsg, key) + case "secondaryPeerAddressPrefix": + err = unpopulate(val, "SecondaryPeerAddressPrefix", &i.SecondaryPeerAddressPrefix) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &i.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatPool. +func (i InboundNatPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatPool. +func (i *InboundNatPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatPoolPropertiesFormat. +func (i InboundNatPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPort", i.BackendPort) + populate(objectMap, "enableFloatingIP", i.EnableFloatingIP) + populate(objectMap, "enableTcpReset", i.EnableTCPReset) + populate(objectMap, "frontendIPConfiguration", i.FrontendIPConfiguration) + populate(objectMap, "frontendPortRangeEnd", i.FrontendPortRangeEnd) + populate(objectMap, "frontendPortRangeStart", i.FrontendPortRangeStart) + populate(objectMap, "idleTimeoutInMinutes", i.IdleTimeoutInMinutes) + populate(objectMap, "protocol", i.Protocol) + populate(objectMap, "provisioningState", i.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatPoolPropertiesFormat. +func (i *InboundNatPoolPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendPort": + err = unpopulate(val, "BackendPort", &i.BackendPort) + delete(rawMsg, key) + case "enableFloatingIP": + err = unpopulate(val, "EnableFloatingIP", &i.EnableFloatingIP) + delete(rawMsg, key) + case "enableTcpReset": + err = unpopulate(val, "EnableTCPReset", &i.EnableTCPReset) + delete(rawMsg, key) + case "frontendIPConfiguration": + err = unpopulate(val, "FrontendIPConfiguration", &i.FrontendIPConfiguration) + delete(rawMsg, key) + case "frontendPortRangeEnd": + err = unpopulate(val, "FrontendPortRangeEnd", &i.FrontendPortRangeEnd) + delete(rawMsg, key) + case "frontendPortRangeStart": + err = unpopulate(val, "FrontendPortRangeStart", &i.FrontendPortRangeStart) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &i.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &i.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatRule. +func (i InboundNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatRule. +func (i *InboundNatRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatRuleListResult. +func (i InboundNatRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatRuleListResult. +func (i *InboundNatRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatRulePortMapping. +func (i InboundNatRulePortMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPort", i.BackendPort) + populate(objectMap, "frontendPort", i.FrontendPort) + populate(objectMap, "inboundNatRuleName", i.InboundNatRuleName) + populate(objectMap, "protocol", i.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatRulePortMapping. +func (i *InboundNatRulePortMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendPort": + err = unpopulate(val, "BackendPort", &i.BackendPort) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &i.FrontendPort) + delete(rawMsg, key) + case "inboundNatRuleName": + err = unpopulate(val, "InboundNatRuleName", &i.InboundNatRuleName) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &i.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundNatRulePropertiesFormat. +func (i InboundNatRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", i.BackendAddressPool) + populate(objectMap, "backendIPConfiguration", i.BackendIPConfiguration) + populate(objectMap, "backendPort", i.BackendPort) + populate(objectMap, "enableFloatingIP", i.EnableFloatingIP) + populate(objectMap, "enableTcpReset", i.EnableTCPReset) + populate(objectMap, "frontendIPConfiguration", i.FrontendIPConfiguration) + populate(objectMap, "frontendPort", i.FrontendPort) + populate(objectMap, "frontendPortRangeEnd", i.FrontendPortRangeEnd) + populate(objectMap, "frontendPortRangeStart", i.FrontendPortRangeStart) + populate(objectMap, "idleTimeoutInMinutes", i.IdleTimeoutInMinutes) + populate(objectMap, "protocol", i.Protocol) + populate(objectMap, "provisioningState", i.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatRulePropertiesFormat. +func (i *InboundNatRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &i.BackendAddressPool) + delete(rawMsg, key) + case "backendIPConfiguration": + err = unpopulate(val, "BackendIPConfiguration", &i.BackendIPConfiguration) + delete(rawMsg, key) + case "backendPort": + err = unpopulate(val, "BackendPort", &i.BackendPort) + delete(rawMsg, key) + case "enableFloatingIP": + err = unpopulate(val, "EnableFloatingIP", &i.EnableFloatingIP) + delete(rawMsg, key) + case "enableTcpReset": + err = unpopulate(val, "EnableTCPReset", &i.EnableTCPReset) + delete(rawMsg, key) + case "frontendIPConfiguration": + err = unpopulate(val, "FrontendIPConfiguration", &i.FrontendIPConfiguration) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &i.FrontendPort) + delete(rawMsg, key) + case "frontendPortRangeEnd": + err = unpopulate(val, "FrontendPortRangeEnd", &i.FrontendPortRangeEnd) + delete(rawMsg, key) + case "frontendPortRangeStart": + err = unpopulate(val, "FrontendPortRangeStart", &i.FrontendPortRangeStart) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &i.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &i.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundSecurityRule. +func (i InboundSecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundSecurityRule. +func (i *InboundSecurityRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundSecurityRuleProperties. +func (i InboundSecurityRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "rules", i.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundSecurityRuleProperties. +func (i *InboundSecurityRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &i.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InboundSecurityRules. +func (i InboundSecurityRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationPortRange", i.DestinationPortRange) + populate(objectMap, "protocol", i.Protocol) + populate(objectMap, "sourceAddressPrefix", i.SourceAddressPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundSecurityRules. +func (i *InboundSecurityRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationPortRange": + err = unpopulate(val, "DestinationPortRange", &i.DestinationPortRange) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &i.Protocol) + delete(rawMsg, key) + case "sourceAddressPrefix": + err = unpopulate(val, "SourceAddressPrefix", &i.SourceAddressPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntentPolicy. +func (i IntentPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntentPolicy. +func (i *IntentPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntentPolicyConfiguration. +func (i IntentPolicyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkIntentPolicyName", i.NetworkIntentPolicyName) + populate(objectMap, "sourceNetworkIntentPolicy", i.SourceNetworkIntentPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntentPolicyConfiguration. +func (i *IntentPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkIntentPolicyName": + err = unpopulate(val, "NetworkIntentPolicyName", &i.NetworkIntentPolicyName) + delete(rawMsg, key) + case "sourceNetworkIntentPolicy": + err = unpopulate(val, "SourceNetworkIntentPolicy", &i.SourceNetworkIntentPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Interface. +func (i Interface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "extendedLocation", i.ExtendedLocation) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Interface. +func (i *Interface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &i.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceAssociation. +func (i InterfaceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "securityRules", i.SecurityRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceAssociation. +func (i *InterfaceAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "securityRules": + err = unpopulate(val, "SecurityRules", &i.SecurityRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceDNSSettings. +func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedDnsServers", i.AppliedDNSServers) + populate(objectMap, "dnsServers", i.DNSServers) + populate(objectMap, "internalDnsNameLabel", i.InternalDNSNameLabel) + populate(objectMap, "internalDomainNameSuffix", i.InternalDomainNameSuffix) + populate(objectMap, "internalFqdn", i.InternalFqdn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceDNSSettings. +func (i *InterfaceDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedDnsServers": + err = unpopulate(val, "AppliedDNSServers", &i.AppliedDNSServers) + delete(rawMsg, key) + case "dnsServers": + err = unpopulate(val, "DNSServers", &i.DNSServers) + delete(rawMsg, key) + case "internalDnsNameLabel": + err = unpopulate(val, "InternalDNSNameLabel", &i.InternalDNSNameLabel) + delete(rawMsg, key) + case "internalDomainNameSuffix": + err = unpopulate(val, "InternalDomainNameSuffix", &i.InternalDomainNameSuffix) + delete(rawMsg, key) + case "internalFqdn": + err = unpopulate(val, "InternalFqdn", &i.InternalFqdn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceIPConfiguration. +func (i InterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceIPConfiguration. +func (i *InterfaceIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceIPConfigurationListResult. +func (i InterfaceIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceIPConfigurationListResult. +func (i *InterfaceIPConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceIPConfigurationPrivateLinkConnectionProperties. +func (i InterfaceIPConfigurationPrivateLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdns", i.Fqdns) + populate(objectMap, "groupId", i.GroupID) + populate(objectMap, "requiredMemberName", i.RequiredMemberName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceIPConfigurationPrivateLinkConnectionProperties. +func (i *InterfaceIPConfigurationPrivateLinkConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdns": + err = unpopulate(val, "Fqdns", &i.Fqdns) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &i.GroupID) + delete(rawMsg, key) + case "requiredMemberName": + err = unpopulate(val, "RequiredMemberName", &i.RequiredMemberName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceIPConfigurationPropertiesFormat. +func (i InterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationGatewayBackendAddressPools", i.ApplicationGatewayBackendAddressPools) + populate(objectMap, "applicationSecurityGroups", i.ApplicationSecurityGroups) + populate(objectMap, "gatewayLoadBalancer", i.GatewayLoadBalancer) + populate(objectMap, "loadBalancerBackendAddressPools", i.LoadBalancerBackendAddressPools) + populate(objectMap, "loadBalancerInboundNatRules", i.LoadBalancerInboundNatRules) + populate(objectMap, "primary", i.Primary) + populate(objectMap, "privateIPAddress", i.PrivateIPAddress) + populate(objectMap, "privateIPAddressVersion", i.PrivateIPAddressVersion) + populate(objectMap, "privateIPAllocationMethod", i.PrivateIPAllocationMethod) + populate(objectMap, "privateLinkConnectionProperties", i.PrivateLinkConnectionProperties) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "publicIPAddress", i.PublicIPAddress) + populate(objectMap, "subnet", i.Subnet) + populate(objectMap, "virtualNetworkTaps", i.VirtualNetworkTaps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceIPConfigurationPropertiesFormat. +func (i *InterfaceIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGatewayBackendAddressPools": + err = unpopulate(val, "ApplicationGatewayBackendAddressPools", &i.ApplicationGatewayBackendAddressPools) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &i.ApplicationSecurityGroups) + delete(rawMsg, key) + case "gatewayLoadBalancer": + err = unpopulate(val, "GatewayLoadBalancer", &i.GatewayLoadBalancer) + delete(rawMsg, key) + case "loadBalancerBackendAddressPools": + err = unpopulate(val, "LoadBalancerBackendAddressPools", &i.LoadBalancerBackendAddressPools) + delete(rawMsg, key) + case "loadBalancerInboundNatRules": + err = unpopulate(val, "LoadBalancerInboundNatRules", &i.LoadBalancerInboundNatRules) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &i.Primary) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &i.PrivateIPAddressVersion) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &i.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "privateLinkConnectionProperties": + err = unpopulate(val, "PrivateLinkConnectionProperties", &i.PrivateLinkConnectionProperties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &i.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + case "virtualNetworkTaps": + err = unpopulate(val, "VirtualNetworkTaps", &i.VirtualNetworkTaps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceListResult. +func (i InterfaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceListResult. +func (i *InterfaceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceLoadBalancerListResult. +func (i InterfaceLoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceLoadBalancerListResult. +func (i *InterfaceLoadBalancerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfacePropertiesFormat. +func (i InterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auxiliaryMode", i.AuxiliaryMode) + populate(objectMap, "dnsSettings", i.DNSSettings) + populate(objectMap, "disableTcpStateTracking", i.DisableTCPStateTracking) + populate(objectMap, "dscpConfiguration", i.DscpConfiguration) + populate(objectMap, "enableAcceleratedNetworking", i.EnableAcceleratedNetworking) + populate(objectMap, "enableIPForwarding", i.EnableIPForwarding) + populate(objectMap, "hostedWorkloads", i.HostedWorkloads) + populate(objectMap, "ipConfigurations", i.IPConfigurations) + populate(objectMap, "macAddress", i.MacAddress) + populate(objectMap, "migrationPhase", i.MigrationPhase) + populate(objectMap, "networkSecurityGroup", i.NetworkSecurityGroup) + populate(objectMap, "nicType", i.NicType) + populate(objectMap, "primary", i.Primary) + populate(objectMap, "privateEndpoint", i.PrivateEndpoint) + populate(objectMap, "privateLinkService", i.PrivateLinkService) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "resourceGuid", i.ResourceGUID) + populate(objectMap, "tapConfigurations", i.TapConfigurations) + populate(objectMap, "virtualMachine", i.VirtualMachine) + populate(objectMap, "vnetEncryptionSupported", i.VnetEncryptionSupported) + populate(objectMap, "workloadType", i.WorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfacePropertiesFormat. +func (i *InterfacePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auxiliaryMode": + err = unpopulate(val, "AuxiliaryMode", &i.AuxiliaryMode) + delete(rawMsg, key) + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &i.DNSSettings) + delete(rawMsg, key) + case "disableTcpStateTracking": + err = unpopulate(val, "DisableTCPStateTracking", &i.DisableTCPStateTracking) + delete(rawMsg, key) + case "dscpConfiguration": + err = unpopulate(val, "DscpConfiguration", &i.DscpConfiguration) + delete(rawMsg, key) + case "enableAcceleratedNetworking": + err = unpopulate(val, "EnableAcceleratedNetworking", &i.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "enableIPForwarding": + err = unpopulate(val, "EnableIPForwarding", &i.EnableIPForwarding) + delete(rawMsg, key) + case "hostedWorkloads": + err = unpopulate(val, "HostedWorkloads", &i.HostedWorkloads) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &i.IPConfigurations) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &i.MacAddress) + delete(rawMsg, key) + case "migrationPhase": + err = unpopulate(val, "MigrationPhase", &i.MigrationPhase) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &i.NetworkSecurityGroup) + delete(rawMsg, key) + case "nicType": + err = unpopulate(val, "NicType", &i.NicType) + delete(rawMsg, key) + case "primary": + err = unpopulate(val, "Primary", &i.Primary) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &i.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkService": + err = unpopulate(val, "PrivateLinkService", &i.PrivateLinkService) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &i.ResourceGUID) + delete(rawMsg, key) + case "tapConfigurations": + err = unpopulate(val, "TapConfigurations", &i.TapConfigurations) + delete(rawMsg, key) + case "virtualMachine": + err = unpopulate(val, "VirtualMachine", &i.VirtualMachine) + delete(rawMsg, key) + case "vnetEncryptionSupported": + err = unpopulate(val, "VnetEncryptionSupported", &i.VnetEncryptionSupported) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &i.WorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceTapConfiguration. +func (i InterfaceTapConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceTapConfiguration. +func (i *InterfaceTapConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceTapConfigurationListResult. +func (i InterfaceTapConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceTapConfigurationListResult. +func (i *InterfaceTapConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InterfaceTapConfigurationPropertiesFormat. +func (i InterfaceTapConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "virtualNetworkTap", i.VirtualNetworkTap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceTapConfigurationPropertiesFormat. +func (i *InterfaceTapConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "virtualNetworkTap": + err = unpopulate(val, "VirtualNetworkTap", &i.VirtualNetworkTap) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListHubRouteTablesResult. +func (l ListHubRouteTablesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListHubRouteTablesResult. +func (l *ListHubRouteTablesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListHubVirtualNetworkConnectionsResult. +func (l ListHubVirtualNetworkConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListHubVirtualNetworkConnectionsResult. +func (l *ListHubVirtualNetworkConnectionsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListP2SVPNGatewaysResult. +func (l ListP2SVPNGatewaysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListP2SVPNGatewaysResult. +func (l *ListP2SVPNGatewaysResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListRouteMapsResult. +func (l ListRouteMapsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListRouteMapsResult. +func (l *ListRouteMapsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListRoutingIntentResult. +func (l ListRoutingIntentResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListRoutingIntentResult. +func (l *ListRoutingIntentResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNConnectionsResult. +func (l ListVPNConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNConnectionsResult. +func (l *ListVPNConnectionsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNGatewayNatRulesResult. +func (l ListVPNGatewayNatRulesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNGatewayNatRulesResult. +func (l *ListVPNGatewayNatRulesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNGatewaysResult. +func (l ListVPNGatewaysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNGatewaysResult. +func (l *ListVPNGatewaysResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNServerConfigurationPolicyGroupsResult. +func (l ListVPNServerConfigurationPolicyGroupsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNServerConfigurationPolicyGroupsResult. +func (l *ListVPNServerConfigurationPolicyGroupsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNServerConfigurationsResult. +func (l ListVPNServerConfigurationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNServerConfigurationsResult. +func (l *ListVPNServerConfigurationsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNSiteLinkConnectionsResult. +func (l ListVPNSiteLinkConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNSiteLinkConnectionsResult. +func (l *ListVPNSiteLinkConnectionsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNSiteLinksResult. +func (l ListVPNSiteLinksResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNSiteLinksResult. +func (l *ListVPNSiteLinksResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVPNSitesResult. +func (l ListVPNSitesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVPNSitesResult. +func (l *ListVPNSitesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualHubBgpConnectionResults. +func (l ListVirtualHubBgpConnectionResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualHubBgpConnectionResults. +func (l *ListVirtualHubBgpConnectionResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualHubIPConfigurationResults. +func (l ListVirtualHubIPConfigurationResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualHubIPConfigurationResults. +func (l *ListVirtualHubIPConfigurationResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualHubRouteTableV2SResult. +func (l ListVirtualHubRouteTableV2SResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualHubRouteTableV2SResult. +func (l *ListVirtualHubRouteTableV2SResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualHubsResult. +func (l ListVirtualHubsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualHubsResult. +func (l *ListVirtualHubsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualNetworkGatewayNatRulesResult. +func (l ListVirtualNetworkGatewayNatRulesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualNetworkGatewayNatRulesResult. +func (l *ListVirtualNetworkGatewayNatRulesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListVirtualWANsResult. +func (l ListVirtualWANsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListVirtualWANsResult. +func (l *ListVirtualWANsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancer. +func (l LoadBalancer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", l.Etag) + populate(objectMap, "extendedLocation", l.ExtendedLocation) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "sku", l.SKU) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancer. +func (l *LoadBalancer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &l.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &l.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerBackendAddress. +func (l LoadBalancerBackendAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerBackendAddress. +func (l *LoadBalancerBackendAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerBackendAddressPoolListResult. +func (l LoadBalancerBackendAddressPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerBackendAddressPoolListResult. +func (l *LoadBalancerBackendAddressPoolListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerBackendAddressPropertiesFormat. +func (l LoadBalancerBackendAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adminState", l.AdminState) + populate(objectMap, "ipAddress", l.IPAddress) + populate(objectMap, "inboundNatRulesPortMapping", l.InboundNatRulesPortMapping) + populate(objectMap, "loadBalancerFrontendIPConfiguration", l.LoadBalancerFrontendIPConfiguration) + populate(objectMap, "networkInterfaceIPConfiguration", l.NetworkInterfaceIPConfiguration) + populate(objectMap, "subnet", l.Subnet) + populate(objectMap, "virtualNetwork", l.VirtualNetwork) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerBackendAddressPropertiesFormat. +func (l *LoadBalancerBackendAddressPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adminState": + err = unpopulate(val, "AdminState", &l.AdminState) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &l.IPAddress) + delete(rawMsg, key) + case "inboundNatRulesPortMapping": + err = unpopulate(val, "InboundNatRulesPortMapping", &l.InboundNatRulesPortMapping) + delete(rawMsg, key) + case "loadBalancerFrontendIPConfiguration": + err = unpopulate(val, "LoadBalancerFrontendIPConfiguration", &l.LoadBalancerFrontendIPConfiguration) + delete(rawMsg, key) + case "networkInterfaceIPConfiguration": + err = unpopulate(val, "NetworkInterfaceIPConfiguration", &l.NetworkInterfaceIPConfiguration) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &l.Subnet) + delete(rawMsg, key) + case "virtualNetwork": + err = unpopulate(val, "VirtualNetwork", &l.VirtualNetwork) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerFrontendIPConfigurationListResult. +func (l LoadBalancerFrontendIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerFrontendIPConfigurationListResult. +func (l *LoadBalancerFrontendIPConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerListResult. +func (l LoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerListResult. +func (l *LoadBalancerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerLoadBalancingRuleListResult. +func (l LoadBalancerLoadBalancingRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerLoadBalancingRuleListResult. +func (l *LoadBalancerLoadBalancingRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerOutboundRuleListResult. +func (l LoadBalancerOutboundRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerOutboundRuleListResult. +func (l *LoadBalancerOutboundRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerProbeListResult. +func (l LoadBalancerProbeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerProbeListResult. +func (l *LoadBalancerProbeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerPropertiesFormat. +func (l LoadBalancerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPools", l.BackendAddressPools) + populate(objectMap, "frontendIPConfigurations", l.FrontendIPConfigurations) + populate(objectMap, "inboundNatPools", l.InboundNatPools) + populate(objectMap, "inboundNatRules", l.InboundNatRules) + populate(objectMap, "loadBalancingRules", l.LoadBalancingRules) + populate(objectMap, "outboundRules", l.OutboundRules) + populate(objectMap, "probes", l.Probes) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceGuid", l.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerPropertiesFormat. +func (l *LoadBalancerPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPools": + err = unpopulate(val, "BackendAddressPools", &l.BackendAddressPools) + delete(rawMsg, key) + case "frontendIPConfigurations": + err = unpopulate(val, "FrontendIPConfigurations", &l.FrontendIPConfigurations) + delete(rawMsg, key) + case "inboundNatPools": + err = unpopulate(val, "InboundNatPools", &l.InboundNatPools) + delete(rawMsg, key) + case "inboundNatRules": + err = unpopulate(val, "InboundNatRules", &l.InboundNatRules) + delete(rawMsg, key) + case "loadBalancingRules": + err = unpopulate(val, "LoadBalancingRules", &l.LoadBalancingRules) + delete(rawMsg, key) + case "outboundRules": + err = unpopulate(val, "OutboundRules", &l.OutboundRules) + delete(rawMsg, key) + case "probes": + err = unpopulate(val, "Probes", &l.Probes) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &l.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerSKU. +func (l LoadBalancerSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", l.Name) + populate(objectMap, "tier", l.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerSKU. +func (l *LoadBalancerSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &l.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerVipSwapRequest. +func (l LoadBalancerVipSwapRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "frontendIPConfigurations", l.FrontendIPConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerVipSwapRequest. +func (l *LoadBalancerVipSwapRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frontendIPConfigurations": + err = unpopulate(val, "FrontendIPConfigurations", &l.FrontendIPConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerVipSwapRequestFrontendIPConfiguration. +func (l LoadBalancerVipSwapRequestFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "properties", l.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerVipSwapRequestFrontendIPConfiguration. +func (l *LoadBalancerVipSwapRequestFrontendIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties. +func (l LoadBalancerVipSwapRequestFrontendIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicIPAddress", l.PublicIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties. +func (l *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &l.PublicIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancingRule. +func (l LoadBalancingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", l.Etag) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancingRule. +func (l *LoadBalancingRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &l.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancingRulePropertiesFormat. +func (l LoadBalancingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendAddressPool", l.BackendAddressPool) + populate(objectMap, "backendAddressPools", l.BackendAddressPools) + populate(objectMap, "backendPort", l.BackendPort) + populate(objectMap, "disableOutboundSnat", l.DisableOutboundSnat) + populate(objectMap, "enableFloatingIP", l.EnableFloatingIP) + populate(objectMap, "enableTcpReset", l.EnableTCPReset) + populate(objectMap, "frontendIPConfiguration", l.FrontendIPConfiguration) + populate(objectMap, "frontendPort", l.FrontendPort) + populate(objectMap, "idleTimeoutInMinutes", l.IdleTimeoutInMinutes) + populate(objectMap, "loadDistribution", l.LoadDistribution) + populate(objectMap, "probe", l.Probe) + populate(objectMap, "protocol", l.Protocol) + populate(objectMap, "provisioningState", l.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancingRulePropertiesFormat. +func (l *LoadBalancingRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &l.BackendAddressPool) + delete(rawMsg, key) + case "backendAddressPools": + err = unpopulate(val, "BackendAddressPools", &l.BackendAddressPools) + delete(rawMsg, key) + case "backendPort": + err = unpopulate(val, "BackendPort", &l.BackendPort) + delete(rawMsg, key) + case "disableOutboundSnat": + err = unpopulate(val, "DisableOutboundSnat", &l.DisableOutboundSnat) + delete(rawMsg, key) + case "enableFloatingIP": + err = unpopulate(val, "EnableFloatingIP", &l.EnableFloatingIP) + delete(rawMsg, key) + case "enableTcpReset": + err = unpopulate(val, "EnableTCPReset", &l.EnableTCPReset) + delete(rawMsg, key) + case "frontendIPConfiguration": + err = unpopulate(val, "FrontendIPConfiguration", &l.FrontendIPConfiguration) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &l.FrontendPort) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &l.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "loadDistribution": + err = unpopulate(val, "LoadDistribution", &l.LoadDistribution) + delete(rawMsg, key) + case "probe": + err = unpopulate(val, "Probe", &l.Probe) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &l.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocalNetworkGateway. +func (l LocalNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", l.Etag) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalNetworkGateway. +func (l *LocalNetworkGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &l.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocalNetworkGatewayListResult. +func (l LocalNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalNetworkGatewayListResult. +func (l *LocalNetworkGatewayListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocalNetworkGatewayPropertiesFormat. +func (l LocalNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bgpSettings", l.BgpSettings) + populate(objectMap, "fqdn", l.Fqdn) + populate(objectMap, "gatewayIpAddress", l.GatewayIPAddress) + populate(objectMap, "localNetworkAddressSpace", l.LocalNetworkAddressSpace) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceGuid", l.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalNetworkGatewayPropertiesFormat. +func (l *LocalNetworkGatewayPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpSettings": + err = unpopulate(val, "BgpSettings", &l.BgpSettings) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &l.Fqdn) + delete(rawMsg, key) + case "gatewayIpAddress": + err = unpopulate(val, "GatewayIPAddress", &l.GatewayIPAddress) + delete(rawMsg, key) + case "localNetworkAddressSpace": + err = unpopulate(val, "LocalNetworkAddressSpace", &l.LocalNetworkAddressSpace) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &l.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogSpecification. +func (l LogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobDuration", l.BlobDuration) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSpecification. +func (l *LogSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobDuration": + err = unpopulate(val, "BlobDuration", &l.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedRuleGroupOverride. +func (m ManagedRuleGroupOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroupName", m.RuleGroupName) + populate(objectMap, "rules", m.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleGroupOverride. +func (m *ManagedRuleGroupOverride) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroupName": + err = unpopulate(val, "RuleGroupName", &m.RuleGroupName) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &m.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedRuleOverride. +func (m ManagedRuleOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", m.Action) + populate(objectMap, "ruleId", m.RuleID) + populate(objectMap, "state", m.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleOverride. +func (m *ManagedRuleOverride) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &m.Action) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &m.RuleID) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedRuleSet. +func (m ManagedRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroupOverrides", m.RuleGroupOverrides) + populate(objectMap, "ruleSetType", m.RuleSetType) + populate(objectMap, "ruleSetVersion", m.RuleSetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRuleSet. +func (m *ManagedRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleGroupOverrides": + err = unpopulate(val, "RuleGroupOverrides", &m.RuleGroupOverrides) + delete(rawMsg, key) + case "ruleSetType": + err = unpopulate(val, "RuleSetType", &m.RuleSetType) + delete(rawMsg, key) + case "ruleSetVersion": + err = unpopulate(val, "RuleSetVersion", &m.RuleSetVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedRulesDefinition. +func (m ManagedRulesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclusions", m.Exclusions) + populate(objectMap, "managedRuleSets", m.ManagedRuleSets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedRulesDefinition. +func (m *ManagedRulesDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclusions": + err = unpopulate(val, "Exclusions", &m.Exclusions) + delete(rawMsg, key) + case "managedRuleSets": + err = unpopulate(val, "ManagedRuleSets", &m.ManagedRuleSets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Manager. +func (m Manager) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Manager. +func (m *Manager) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerCommit. +func (m ManagerCommit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commitId", m.CommitID) + populate(objectMap, "commitType", m.CommitType) + populate(objectMap, "configurationIds", m.ConfigurationIDs) + populate(objectMap, "targetLocations", m.TargetLocations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerCommit. +func (m *ManagerCommit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitId": + err = unpopulate(val, "CommitID", &m.CommitID) + delete(rawMsg, key) + case "commitType": + err = unpopulate(val, "CommitType", &m.CommitType) + delete(rawMsg, key) + case "configurationIds": + err = unpopulate(val, "ConfigurationIDs", &m.ConfigurationIDs) + delete(rawMsg, key) + case "targetLocations": + err = unpopulate(val, "TargetLocations", &m.TargetLocations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerConnection. +func (m ManagerConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerConnection. +func (m *ManagerConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerConnectionListResult. +func (m ManagerConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerConnectionListResult. +func (m *ManagerConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerConnectionProperties. +func (m ManagerConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionState", m.ConnectionState) + populate(objectMap, "description", m.Description) + populate(objectMap, "networkManagerId", m.NetworkManagerID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerConnectionProperties. +func (m *ManagerConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionState": + err = unpopulate(val, "ConnectionState", &m.ConnectionState) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "networkManagerId": + err = unpopulate(val, "NetworkManagerID", &m.NetworkManagerID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerDeploymentStatus. +func (m ManagerDeploymentStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "commitTime", m.CommitTime) + populate(objectMap, "configurationIds", m.ConfigurationIDs) + populate(objectMap, "deploymentStatus", m.DeploymentStatus) + populate(objectMap, "deploymentType", m.DeploymentType) + populate(objectMap, "errorMessage", m.ErrorMessage) + populate(objectMap, "region", m.Region) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerDeploymentStatus. +func (m *ManagerDeploymentStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commitTime": + err = unpopulateTimeRFC3339(val, "CommitTime", &m.CommitTime) + delete(rawMsg, key) + case "configurationIds": + err = unpopulate(val, "ConfigurationIDs", &m.ConfigurationIDs) + delete(rawMsg, key) + case "deploymentStatus": + err = unpopulate(val, "DeploymentStatus", &m.DeploymentStatus) + delete(rawMsg, key) + case "deploymentType": + err = unpopulate(val, "DeploymentType", &m.DeploymentType) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &m.Region) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerDeploymentStatusListResult. +func (m ManagerDeploymentStatusListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", m.SkipToken) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerDeploymentStatusListResult. +func (m *ManagerDeploymentStatusListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &m.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerDeploymentStatusParameter. +func (m ManagerDeploymentStatusParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deploymentTypes", m.DeploymentTypes) + populate(objectMap, "regions", m.Regions) + populate(objectMap, "skipToken", m.SkipToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerDeploymentStatusParameter. +func (m *ManagerDeploymentStatusParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deploymentTypes": + err = unpopulate(val, "DeploymentTypes", &m.DeploymentTypes) + delete(rawMsg, key) + case "regions": + err = unpopulate(val, "Regions", &m.Regions) + delete(rawMsg, key) + case "skipToken": + err = unpopulate(val, "SkipToken", &m.SkipToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerEffectiveConnectivityConfigurationListResult. +func (m ManagerEffectiveConnectivityConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", m.SkipToken) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerEffectiveConnectivityConfigurationListResult. +func (m *ManagerEffectiveConnectivityConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &m.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerEffectiveSecurityAdminRulesListResult. +func (m ManagerEffectiveSecurityAdminRulesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", m.SkipToken) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerEffectiveSecurityAdminRulesListResult. +func (m *ManagerEffectiveSecurityAdminRulesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &m.SkipToken) + delete(rawMsg, key) + case "value": + m.Value, err = unmarshalEffectiveBaseSecurityAdminRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerListResult. +func (m ManagerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerListResult. +func (m *ManagerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerProperties. +func (m ManagerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", m.Description) + populate(objectMap, "networkManagerScopeAccesses", m.NetworkManagerScopeAccesses) + populate(objectMap, "networkManagerScopes", m.NetworkManagerScopes) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerProperties. +func (m *ManagerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "networkManagerScopeAccesses": + err = unpopulate(val, "NetworkManagerScopeAccesses", &m.NetworkManagerScopeAccesses) + delete(rawMsg, key) + case "networkManagerScopes": + err = unpopulate(val, "NetworkManagerScopes", &m.NetworkManagerScopes) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerPropertiesNetworkManagerScopes. +func (m ManagerPropertiesNetworkManagerScopes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "crossTenantScopes", m.CrossTenantScopes) + populate(objectMap, "managementGroups", m.ManagementGroups) + populate(objectMap, "subscriptions", m.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerPropertiesNetworkManagerScopes. +func (m *ManagerPropertiesNetworkManagerScopes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "crossTenantScopes": + err = unpopulate(val, "CrossTenantScopes", &m.CrossTenantScopes) + delete(rawMsg, key) + case "managementGroups": + err = unpopulate(val, "ManagementGroups", &m.ManagementGroups) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &m.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagerSecurityGroupItem. +func (m ManagerSecurityGroupItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkGroupId", m.NetworkGroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagerSecurityGroupItem. +func (m *ManagerSecurityGroupItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkGroupId": + err = unpopulate(val, "NetworkGroupID", &m.NetworkGroupID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchCondition. +func (m MatchCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchValues", m.MatchValues) + populate(objectMap, "matchVariables", m.MatchVariables) + populate(objectMap, "negationConditon", m.NegationConditon) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "transforms", m.Transforms) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchCondition. +func (m *MatchCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "matchValues": + err = unpopulate(val, "MatchValues", &m.MatchValues) + delete(rawMsg, key) + case "matchVariables": + err = unpopulate(val, "MatchVariables", &m.MatchVariables) + delete(rawMsg, key) + case "negationConditon": + err = unpopulate(val, "NegationConditon", &m.NegationConditon) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "transforms": + err = unpopulate(val, "Transforms", &m.Transforms) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchVariable. +func (m MatchVariable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "selector", m.Selector) + populate(objectMap, "variableName", m.VariableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchVariable. +func (m *MatchVariable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "selector": + err = unpopulate(val, "Selector", &m.Selector) + delete(rawMsg, key) + case "variableName": + err = unpopulate(val, "VariableName", &m.VariableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchedRule. +func (m MatchedRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", m.Action) + populate(objectMap, "ruleName", m.RuleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchedRule. +func (m *MatchedRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &m.Action) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &m.RuleName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "availabilities", m.Availabilities) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "fillGapWithZero", m.FillGapWithZero) + populate(objectMap, "isInternal", m.IsInternal) + populate(objectMap, "metricFilterPattern", m.MetricFilterPattern) + populate(objectMap, "name", m.Name) + populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSpecification. +func (m *MetricSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &m.AggregationType) + delete(rawMsg, key) + case "availabilities": + err = unpopulate(val, "Availabilities", &m.Availabilities) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "enableRegionalMdmAccount": + err = unpopulate(val, "EnableRegionalMdmAccount", &m.EnableRegionalMdmAccount) + delete(rawMsg, key) + case "fillGapWithZero": + err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero) + delete(rawMsg, key) + case "isInternal": + err = unpopulate(val, "IsInternal", &m.IsInternal) + delete(rawMsg, key) + case "metricFilterPattern": + err = unpopulate(val, "MetricFilterPattern", &m.MetricFilterPattern) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "resourceIdDimensionNameOverride": + err = unpopulate(val, "ResourceIDDimensionNameOverride", &m.ResourceIDDimensionNameOverride) + delete(rawMsg, key) + case "sourceMdmAccount": + err = unpopulate(val, "SourceMdmAccount", &m.SourceMdmAccount) + delete(rawMsg, key) + case "sourceMdmNamespace": + err = unpopulate(val, "SourceMdmNamespace", &m.SourceMdmNamespace) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatGateway. +func (n NatGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", n.Etag) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "sku", n.SKU) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + populate(objectMap, "zones", n.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatGateway. +func (n *NatGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &n.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &n.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &n.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatGatewayListResult. +func (n NatGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatGatewayListResult. +func (n *NatGatewayListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatGatewayPropertiesFormat. +func (n NatGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "idleTimeoutInMinutes", n.IdleTimeoutInMinutes) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "publicIpAddresses", n.PublicIPAddresses) + populate(objectMap, "publicIpPrefixes", n.PublicIPPrefixes) + populate(objectMap, "resourceGuid", n.ResourceGUID) + populate(objectMap, "subnets", n.Subnets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatGatewayPropertiesFormat. +func (n *NatGatewayPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &n.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "publicIpAddresses": + err = unpopulate(val, "PublicIPAddresses", &n.PublicIPAddresses) + delete(rawMsg, key) + case "publicIpPrefixes": + err = unpopulate(val, "PublicIPPrefixes", &n.PublicIPPrefixes) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &n.ResourceGUID) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &n.Subnets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatGatewaySKU. +func (n NatGatewaySKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", n.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatGatewaySKU. +func (n *NatGatewaySKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatRule. +func (n NatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", n.Description) + populate(objectMap, "destinationAddresses", n.DestinationAddresses) + populate(objectMap, "destinationPorts", n.DestinationPorts) + populate(objectMap, "ipProtocols", n.IPProtocols) + populate(objectMap, "name", n.Name) + objectMap["ruleType"] = FirewallPolicyRuleTypeNatRule + populate(objectMap, "sourceAddresses", n.SourceAddresses) + populate(objectMap, "sourceIpGroups", n.SourceIPGroups) + populate(objectMap, "translatedAddress", n.TranslatedAddress) + populate(objectMap, "translatedFqdn", n.TranslatedFqdn) + populate(objectMap, "translatedPort", n.TranslatedPort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatRule. +func (n *NatRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &n.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &n.DestinationAddresses) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &n.DestinationPorts) + delete(rawMsg, key) + case "ipProtocols": + err = unpopulate(val, "IPProtocols", &n.IPProtocols) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &n.RuleType) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &n.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &n.SourceIPGroups) + delete(rawMsg, key) + case "translatedAddress": + err = unpopulate(val, "TranslatedAddress", &n.TranslatedAddress) + delete(rawMsg, key) + case "translatedFqdn": + err = unpopulate(val, "TranslatedFqdn", &n.TranslatedFqdn) + delete(rawMsg, key) + case "translatedPort": + err = unpopulate(val, "TranslatedPort", &n.TranslatedPort) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NatRulePortMapping. +func (n NatRulePortMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backendPort", n.BackendPort) + populate(objectMap, "frontendPort", n.FrontendPort) + populate(objectMap, "inboundNatRuleName", n.InboundNatRuleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NatRulePortMapping. +func (n *NatRulePortMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backendPort": + err = unpopulate(val, "BackendPort", &n.BackendPort) + delete(rawMsg, key) + case "frontendPort": + err = unpopulate(val, "FrontendPort", &n.FrontendPort) + delete(rawMsg, key) + case "inboundNatRuleName": + err = unpopulate(val, "InboundNatRuleName", &n.InboundNatRuleName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NextHopParameters. +func (n NextHopParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationIPAddress", n.DestinationIPAddress) + populate(objectMap, "sourceIPAddress", n.SourceIPAddress) + populate(objectMap, "targetNicResourceId", n.TargetNicResourceID) + populate(objectMap, "targetResourceId", n.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NextHopParameters. +func (n *NextHopParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationIPAddress": + err = unpopulate(val, "DestinationIPAddress", &n.DestinationIPAddress) + delete(rawMsg, key) + case "sourceIPAddress": + err = unpopulate(val, "SourceIPAddress", &n.SourceIPAddress) + delete(rawMsg, key) + case "targetNicResourceId": + err = unpopulate(val, "TargetNicResourceID", &n.TargetNicResourceID) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &n.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NextHopResult. +func (n NextHopResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextHopIpAddress", n.NextHopIPAddress) + populate(objectMap, "nextHopType", n.NextHopType) + populate(objectMap, "routeTableId", n.RouteTableID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NextHopResult. +func (n *NextHopResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &n.NextHopIPAddress) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &n.NextHopType) + delete(rawMsg, key) + case "routeTableId": + err = unpopulate(val, "RouteTableID", &n.RouteTableID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type O365BreakOutCategoryPolicies. +func (o O365BreakOutCategoryPolicies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", o.Allow) + populate(objectMap, "default", o.Default) + populate(objectMap, "optimize", o.Optimize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type O365BreakOutCategoryPolicies. +func (o *O365BreakOutCategoryPolicies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allow": + err = unpopulate(val, "Allow", &o.Allow) + delete(rawMsg, key) + case "default": + err = unpopulate(val, "Default", &o.Default) + delete(rawMsg, key) + case "optimize": + err = unpopulate(val, "Optimize", &o.Optimize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type O365PolicyProperties. +func (o O365PolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "breakOutCategories", o.BreakOutCategories) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type O365PolicyProperties. +func (o *O365PolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "breakOutCategories": + err = unpopulate(val, "BreakOutCategories", &o.BreakOutCategories) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365PolicyProperties. +func (o Office365PolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "breakOutCategories", o.BreakOutCategories) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365PolicyProperties. +func (o *Office365PolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "breakOutCategories": + err = unpopulate(val, "BreakOutCategories", &o.BreakOutCategories) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationPropertiesFormat. +func (o OperationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesFormat. +func (o *OperationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationPropertiesFormatServiceSpecification. +func (o OperationPropertiesFormatServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesFormatServiceSpecification. +func (o *OperationPropertiesFormatServiceSpecification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OrderBy. +func (o OrderBy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "field", o.Field) + populate(objectMap, "order", o.Order) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OrderBy. +func (o *OrderBy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "field": + err = unpopulate(val, "Field", &o.Field) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &o.Order) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundRule. +func (o OutboundRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundRule. +func (o *OutboundRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundRulePropertiesFormat. +func (o OutboundRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocatedOutboundPorts", o.AllocatedOutboundPorts) + populate(objectMap, "backendAddressPool", o.BackendAddressPool) + populate(objectMap, "enableTcpReset", o.EnableTCPReset) + populate(objectMap, "frontendIPConfigurations", o.FrontendIPConfigurations) + populate(objectMap, "idleTimeoutInMinutes", o.IdleTimeoutInMinutes) + populate(objectMap, "protocol", o.Protocol) + populate(objectMap, "provisioningState", o.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundRulePropertiesFormat. +func (o *OutboundRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedOutboundPorts": + err = unpopulate(val, "AllocatedOutboundPorts", &o.AllocatedOutboundPorts) + delete(rawMsg, key) + case "backendAddressPool": + err = unpopulate(val, "BackendAddressPool", &o.BackendAddressPool) + delete(rawMsg, key) + case "enableTcpReset": + err = unpopulate(val, "EnableTCPReset", &o.EnableTCPReset) + delete(rawMsg, key) + case "frontendIPConfigurations": + err = unpopulate(val, "FrontendIPConfigurations", &o.FrontendIPConfigurations) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &o.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &o.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OwaspCrsExclusionEntry. +func (o OwaspCrsExclusionEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclusionManagedRuleSets", o.ExclusionManagedRuleSets) + populate(objectMap, "matchVariable", o.MatchVariable) + populate(objectMap, "selector", o.Selector) + populate(objectMap, "selectorMatchOperator", o.SelectorMatchOperator) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OwaspCrsExclusionEntry. +func (o *OwaspCrsExclusionEntry) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclusionManagedRuleSets": + err = unpopulate(val, "ExclusionManagedRuleSets", &o.ExclusionManagedRuleSets) + delete(rawMsg, key) + case "matchVariable": + err = unpopulate(val, "MatchVariable", &o.MatchVariable) + delete(rawMsg, key) + case "selector": + err = unpopulate(val, "Selector", &o.Selector) + delete(rawMsg, key) + case "selectorMatchOperator": + err = unpopulate(val, "SelectorMatchOperator", &o.SelectorMatchOperator) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SConnectionConfiguration. +func (p P2SConnectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SConnectionConfiguration. +func (p *P2SConnectionConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SConnectionConfigurationProperties. +func (p P2SConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationPolicyGroupAssociations", p.ConfigurationPolicyGroupAssociations) + populate(objectMap, "enableInternetSecurity", p.EnableInternetSecurity) + populate(objectMap, "previousConfigurationPolicyGroupAssociations", p.PreviousConfigurationPolicyGroupAssociations) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "routingConfiguration", p.RoutingConfiguration) + populate(objectMap, "vpnClientAddressPool", p.VPNClientAddressPool) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SConnectionConfigurationProperties. +func (p *P2SConnectionConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationPolicyGroupAssociations": + err = unpopulate(val, "ConfigurationPolicyGroupAssociations", &p.ConfigurationPolicyGroupAssociations) + delete(rawMsg, key) + case "enableInternetSecurity": + err = unpopulate(val, "EnableInternetSecurity", &p.EnableInternetSecurity) + delete(rawMsg, key) + case "previousConfigurationPolicyGroupAssociations": + err = unpopulate(val, "PreviousConfigurationPolicyGroupAssociations", &p.PreviousConfigurationPolicyGroupAssociations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "routingConfiguration": + err = unpopulate(val, "RoutingConfiguration", &p.RoutingConfiguration) + delete(rawMsg, key) + case "vpnClientAddressPool": + err = unpopulate(val, "VPNClientAddressPool", &p.VPNClientAddressPool) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNConnectionHealth. +func (p P2SVPNConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sasUrl", p.SasURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNConnectionHealth. +func (p *P2SVPNConnectionHealth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sasUrl": + err = unpopulate(val, "SasURL", &p.SasURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNConnectionHealthRequest. +func (p P2SVPNConnectionHealthRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "outputBlobSasUrl", p.OutputBlobSasURL) + populate(objectMap, "vpnUserNamesFilter", p.VPNUserNamesFilter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNConnectionHealthRequest. +func (p *P2SVPNConnectionHealthRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "outputBlobSasUrl": + err = unpopulate(val, "OutputBlobSasURL", &p.OutputBlobSasURL) + delete(rawMsg, key) + case "vpnUserNamesFilter": + err = unpopulate(val, "VPNUserNamesFilter", &p.VPNUserNamesFilter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNConnectionRequest. +func (p P2SVPNConnectionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vpnConnectionIds", p.VPNConnectionIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNConnectionRequest. +func (p *P2SVPNConnectionRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vpnConnectionIds": + err = unpopulate(val, "VPNConnectionIDs", &p.VPNConnectionIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNGateway. +func (p P2SVPNGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNGateway. +func (p *P2SVPNGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNGatewayProperties. +func (p P2SVPNGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customDnsServers", p.CustomDNSServers) + populate(objectMap, "isRoutingPreferenceInternet", p.IsRoutingPreferenceInternet) + populate(objectMap, "p2SConnectionConfigurations", p.P2SConnectionConfigurations) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "vpnClientConnectionHealth", p.VPNClientConnectionHealth) + populate(objectMap, "vpnGatewayScaleUnit", p.VPNGatewayScaleUnit) + populate(objectMap, "vpnServerConfiguration", p.VPNServerConfiguration) + populate(objectMap, "virtualHub", p.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNGatewayProperties. +func (p *P2SVPNGatewayProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customDnsServers": + err = unpopulate(val, "CustomDNSServers", &p.CustomDNSServers) + delete(rawMsg, key) + case "isRoutingPreferenceInternet": + err = unpopulate(val, "IsRoutingPreferenceInternet", &p.IsRoutingPreferenceInternet) + delete(rawMsg, key) + case "p2SConnectionConfigurations": + err = unpopulate(val, "P2SConnectionConfigurations", &p.P2SConnectionConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "vpnClientConnectionHealth": + err = unpopulate(val, "VPNClientConnectionHealth", &p.VPNClientConnectionHealth) + delete(rawMsg, key) + case "vpnGatewayScaleUnit": + err = unpopulate(val, "VPNGatewayScaleUnit", &p.VPNGatewayScaleUnit) + delete(rawMsg, key) + case "vpnServerConfiguration": + err = unpopulate(val, "VPNServerConfiguration", &p.VPNServerConfiguration) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &p.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type P2SVPNProfileParameters. +func (p P2SVPNProfileParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationMethod", p.AuthenticationMethod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type P2SVPNProfileParameters. +func (p *P2SVPNProfileParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationMethod": + err = unpopulate(val, "AuthenticationMethod", &p.AuthenticationMethod) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCapture. +func (p PacketCapture) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCapture. +func (p *PacketCapture) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureFilter. +func (p PacketCaptureFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localIPAddress", p.LocalIPAddress) + populate(objectMap, "localPort", p.LocalPort) + populate(objectMap, "protocol", p.Protocol) + populate(objectMap, "remoteIPAddress", p.RemoteIPAddress) + populate(objectMap, "remotePort", p.RemotePort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureFilter. +func (p *PacketCaptureFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localIPAddress": + err = unpopulate(val, "LocalIPAddress", &p.LocalIPAddress) + delete(rawMsg, key) + case "localPort": + err = unpopulate(val, "LocalPort", &p.LocalPort) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + delete(rawMsg, key) + case "remoteIPAddress": + err = unpopulate(val, "RemoteIPAddress", &p.RemoteIPAddress) + delete(rawMsg, key) + case "remotePort": + err = unpopulate(val, "RemotePort", &p.RemotePort) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureListResult. +func (p PacketCaptureListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureListResult. +func (p *PacketCaptureListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureMachineScope. +func (p PacketCaptureMachineScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclude", p.Exclude) + populate(objectMap, "include", p.Include) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureMachineScope. +func (p *PacketCaptureMachineScope) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclude": + err = unpopulate(val, "Exclude", &p.Exclude) + delete(rawMsg, key) + case "include": + err = unpopulate(val, "Include", &p.Include) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureParameters. +func (p PacketCaptureParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bytesToCapturePerPacket", p.BytesToCapturePerPacket) + populate(objectMap, "filters", p.Filters) + populate(objectMap, "scope", p.Scope) + populate(objectMap, "storageLocation", p.StorageLocation) + populate(objectMap, "target", p.Target) + populate(objectMap, "targetType", p.TargetType) + populate(objectMap, "timeLimitInSeconds", p.TimeLimitInSeconds) + populate(objectMap, "totalBytesPerSession", p.TotalBytesPerSession) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureParameters. +func (p *PacketCaptureParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bytesToCapturePerPacket": + err = unpopulate(val, "BytesToCapturePerPacket", &p.BytesToCapturePerPacket) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &p.Filters) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + delete(rawMsg, key) + case "storageLocation": + err = unpopulate(val, "StorageLocation", &p.StorageLocation) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &p.Target) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &p.TargetType) + delete(rawMsg, key) + case "timeLimitInSeconds": + err = unpopulate(val, "TimeLimitInSeconds", &p.TimeLimitInSeconds) + delete(rawMsg, key) + case "totalBytesPerSession": + err = unpopulate(val, "TotalBytesPerSession", &p.TotalBytesPerSession) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureQueryStatusResult. +func (p PacketCaptureQueryStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "captureStartTime", p.CaptureStartTime) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "packetCaptureError", p.PacketCaptureError) + populate(objectMap, "packetCaptureStatus", p.PacketCaptureStatus) + populate(objectMap, "stopReason", p.StopReason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureQueryStatusResult. +func (p *PacketCaptureQueryStatusResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "captureStartTime": + err = unpopulateTimeRFC3339(val, "CaptureStartTime", &p.CaptureStartTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "packetCaptureError": + err = unpopulate(val, "PacketCaptureError", &p.PacketCaptureError) + delete(rawMsg, key) + case "packetCaptureStatus": + err = unpopulate(val, "PacketCaptureStatus", &p.PacketCaptureStatus) + delete(rawMsg, key) + case "stopReason": + err = unpopulate(val, "StopReason", &p.StopReason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureResult. +func (p PacketCaptureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureResult. +func (p *PacketCaptureResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureResultProperties. +func (p PacketCaptureResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bytesToCapturePerPacket", p.BytesToCapturePerPacket) + populate(objectMap, "filters", p.Filters) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "scope", p.Scope) + populate(objectMap, "storageLocation", p.StorageLocation) + populate(objectMap, "target", p.Target) + populate(objectMap, "targetType", p.TargetType) + populate(objectMap, "timeLimitInSeconds", p.TimeLimitInSeconds) + populate(objectMap, "totalBytesPerSession", p.TotalBytesPerSession) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureResultProperties. +func (p *PacketCaptureResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bytesToCapturePerPacket": + err = unpopulate(val, "BytesToCapturePerPacket", &p.BytesToCapturePerPacket) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &p.Filters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + delete(rawMsg, key) + case "storageLocation": + err = unpopulate(val, "StorageLocation", &p.StorageLocation) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &p.Target) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &p.TargetType) + delete(rawMsg, key) + case "timeLimitInSeconds": + err = unpopulate(val, "TimeLimitInSeconds", &p.TimeLimitInSeconds) + delete(rawMsg, key) + case "totalBytesPerSession": + err = unpopulate(val, "TotalBytesPerSession", &p.TotalBytesPerSession) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PacketCaptureStorageLocation. +func (p PacketCaptureStorageLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filePath", p.FilePath) + populate(objectMap, "storageId", p.StorageID) + populate(objectMap, "storagePath", p.StoragePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PacketCaptureStorageLocation. +func (p *PacketCaptureStorageLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filePath": + err = unpopulate(val, "FilePath", &p.FilePath) + delete(rawMsg, key) + case "storageId": + err = unpopulate(val, "StorageID", &p.StorageID) + delete(rawMsg, key) + case "storagePath": + err = unpopulate(val, "StoragePath", &p.StoragePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Parameter. +func (p Parameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asPath", p.AsPath) + populate(objectMap, "community", p.Community) + populate(objectMap, "routePrefix", p.RoutePrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Parameter. +func (p *Parameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asPath": + err = unpopulate(val, "AsPath", &p.AsPath) + delete(rawMsg, key) + case "community": + err = unpopulate(val, "Community", &p.Community) + delete(rawMsg, key) + case "routePrefix": + err = unpopulate(val, "RoutePrefix", &p.RoutePrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchObject. +func (p PatchObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchObject. +func (p *PatchObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchRouteFilter. +func (p PatchRouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchRouteFilter. +func (p *PatchRouteFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchRouteFilterRule. +func (p PatchRouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchRouteFilterRule. +func (p *PatchRouteFilterRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerExpressRouteCircuitConnection. +func (p PeerExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerExpressRouteCircuitConnection. +func (p *PeerExpressRouteCircuitConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerExpressRouteCircuitConnectionListResult. +func (p PeerExpressRouteCircuitConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerExpressRouteCircuitConnectionListResult. +func (p *PeerExpressRouteCircuitConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerExpressRouteCircuitConnectionPropertiesFormat. +func (p PeerExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", p.AddressPrefix) + populate(objectMap, "authResourceGuid", p.AuthResourceGUID) + populate(objectMap, "circuitConnectionStatus", p.CircuitConnectionStatus) + populate(objectMap, "connectionName", p.ConnectionName) + populate(objectMap, "expressRouteCircuitPeering", p.ExpressRouteCircuitPeering) + populate(objectMap, "peerExpressRouteCircuitPeering", p.PeerExpressRouteCircuitPeering) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerExpressRouteCircuitConnectionPropertiesFormat. +func (p *PeerExpressRouteCircuitConnectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &p.AddressPrefix) + delete(rawMsg, key) + case "authResourceGuid": + err = unpopulate(val, "AuthResourceGUID", &p.AuthResourceGUID) + delete(rawMsg, key) + case "circuitConnectionStatus": + err = unpopulate(val, "CircuitConnectionStatus", &p.CircuitConnectionStatus) + delete(rawMsg, key) + case "connectionName": + err = unpopulate(val, "ConnectionName", &p.ConnectionName) + delete(rawMsg, key) + case "expressRouteCircuitPeering": + err = unpopulate(val, "ExpressRouteCircuitPeering", &p.ExpressRouteCircuitPeering) + delete(rawMsg, key) + case "peerExpressRouteCircuitPeering": + err = unpopulate(val, "PeerExpressRouteCircuitPeering", &p.PeerExpressRouteCircuitPeering) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerRoute. +func (p PeerRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asPath", p.AsPath) + populate(objectMap, "localAddress", p.LocalAddress) + populate(objectMap, "network", p.Network) + populate(objectMap, "nextHop", p.NextHop) + populate(objectMap, "origin", p.Origin) + populate(objectMap, "sourcePeer", p.SourcePeer) + populate(objectMap, "weight", p.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerRoute. +func (p *PeerRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asPath": + err = unpopulate(val, "AsPath", &p.AsPath) + delete(rawMsg, key) + case "localAddress": + err = unpopulate(val, "LocalAddress", &p.LocalAddress) + delete(rawMsg, key) + case "network": + err = unpopulate(val, "Network", &p.Network) + delete(rawMsg, key) + case "nextHop": + err = unpopulate(val, "NextHop", &p.NextHop) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &p.Origin) + delete(rawMsg, key) + case "sourcePeer": + err = unpopulate(val, "SourcePeer", &p.SourcePeer) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &p.Weight) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeerRouteList. +func (p PeerRouteList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeerRouteList. +func (p *PeerRouteList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicySettings. +func (p PolicySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fileUploadLimitInMb", p.FileUploadLimitInMb) + populate(objectMap, "maxRequestBodySizeInKb", p.MaxRequestBodySizeInKb) + populate(objectMap, "mode", p.Mode) + populate(objectMap, "requestBodyCheck", p.RequestBodyCheck) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicySettings. +func (p *PolicySettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fileUploadLimitInMb": + err = unpopulate(val, "FileUploadLimitInMb", &p.FileUploadLimitInMb) + delete(rawMsg, key) + case "maxRequestBodySizeInKb": + err = unpopulate(val, "MaxRequestBodySizeInKb", &p.MaxRequestBodySizeInKb) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &p.Mode) + delete(rawMsg, key) + case "requestBodyCheck": + err = unpopulate(val, "RequestBodyCheck", &p.RequestBodyCheck) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrepareNetworkPoliciesRequest. +func (p PrepareNetworkPoliciesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkIntentPolicyConfigurations", p.NetworkIntentPolicyConfigurations) + populate(objectMap, "serviceName", p.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrepareNetworkPoliciesRequest. +func (p *PrepareNetworkPoliciesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkIntentPolicyConfigurations": + err = unpopulate(val, "NetworkIntentPolicyConfigurations", &p.NetworkIntentPolicyConfigurations) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &p.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateDNSZoneConfig. +func (p PrivateDNSZoneConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateDNSZoneConfig. +func (p *PrivateDNSZoneConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateDNSZoneGroup. +func (p PrivateDNSZoneGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateDNSZoneGroup. +func (p *PrivateDNSZoneGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateDNSZoneGroupListResult. +func (p PrivateDNSZoneGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateDNSZoneGroupListResult. +func (p *PrivateDNSZoneGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateDNSZoneGroupPropertiesFormat. +func (p PrivateDNSZoneGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateDnsZoneConfigs", p.PrivateDNSZoneConfigs) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateDNSZoneGroupPropertiesFormat. +func (p *PrivateDNSZoneGroupPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateDnsZoneConfigs": + err = unpopulate(val, "PrivateDNSZoneConfigs", &p.PrivateDNSZoneConfigs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateDNSZonePropertiesFormat. +func (p PrivateDNSZonePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateDnsZoneId", p.PrivateDNSZoneID) + populate(objectMap, "recordSets", p.RecordSets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateDNSZonePropertiesFormat. +func (p *PrivateDNSZonePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateDnsZoneId": + err = unpopulate(val, "PrivateDNSZoneID", &p.PrivateDNSZoneID) + delete(rawMsg, key) + case "recordSets": + err = unpopulate(val, "RecordSets", &p.RecordSets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkIdentifier", p.LinkIdentifier) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &p.LinkIdentifier) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointIPConfiguration. +func (p PrivateEndpointIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointIPConfiguration. +func (p *PrivateEndpointIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointIPConfigurationProperties. +func (p PrivateEndpointIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "memberName", p.MemberName) + populate(objectMap, "privateIPAddress", p.PrivateIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointIPConfigurationProperties. +func (p *PrivateEndpointIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &p.MemberName) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &p.PrivateIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointListResult. +func (p PrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointListResult. +func (p *PrivateEndpointListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperties. +func (p PrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationSecurityGroups", p.ApplicationSecurityGroups) + populate(objectMap, "customDnsConfigs", p.CustomDNSConfigs) + populate(objectMap, "customNetworkInterfaceName", p.CustomNetworkInterfaceName) + populate(objectMap, "ipConfigurations", p.IPConfigurations) + populate(objectMap, "manualPrivateLinkServiceConnections", p.ManualPrivateLinkServiceConnections) + populate(objectMap, "networkInterfaces", p.NetworkInterfaces) + populate(objectMap, "privateLinkServiceConnections", p.PrivateLinkServiceConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "subnet", p.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperties. +func (p *PrivateEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &p.ApplicationSecurityGroups) + delete(rawMsg, key) + case "customDnsConfigs": + err = unpopulate(val, "CustomDNSConfigs", &p.CustomDNSConfigs) + delete(rawMsg, key) + case "customNetworkInterfaceName": + err = unpopulate(val, "CustomNetworkInterfaceName", &p.CustomNetworkInterfaceName) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &p.IPConfigurations) + delete(rawMsg, key) + case "manualPrivateLinkServiceConnections": + err = unpopulate(val, "ManualPrivateLinkServiceConnections", &p.ManualPrivateLinkServiceConnections) + delete(rawMsg, key) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &p.NetworkInterfaces) + delete(rawMsg, key) + case "privateLinkServiceConnections": + err = unpopulate(val, "PrivateLinkServiceConnections", &p.PrivateLinkServiceConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &p.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkService. +func (p PrivateLinkService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkService. +func (p *PrivateLinkService) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnection. +func (p *PrivateLinkServiceConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionProperties. +func (p PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "privateLinkServiceId", p.PrivateLinkServiceID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionProperties. +func (p *PrivateLinkServiceConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "privateLinkServiceId": + err = unpopulate(val, "PrivateLinkServiceID", &p.PrivateLinkServiceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &p.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceIPConfiguration. +func (p PrivateLinkServiceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceIPConfiguration. +func (p *PrivateLinkServiceIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceIPConfigurationProperties. +func (p PrivateLinkServiceIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "primary", p.Primary) + populate(objectMap, "privateIPAddress", p.PrivateIPAddress) + populate(objectMap, "privateIPAddressVersion", p.PrivateIPAddressVersion) + populate(objectMap, "privateIPAllocationMethod", p.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "subnet", p.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceIPConfigurationProperties. +func (p *PrivateLinkServiceIPConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primary": + err = unpopulate(val, "Primary", &p.Primary) + delete(rawMsg, key) + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &p.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAddressVersion": + err = unpopulate(val, "PrivateIPAddressVersion", &p.PrivateIPAddressVersion) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &p.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &p.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceListResult. +func (p PrivateLinkServiceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceListResult. +func (p *PrivateLinkServiceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProperties. +func (p PrivateLinkServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alias", p.Alias) + populate(objectMap, "autoApproval", p.AutoApproval) + populate(objectMap, "enableProxyProtocol", p.EnableProxyProtocol) + populate(objectMap, "fqdns", p.Fqdns) + populate(objectMap, "ipConfigurations", p.IPConfigurations) + populate(objectMap, "loadBalancerFrontendIpConfigurations", p.LoadBalancerFrontendIPConfigurations) + populate(objectMap, "networkInterfaces", p.NetworkInterfaces) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "visibility", p.Visibility) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceProperties. +func (p *PrivateLinkServiceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alias": + err = unpopulate(val, "Alias", &p.Alias) + delete(rawMsg, key) + case "autoApproval": + err = unpopulate(val, "AutoApproval", &p.AutoApproval) + delete(rawMsg, key) + case "enableProxyProtocol": + err = unpopulate(val, "EnableProxyProtocol", &p.EnableProxyProtocol) + delete(rawMsg, key) + case "fqdns": + err = unpopulate(val, "Fqdns", &p.Fqdns) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &p.IPConfigurations) + delete(rawMsg, key) + case "loadBalancerFrontendIpConfigurations": + err = unpopulate(val, "LoadBalancerFrontendIPConfigurations", &p.LoadBalancerFrontendIPConfigurations) + delete(rawMsg, key) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &p.NetworkInterfaces) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "visibility": + err = unpopulate(val, "Visibility", &p.Visibility) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicePropertiesAutoApproval. +func (p PrivateLinkServicePropertiesAutoApproval) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptions", p.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServicePropertiesAutoApproval. +func (p *PrivateLinkServicePropertiesAutoApproval) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subscriptions": + err = unpopulate(val, "Subscriptions", &p.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServicePropertiesVisibility. +func (p PrivateLinkServicePropertiesVisibility) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptions", p.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServicePropertiesVisibility. +func (p *PrivateLinkServicePropertiesVisibility) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subscriptions": + err = unpopulate(val, "Subscriptions", &p.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceVisibility. +func (p PrivateLinkServiceVisibility) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "visible", p.Visible) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceVisibility. +func (p *PrivateLinkServiceVisibility) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "visible": + err = unpopulate(val, "Visible", &p.Visible) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Probe. +func (p Probe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Probe. +func (p *Probe) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProbePropertiesFormat. +func (p ProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "intervalInSeconds", p.IntervalInSeconds) + populate(objectMap, "loadBalancingRules", p.LoadBalancingRules) + populate(objectMap, "numberOfProbes", p.NumberOfProbes) + populate(objectMap, "port", p.Port) + populate(objectMap, "probeThreshold", p.ProbeThreshold) + populate(objectMap, "protocol", p.Protocol) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requestPath", p.RequestPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProbePropertiesFormat. +func (p *ProbePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "intervalInSeconds": + err = unpopulate(val, "IntervalInSeconds", &p.IntervalInSeconds) + delete(rawMsg, key) + case "loadBalancingRules": + err = unpopulate(val, "LoadBalancingRules", &p.LoadBalancingRules) + delete(rawMsg, key) + case "numberOfProbes": + err = unpopulate(val, "NumberOfProbes", &p.NumberOfProbes) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &p.Port) + delete(rawMsg, key) + case "probeThreshold": + err = unpopulate(val, "ProbeThreshold", &p.ProbeThreshold) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requestPath": + err = unpopulate(val, "RequestPath", &p.RequestPath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Profile. +func (p *Profile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfileListResult. +func (p ProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileListResult. +func (p *ProfileListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfilePropertiesFormat. +func (p ProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerNetworkInterfaceConfigurations", p.ContainerNetworkInterfaceConfigurations) + populate(objectMap, "containerNetworkInterfaces", p.ContainerNetworkInterfaces) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "resourceGuid", p.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfilePropertiesFormat. +func (p *ProfilePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "containerNetworkInterfaceConfigurations": + err = unpopulate(val, "ContainerNetworkInterfaceConfigurations", &p.ContainerNetworkInterfaceConfigurations) + delete(rawMsg, key) + case "containerNetworkInterfaces": + err = unpopulate(val, "ContainerNetworkInterfaces", &p.ContainerNetworkInterfaces) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &p.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropagatedRouteTable. +func (p PropagatedRouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ids", p.IDs) + populate(objectMap, "labels", p.Labels) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropagatedRouteTable. +func (p *PropagatedRouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ids": + err = unpopulate(val, "IDs", &p.IDs) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &p.Labels) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtocolConfiguration. +func (p ProtocolConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "HTTPConfiguration", p.HTTPConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtocolConfiguration. +func (p *ProtocolConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "HTTPConfiguration": + err = unpopulate(val, "HTTPConfiguration", &p.HTTPConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddress. +func (p PublicIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + populate(objectMap, "zones", p.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddress. +func (p *PublicIPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &p.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressDNSSettings. +func (p PublicIPAddressDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domainNameLabel", p.DomainNameLabel) + populate(objectMap, "fqdn", p.Fqdn) + populate(objectMap, "reverseFqdn", p.ReverseFqdn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressDNSSettings. +func (p *PublicIPAddressDNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainNameLabel": + err = unpopulate(val, "DomainNameLabel", &p.DomainNameLabel) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &p.Fqdn) + delete(rawMsg, key) + case "reverseFqdn": + err = unpopulate(val, "ReverseFqdn", &p.ReverseFqdn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressListResult. +func (p PublicIPAddressListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressListResult. +func (p *PublicIPAddressListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressPropertiesFormat. +func (p PublicIPAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dnsSettings", p.DNSSettings) + populate(objectMap, "ddosSettings", p.DdosSettings) + populate(objectMap, "deleteOption", p.DeleteOption) + populate(objectMap, "ipAddress", p.IPAddress) + populate(objectMap, "ipConfiguration", p.IPConfiguration) + populate(objectMap, "ipTags", p.IPTags) + populate(objectMap, "idleTimeoutInMinutes", p.IdleTimeoutInMinutes) + populate(objectMap, "linkedPublicIPAddress", p.LinkedPublicIPAddress) + populate(objectMap, "migrationPhase", p.MigrationPhase) + populate(objectMap, "natGateway", p.NatGateway) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicIPAddressVersion", p.PublicIPAddressVersion) + populate(objectMap, "publicIPAllocationMethod", p.PublicIPAllocationMethod) + populate(objectMap, "publicIPPrefix", p.PublicIPPrefix) + populate(objectMap, "resourceGuid", p.ResourceGUID) + populate(objectMap, "servicePublicIPAddress", p.ServicePublicIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressPropertiesFormat. +func (p *PublicIPAddressPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &p.DNSSettings) + delete(rawMsg, key) + case "ddosSettings": + err = unpopulate(val, "DdosSettings", &p.DdosSettings) + delete(rawMsg, key) + case "deleteOption": + err = unpopulate(val, "DeleteOption", &p.DeleteOption) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &p.IPAddress) + delete(rawMsg, key) + case "ipConfiguration": + err = unpopulate(val, "IPConfiguration", &p.IPConfiguration) + delete(rawMsg, key) + case "ipTags": + err = unpopulate(val, "IPTags", &p.IPTags) + delete(rawMsg, key) + case "idleTimeoutInMinutes": + err = unpopulate(val, "IdleTimeoutInMinutes", &p.IdleTimeoutInMinutes) + delete(rawMsg, key) + case "linkedPublicIPAddress": + err = unpopulate(val, "LinkedPublicIPAddress", &p.LinkedPublicIPAddress) + delete(rawMsg, key) + case "migrationPhase": + err = unpopulate(val, "MigrationPhase", &p.MigrationPhase) + delete(rawMsg, key) + case "natGateway": + err = unpopulate(val, "NatGateway", &p.NatGateway) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddressVersion": + err = unpopulate(val, "PublicIPAddressVersion", &p.PublicIPAddressVersion) + delete(rawMsg, key) + case "publicIPAllocationMethod": + err = unpopulate(val, "PublicIPAllocationMethod", &p.PublicIPAllocationMethod) + delete(rawMsg, key) + case "publicIPPrefix": + err = unpopulate(val, "PublicIPPrefix", &p.PublicIPPrefix) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &p.ResourceGUID) + delete(rawMsg, key) + case "servicePublicIPAddress": + err = unpopulate(val, "ServicePublicIPAddress", &p.ServicePublicIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressSKU. +func (p PublicIPAddressSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "tier", p.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressSKU. +func (p *PublicIPAddressSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPDdosProtectionStatusResult. +func (p PublicIPDdosProtectionStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ddosProtectionPlanId", p.DdosProtectionPlanID) + populate(objectMap, "isWorkloadProtected", p.IsWorkloadProtected) + populate(objectMap, "publicIpAddress", p.PublicIPAddress) + populate(objectMap, "publicIpAddressId", p.PublicIPAddressID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPDdosProtectionStatusResult. +func (p *PublicIPDdosProtectionStatusResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ddosProtectionPlanId": + err = unpopulate(val, "DdosProtectionPlanID", &p.DdosProtectionPlanID) + delete(rawMsg, key) + case "isWorkloadProtected": + err = unpopulate(val, "IsWorkloadProtected", &p.IsWorkloadProtected) + delete(rawMsg, key) + case "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &p.PublicIPAddress) + delete(rawMsg, key) + case "publicIpAddressId": + err = unpopulate(val, "PublicIPAddressID", &p.PublicIPAddressID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPPrefix. +func (p PublicIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + populate(objectMap, "zones", p.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPPrefix. +func (p *PublicIPPrefix) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &p.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPPrefixListResult. +func (p PublicIPPrefixListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPPrefixListResult. +func (p *PublicIPPrefixListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPPrefixPropertiesFormat. +func (p PublicIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customIPPrefix", p.CustomIPPrefix) + populate(objectMap, "ipPrefix", p.IPPrefix) + populate(objectMap, "ipTags", p.IPTags) + populate(objectMap, "loadBalancerFrontendIpConfiguration", p.LoadBalancerFrontendIPConfiguration) + populate(objectMap, "natGateway", p.NatGateway) + populate(objectMap, "prefixLength", p.PrefixLength) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicIPAddressVersion", p.PublicIPAddressVersion) + populate(objectMap, "publicIPAddresses", p.PublicIPAddresses) + populate(objectMap, "resourceGuid", p.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPPrefixPropertiesFormat. +func (p *PublicIPPrefixPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customIPPrefix": + err = unpopulate(val, "CustomIPPrefix", &p.CustomIPPrefix) + delete(rawMsg, key) + case "ipPrefix": + err = unpopulate(val, "IPPrefix", &p.IPPrefix) + delete(rawMsg, key) + case "ipTags": + err = unpopulate(val, "IPTags", &p.IPTags) + delete(rawMsg, key) + case "loadBalancerFrontendIpConfiguration": + err = unpopulate(val, "LoadBalancerFrontendIPConfiguration", &p.LoadBalancerFrontendIPConfiguration) + delete(rawMsg, key) + case "natGateway": + err = unpopulate(val, "NatGateway", &p.NatGateway) + delete(rawMsg, key) + case "prefixLength": + err = unpopulate(val, "PrefixLength", &p.PrefixLength) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddressVersion": + err = unpopulate(val, "PublicIPAddressVersion", &p.PublicIPAddressVersion) + delete(rawMsg, key) + case "publicIPAddresses": + err = unpopulate(val, "PublicIPAddresses", &p.PublicIPAddresses) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &p.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPPrefixSKU. +func (p PublicIPPrefixSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", p.Name) + populate(objectMap, "tier", p.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPPrefixSKU. +func (p *PublicIPPrefixSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QosDefinition. +func (q QosDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationIpRanges", q.DestinationIPRanges) + populate(objectMap, "destinationPortRanges", q.DestinationPortRanges) + populate(objectMap, "markings", q.Markings) + populate(objectMap, "protocol", q.Protocol) + populate(objectMap, "sourceIpRanges", q.SourceIPRanges) + populate(objectMap, "sourcePortRanges", q.SourcePortRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QosDefinition. +func (q *QosDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationIpRanges": + err = unpopulate(val, "DestinationIPRanges", &q.DestinationIPRanges) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &q.DestinationPortRanges) + delete(rawMsg, key) + case "markings": + err = unpopulate(val, "Markings", &q.Markings) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &q.Protocol) + delete(rawMsg, key) + case "sourceIpRanges": + err = unpopulate(val, "SourceIPRanges", &q.SourceIPRanges) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &q.SourcePortRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QosIPRange. +func (q QosIPRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endIP", q.EndIP) + populate(objectMap, "startIP", q.StartIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QosIPRange. +func (q *QosIPRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIP": + err = unpopulate(val, "EndIP", &q.EndIP) + delete(rawMsg, key) + case "startIP": + err = unpopulate(val, "StartIP", &q.StartIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QosPortRange. +func (q QosPortRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "end", q.End) + populate(objectMap, "start", q.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QosPortRange. +func (q *QosPortRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "end": + err = unpopulate(val, "End", &q.End) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &q.Start) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryInboundNatRulePortMappingRequest. +func (q QueryInboundNatRulePortMappingRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipAddress", q.IPAddress) + populate(objectMap, "ipConfiguration", q.IPConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryInboundNatRulePortMappingRequest. +func (q *QueryInboundNatRulePortMappingRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddress": + err = unpopulate(val, "IPAddress", &q.IPAddress) + delete(rawMsg, key) + case "ipConfiguration": + err = unpopulate(val, "IPConfiguration", &q.IPConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryRequestOptions. +func (q QueryRequestOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skipToken", q.SkipToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryRequestOptions. +func (q *QueryRequestOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "skipToken": + err = unpopulate(val, "SkipToken", &q.SkipToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryResults. +func (q QueryResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchingRecordsCount", q.MatchingRecordsCount) + populate(objectMap, "signatures", q.Signatures) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryResults. +func (q *QueryResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "matchingRecordsCount": + err = unpopulate(val, "MatchingRecordsCount", &q.MatchingRecordsCount) + delete(rawMsg, key) + case "signatures": + err = unpopulate(val, "Signatures", &q.Signatures) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryTroubleshootingParameters. +func (q QueryTroubleshootingParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targetResourceId", q.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTroubleshootingParameters. +func (q *QueryTroubleshootingParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &q.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RadiusServer. +func (r RadiusServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "radiusServerAddress", r.RadiusServerAddress) + populate(objectMap, "radiusServerScore", r.RadiusServerScore) + populate(objectMap, "radiusServerSecret", r.RadiusServerSecret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RadiusServer. +func (r *RadiusServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "radiusServerAddress": + err = unpopulate(val, "RadiusServerAddress", &r.RadiusServerAddress) + delete(rawMsg, key) + case "radiusServerScore": + err = unpopulate(val, "RadiusServerScore", &r.RadiusServerScore) + delete(rawMsg, key) + case "radiusServerSecret": + err = unpopulate(val, "RadiusServerSecret", &r.RadiusServerSecret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecordSet. +func (r RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fqdn", r.Fqdn) + populate(objectMap, "ipAddresses", r.IPAddresses) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "recordSetName", r.RecordSetName) + populate(objectMap, "recordType", r.RecordType) + populate(objectMap, "ttl", r.TTL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordSet. +func (r *RecordSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fqdn": + err = unpopulate(val, "Fqdn", &r.Fqdn) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &r.IPAddresses) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "recordSetName": + err = unpopulate(val, "RecordSetName", &r.RecordSetName) + delete(rawMsg, key) + case "recordType": + err = unpopulate(val, "RecordType", &r.RecordType) + delete(rawMsg, key) + case "ttl": + err = unpopulate(val, "TTL", &r.TTL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReferencedPublicIPAddress. +func (r ReferencedPublicIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferencedPublicIPAddress. +func (r *ReferencedPublicIPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceNavigationLink. +func (r ResourceNavigationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNavigationLink. +func (r *ResourceNavigationLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceNavigationLinkFormat. +func (r ResourceNavigationLinkFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "link", r.Link) + populate(objectMap, "linkedResourceType", r.LinkedResourceType) + populate(objectMap, "provisioningState", r.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNavigationLinkFormat. +func (r *ResourceNavigationLinkFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "link": + err = unpopulate(val, "Link", &r.Link) + delete(rawMsg, key) + case "linkedResourceType": + err = unpopulate(val, "LinkedResourceType", &r.LinkedResourceType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceNavigationLinksListResult. +func (r ResourceNavigationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNavigationLinksListResult. +func (r *ResourceNavigationLinksListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSet. +func (r ResourceSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptions", r.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSet. +func (r *ResourceSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subscriptions": + err = unpopulate(val, "Subscriptions", &r.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetentionPolicyParameters. +func (r RetentionPolicyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "days", r.Days) + populate(objectMap, "enabled", r.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicyParameters. +func (r *RetentionPolicyParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "days": + err = unpopulate(val, "Days", &r.Days) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Route. +func (r *Route) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilter. +func (r RouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilter. +func (r *RouteFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilterListResult. +func (r RouteFilterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilterListResult. +func (r *RouteFilterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilterPropertiesFormat. +func (r RouteFilterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipv6Peerings", r.IPv6Peerings) + populate(objectMap, "peerings", r.Peerings) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "rules", r.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilterPropertiesFormat. +func (r *RouteFilterPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipv6Peerings": + err = unpopulate(val, "IPv6Peerings", &r.IPv6Peerings) + delete(rawMsg, key) + case "peerings": + err = unpopulate(val, "Peerings", &r.Peerings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &r.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilterRule. +func (r RouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilterRule. +func (r *RouteFilterRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilterRuleListResult. +func (r RouteFilterRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilterRuleListResult. +func (r *RouteFilterRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteFilterRulePropertiesFormat. +func (r RouteFilterRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", r.Access) + populate(objectMap, "communities", r.Communities) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "routeFilterRuleType", r.RouteFilterRuleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteFilterRulePropertiesFormat. +func (r *RouteFilterRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &r.Access) + delete(rawMsg, key) + case "communities": + err = unpopulate(val, "Communities", &r.Communities) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "routeFilterRuleType": + err = unpopulate(val, "RouteFilterRuleType", &r.RouteFilterRuleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteListResult. +func (r RouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteListResult. +func (r *RouteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteMap. +func (r RouteMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteMap. +func (r *RouteMap) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteMapProperties. +func (r RouteMapProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associatedInboundConnections", r.AssociatedInboundConnections) + populate(objectMap, "associatedOutboundConnections", r.AssociatedOutboundConnections) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "rules", r.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteMapProperties. +func (r *RouteMapProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associatedInboundConnections": + err = unpopulate(val, "AssociatedInboundConnections", &r.AssociatedInboundConnections) + delete(rawMsg, key) + case "associatedOutboundConnections": + err = unpopulate(val, "AssociatedOutboundConnections", &r.AssociatedOutboundConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &r.Rules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteMapRule. +func (r RouteMapRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", r.Actions) + populate(objectMap, "matchCriteria", r.MatchCriteria) + populate(objectMap, "name", r.Name) + populate(objectMap, "nextStepIfMatched", r.NextStepIfMatched) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteMapRule. +func (r *RouteMapRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &r.Actions) + delete(rawMsg, key) + case "matchCriteria": + err = unpopulate(val, "MatchCriteria", &r.MatchCriteria) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "nextStepIfMatched": + err = unpopulate(val, "NextStepIfMatched", &r.NextStepIfMatched) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutePropertiesFormat. +func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", r.AddressPrefix) + populate(objectMap, "hasBgpOverride", r.HasBgpOverride) + populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + populate(objectMap, "nextHopType", r.NextHopType) + populate(objectMap, "provisioningState", r.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. +func (r *RoutePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + delete(rawMsg, key) + case "hasBgpOverride": + err = unpopulate(val, "HasBgpOverride", &r.HasBgpOverride) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &r.NextHopType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTable. +func (r RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. +func (r *RouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTableListResult. +func (r RouteTableListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTableListResult. +func (r *RouteTableListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTablePropertiesFormat. +func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableBgpRoutePropagation", r.DisableBgpRoutePropagation) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "resourceGuid", r.ResourceGUID) + populate(objectMap, "routes", r.Routes) + populate(objectMap, "subnets", r.Subnets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. +func (r *RouteTablePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "disableBgpRoutePropagation": + err = unpopulate(val, "DisableBgpRoutePropagation", &r.DisableBgpRoutePropagation) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &r.ResourceGUID) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &r.Routes) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &r.Subnets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingConfiguration. +func (r RoutingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associatedRouteTable", r.AssociatedRouteTable) + populate(objectMap, "inboundRouteMap", r.InboundRouteMap) + populate(objectMap, "outboundRouteMap", r.OutboundRouteMap) + populate(objectMap, "propagatedRouteTables", r.PropagatedRouteTables) + populate(objectMap, "vnetRoutes", r.VnetRoutes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingConfiguration. +func (r *RoutingConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associatedRouteTable": + err = unpopulate(val, "AssociatedRouteTable", &r.AssociatedRouteTable) + delete(rawMsg, key) + case "inboundRouteMap": + err = unpopulate(val, "InboundRouteMap", &r.InboundRouteMap) + delete(rawMsg, key) + case "outboundRouteMap": + err = unpopulate(val, "OutboundRouteMap", &r.OutboundRouteMap) + delete(rawMsg, key) + case "propagatedRouteTables": + err = unpopulate(val, "PropagatedRouteTables", &r.PropagatedRouteTables) + delete(rawMsg, key) + case "vnetRoutes": + err = unpopulate(val, "VnetRoutes", &r.VnetRoutes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingIntent. +func (r RoutingIntent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingIntent. +func (r *RoutingIntent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingIntentProperties. +func (r RoutingIntentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "routingPolicies", r.RoutingPolicies) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingIntentProperties. +func (r *RoutingIntentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "routingPolicies": + err = unpopulate(val, "RoutingPolicies", &r.RoutingPolicies) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingPolicy. +func (r RoutingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinations", r.Destinations) + populate(objectMap, "name", r.Name) + populate(objectMap, "nextHop", r.NextHop) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingPolicy. +func (r *RoutingPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinations": + err = unpopulate(val, "Destinations", &r.Destinations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "nextHop": + err = unpopulate(val, "NextHop", &r.NextHop) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "destinationAddresses", r.DestinationAddresses) + populate(objectMap, "destinationFqdns", r.DestinationFqdns) + populate(objectMap, "destinationIpGroups", r.DestinationIPGroups) + populate(objectMap, "destinationPorts", r.DestinationPorts) + populate(objectMap, "ipProtocols", r.IPProtocols) + populate(objectMap, "name", r.Name) + objectMap["ruleType"] = FirewallPolicyRuleTypeNetworkRule + populate(objectMap, "sourceAddresses", r.SourceAddresses) + populate(objectMap, "sourceIpGroups", r.SourceIPGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Rule. +func (r *Rule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "destinationAddresses": + err = unpopulate(val, "DestinationAddresses", &r.DestinationAddresses) + delete(rawMsg, key) + case "destinationFqdns": + err = unpopulate(val, "DestinationFqdns", &r.DestinationFqdns) + delete(rawMsg, key) + case "destinationIpGroups": + err = unpopulate(val, "DestinationIPGroups", &r.DestinationIPGroups) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &r.DestinationPorts) + delete(rawMsg, key) + case "ipProtocols": + err = unpopulate(val, "IPProtocols", &r.IPProtocols) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "sourceAddresses": + err = unpopulate(val, "SourceAddresses", &r.SourceAddresses) + delete(rawMsg, key) + case "sourceIpGroups": + err = unpopulate(val, "SourceIPGroups", &r.SourceIPGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopeConnection. +func (s ScopeConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeConnection. +func (s *ScopeConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopeConnectionListResult. +func (s ScopeConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeConnectionListResult. +func (s *ScopeConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopeConnectionProperties. +func (s ScopeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionState", s.ConnectionState) + populate(objectMap, "description", s.Description) + populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeConnectionProperties. +func (s *ScopeConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionState": + err = unpopulate(val, "ConnectionState", &s.ConnectionState) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAdminConfiguration. +func (s SecurityAdminConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAdminConfiguration. +func (s *SecurityAdminConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAdminConfigurationListResult. +func (s SecurityAdminConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAdminConfigurationListResult. +func (s *SecurityAdminConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAdminConfigurationPropertiesFormat. +func (s SecurityAdminConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applyOnNetworkIntentPolicyBasedServices", s.ApplyOnNetworkIntentPolicyBasedServices) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAdminConfigurationPropertiesFormat. +func (s *SecurityAdminConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applyOnNetworkIntentPolicyBasedServices": + err = unpopulate(val, "ApplyOnNetworkIntentPolicyBasedServices", &s.ApplyOnNetworkIntentPolicyBasedServices) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroup. +func (s SecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroup. +func (s *SecurityGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupListResult. +func (s SecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupListResult. +func (s *SecurityGroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupNetworkInterface. +func (s SecurityGroupNetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "securityRuleAssociations", s.SecurityRuleAssociations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupNetworkInterface. +func (s *SecurityGroupNetworkInterface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "securityRuleAssociations": + err = unpopulate(val, "SecurityRuleAssociations", &s.SecurityRuleAssociations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupPropertiesFormat. +func (s SecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultSecurityRules", s.DefaultSecurityRules) + populate(objectMap, "flowLogs", s.FlowLogs) + populate(objectMap, "flushConnection", s.FlushConnection) + populate(objectMap, "networkInterfaces", s.NetworkInterfaces) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceGuid", s.ResourceGUID) + populate(objectMap, "securityRules", s.SecurityRules) + populate(objectMap, "subnets", s.Subnets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupPropertiesFormat. +func (s *SecurityGroupPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultSecurityRules": + err = unpopulate(val, "DefaultSecurityRules", &s.DefaultSecurityRules) + delete(rawMsg, key) + case "flowLogs": + err = unpopulate(val, "FlowLogs", &s.FlowLogs) + delete(rawMsg, key) + case "flushConnection": + err = unpopulate(val, "FlushConnection", &s.FlushConnection) + delete(rawMsg, key) + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &s.NetworkInterfaces) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &s.ResourceGUID) + delete(rawMsg, key) + case "securityRules": + err = unpopulate(val, "SecurityRules", &s.SecurityRules) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &s.Subnets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupResult. +func (s SecurityGroupResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "evaluatedNetworkSecurityGroups", s.EvaluatedNetworkSecurityGroups) + populate(objectMap, "securityRuleAccessResult", s.SecurityRuleAccessResult) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupResult. +func (s *SecurityGroupResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "evaluatedNetworkSecurityGroups": + err = unpopulate(val, "EvaluatedNetworkSecurityGroups", &s.EvaluatedNetworkSecurityGroups) + delete(rawMsg, key) + case "securityRuleAccessResult": + err = unpopulate(val, "SecurityRuleAccessResult", &s.SecurityRuleAccessResult) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupViewParameters. +func (s SecurityGroupViewParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targetResourceId", s.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupViewParameters. +func (s *SecurityGroupViewParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &s.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupViewResult. +func (s SecurityGroupViewResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterfaces", s.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupViewResult. +func (s *SecurityGroupViewResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &s.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityPartnerProvider. +func (s SecurityPartnerProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPartnerProvider. +func (s *SecurityPartnerProvider) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityPartnerProviderListResult. +func (s SecurityPartnerProviderListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPartnerProviderListResult. +func (s *SecurityPartnerProviderListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityPartnerProviderPropertiesFormat. +func (s SecurityPartnerProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionStatus", s.ConnectionStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "securityProviderName", s.SecurityProviderName) + populate(objectMap, "virtualHub", s.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityPartnerProviderPropertiesFormat. +func (s *SecurityPartnerProviderPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &s.ConnectionStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "securityProviderName": + err = unpopulate(val, "SecurityProviderName", &s.SecurityProviderName) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &s.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityRule. +func (s SecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityRule. +func (s *SecurityRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityRuleAssociations. +func (s SecurityRuleAssociations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultSecurityRules", s.DefaultSecurityRules) + populate(objectMap, "effectiveSecurityRules", s.EffectiveSecurityRules) + populate(objectMap, "networkInterfaceAssociation", s.NetworkInterfaceAssociation) + populate(objectMap, "subnetAssociation", s.SubnetAssociation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityRuleAssociations. +func (s *SecurityRuleAssociations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultSecurityRules": + err = unpopulate(val, "DefaultSecurityRules", &s.DefaultSecurityRules) + delete(rawMsg, key) + case "effectiveSecurityRules": + err = unpopulate(val, "EffectiveSecurityRules", &s.EffectiveSecurityRules) + delete(rawMsg, key) + case "networkInterfaceAssociation": + err = unpopulate(val, "NetworkInterfaceAssociation", &s.NetworkInterfaceAssociation) + delete(rawMsg, key) + case "subnetAssociation": + err = unpopulate(val, "SubnetAssociation", &s.SubnetAssociation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityRuleListResult. +func (s SecurityRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityRuleListResult. +func (s *SecurityRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityRulePropertiesFormat. +func (s SecurityRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", s.Access) + populate(objectMap, "description", s.Description) + populate(objectMap, "destinationAddressPrefix", s.DestinationAddressPrefix) + populate(objectMap, "destinationAddressPrefixes", s.DestinationAddressPrefixes) + populate(objectMap, "destinationApplicationSecurityGroups", s.DestinationApplicationSecurityGroups) + populate(objectMap, "destinationPortRange", s.DestinationPortRange) + populate(objectMap, "destinationPortRanges", s.DestinationPortRanges) + populate(objectMap, "direction", s.Direction) + populate(objectMap, "priority", s.Priority) + populate(objectMap, "protocol", s.Protocol) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sourceAddressPrefix", s.SourceAddressPrefix) + populate(objectMap, "sourceAddressPrefixes", s.SourceAddressPrefixes) + populate(objectMap, "sourceApplicationSecurityGroups", s.SourceApplicationSecurityGroups) + populate(objectMap, "sourcePortRange", s.SourcePortRange) + populate(objectMap, "sourcePortRanges", s.SourcePortRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityRulePropertiesFormat. +func (s *SecurityRulePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &s.Access) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "destinationAddressPrefix": + err = unpopulate(val, "DestinationAddressPrefix", &s.DestinationAddressPrefix) + delete(rawMsg, key) + case "destinationAddressPrefixes": + err = unpopulate(val, "DestinationAddressPrefixes", &s.DestinationAddressPrefixes) + delete(rawMsg, key) + case "destinationApplicationSecurityGroups": + err = unpopulate(val, "DestinationApplicationSecurityGroups", &s.DestinationApplicationSecurityGroups) + delete(rawMsg, key) + case "destinationPortRange": + err = unpopulate(val, "DestinationPortRange", &s.DestinationPortRange) + delete(rawMsg, key) + case "destinationPortRanges": + err = unpopulate(val, "DestinationPortRanges", &s.DestinationPortRanges) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &s.Direction) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &s.Priority) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &s.Protocol) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "sourceAddressPrefix": + err = unpopulate(val, "SourceAddressPrefix", &s.SourceAddressPrefix) + delete(rawMsg, key) + case "sourceAddressPrefixes": + err = unpopulate(val, "SourceAddressPrefixes", &s.SourceAddressPrefixes) + delete(rawMsg, key) + case "sourceApplicationSecurityGroups": + err = unpopulate(val, "SourceApplicationSecurityGroups", &s.SourceApplicationSecurityGroups) + delete(rawMsg, key) + case "sourcePortRange": + err = unpopulate(val, "SourcePortRange", &s.SourcePortRange) + delete(rawMsg, key) + case "sourcePortRanges": + err = unpopulate(val, "SourcePortRanges", &s.SourcePortRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityRulesEvaluationResult. +func (s SecurityRulesEvaluationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationMatched", s.DestinationMatched) + populate(objectMap, "destinationPortMatched", s.DestinationPortMatched) + populate(objectMap, "name", s.Name) + populate(objectMap, "protocolMatched", s.ProtocolMatched) + populate(objectMap, "sourceMatched", s.SourceMatched) + populate(objectMap, "sourcePortMatched", s.SourcePortMatched) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityRulesEvaluationResult. +func (s *SecurityRulesEvaluationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationMatched": + err = unpopulate(val, "DestinationMatched", &s.DestinationMatched) + delete(rawMsg, key) + case "destinationPortMatched": + err = unpopulate(val, "DestinationPortMatched", &s.DestinationPortMatched) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "protocolMatched": + err = unpopulate(val, "ProtocolMatched", &s.ProtocolMatched) + delete(rawMsg, key) + case "sourceMatched": + err = unpopulate(val, "SourceMatched", &s.SourceMatched) + delete(rawMsg, key) + case "sourcePortMatched": + err = unpopulate(val, "SourcePortMatched", &s.SourcePortMatched) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceAssociationLink. +func (s ServiceAssociationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceAssociationLink. +func (s *ServiceAssociationLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceAssociationLinkPropertiesFormat. +func (s ServiceAssociationLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowDelete", s.AllowDelete) + populate(objectMap, "link", s.Link) + populate(objectMap, "linkedResourceType", s.LinkedResourceType) + populate(objectMap, "locations", s.Locations) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceAssociationLinkPropertiesFormat. +func (s *ServiceAssociationLinkPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowDelete": + err = unpopulate(val, "AllowDelete", &s.AllowDelete) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &s.Link) + delete(rawMsg, key) + case "linkedResourceType": + err = unpopulate(val, "LinkedResourceType", &s.LinkedResourceType) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &s.Locations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceAssociationLinksListResult. +func (s ServiceAssociationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceAssociationLinksListResult. +func (s *ServiceAssociationLinksListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceDelegationPropertiesFormat. +func (s ServiceDelegationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "serviceName", s.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceDelegationPropertiesFormat. +func (s *ServiceDelegationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &s.Actions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &s.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicy. +func (s ServiceEndpointPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicy. +func (s *ServiceEndpointPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicyDefinition. +func (s ServiceEndpointPolicyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicyDefinition. +func (s *ServiceEndpointPolicyDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicyDefinitionListResult. +func (s ServiceEndpointPolicyDefinitionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicyDefinitionListResult. +func (s *ServiceEndpointPolicyDefinitionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicyDefinitionPropertiesFormat. +func (s ServiceEndpointPolicyDefinitionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "service", s.Service) + populate(objectMap, "serviceResources", s.ServiceResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicyDefinitionPropertiesFormat. +func (s *ServiceEndpointPolicyDefinitionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "service": + err = unpopulate(val, "Service", &s.Service) + delete(rawMsg, key) + case "serviceResources": + err = unpopulate(val, "ServiceResources", &s.ServiceResources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicyListResult. +func (s ServiceEndpointPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicyListResult. +func (s *ServiceEndpointPolicyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPolicyPropertiesFormat. +func (s ServiceEndpointPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contextualServiceEndpointPolicies", s.ContextualServiceEndpointPolicies) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceGuid", s.ResourceGUID) + populate(objectMap, "serviceAlias", s.ServiceAlias) + populate(objectMap, "serviceEndpointPolicyDefinitions", s.ServiceEndpointPolicyDefinitions) + populate(objectMap, "subnets", s.Subnets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPolicyPropertiesFormat. +func (s *ServiceEndpointPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contextualServiceEndpointPolicies": + err = unpopulate(val, "ContextualServiceEndpointPolicies", &s.ContextualServiceEndpointPolicies) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &s.ResourceGUID) + delete(rawMsg, key) + case "serviceAlias": + err = unpopulate(val, "ServiceAlias", &s.ServiceAlias) + delete(rawMsg, key) + case "serviceEndpointPolicyDefinitions": + err = unpopulate(val, "ServiceEndpointPolicyDefinitions", &s.ServiceEndpointPolicyDefinitions) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &s.Subnets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceEndpointPropertiesFormat. +func (s ServiceEndpointPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "locations", s.Locations) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "service", s.Service) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceEndpointPropertiesFormat. +func (s *ServiceEndpointPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locations": + err = unpopulate(val, "Locations", &s.Locations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "service": + err = unpopulate(val, "Service", &s.Service) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceTagInformation. +func (s ServiceTagInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "serviceTagChangeNumber", s.ServiceTagChangeNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceTagInformation. +func (s *ServiceTagInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "serviceTagChangeNumber": + err = unpopulate(val, "ServiceTagChangeNumber", &s.ServiceTagChangeNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceTagInformationListResult. +func (s ServiceTagInformationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceTagInformationListResult. +func (s *ServiceTagInformationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceTagInformationPropertiesFormat. +func (s ServiceTagInformationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "changeNumber", s.ChangeNumber) + populate(objectMap, "region", s.Region) + populate(objectMap, "state", s.State) + populate(objectMap, "systemService", s.SystemService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceTagInformationPropertiesFormat. +func (s *ServiceTagInformationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "changeNumber": + err = unpopulate(val, "ChangeNumber", &s.ChangeNumber) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &s.Region) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "systemService": + err = unpopulate(val, "SystemService", &s.SystemService) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceTagsListResult. +func (s ServiceTagsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "changeNumber", s.ChangeNumber) + populate(objectMap, "cloud", s.Cloud) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "type", s.Type) + populate(objectMap, "values", s.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceTagsListResult. +func (s *ServiceTagsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changeNumber": + err = unpopulate(val, "ChangeNumber", &s.ChangeNumber) + delete(rawMsg, key) + case "cloud": + err = unpopulate(val, "Cloud", &s.Cloud) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &s.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SessionIDs. +func (s SessionIDs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sessionIds", s.SessionIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SessionIDs. +func (s *SessionIDs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sessionIds": + err = unpopulate(val, "SessionIDs", &s.SessionIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SignatureOverridesFilterValuesQuery. +func (s SignatureOverridesFilterValuesQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterName", s.FilterName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignatureOverridesFilterValuesQuery. +func (s *SignatureOverridesFilterValuesQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filterName": + err = unpopulate(val, "FilterName", &s.FilterName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SignatureOverridesFilterValuesResponse. +func (s SignatureOverridesFilterValuesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterValues", s.FilterValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignatureOverridesFilterValuesResponse. +func (s *SignatureOverridesFilterValuesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filterValues": + err = unpopulate(val, "FilterValues", &s.FilterValues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverrides. +func (s SignaturesOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignaturesOverrides. +func (s *SignaturesOverrides) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverridesList. +func (s SignaturesOverridesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignaturesOverridesList. +func (s *SignaturesOverridesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverridesProperties. +func (s SignaturesOverridesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "signatures", s.Signatures) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SignaturesOverridesProperties. +func (s *SignaturesOverridesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "signatures": + err = unpopulate(val, "Signatures", &s.Signatures) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleQueryResult. +func (s SingleQueryResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "destinationPorts", s.DestinationPorts) + populate(objectMap, "direction", s.Direction) + populate(objectMap, "group", s.Group) + populate(objectMap, "inheritedFromParentPolicy", s.InheritedFromParentPolicy) + populate(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "mode", s.Mode) + populate(objectMap, "protocol", s.Protocol) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "signatureId", s.SignatureID) + populate(objectMap, "sourcePorts", s.SourcePorts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleQueryResult. +func (s *SingleQueryResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "destinationPorts": + err = unpopulate(val, "DestinationPorts", &s.DestinationPorts) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &s.Direction) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &s.Group) + delete(rawMsg, key) + case "inheritedFromParentPolicy": + err = unpopulate(val, "InheritedFromParentPolicy", &s.InheritedFromParentPolicy) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulate(val, "LastUpdated", &s.LastUpdated) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &s.Mode) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &s.Protocol) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "signatureId": + err = unpopulate(val, "SignatureID", &s.SignatureID) + delete(rawMsg, key) + case "sourcePorts": + err = unpopulate(val, "SourcePorts", &s.SourcePorts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticMember. +func (s StaticMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticMember. +func (s *StaticMember) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticMemberListResult. +func (s StaticMemberListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticMemberListResult. +func (s *StaticMemberListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticMemberProperties. +func (s StaticMemberProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "region", s.Region) + populate(objectMap, "resourceId", s.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticMemberProperties. +func (s *StaticMemberProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &s.Region) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticRoute. +func (s StaticRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "name", s.Name) + populate(objectMap, "nextHopIpAddress", s.NextHopIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticRoute. +func (s *StaticRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &s.NextHopIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StaticRoutesConfig. +func (s StaticRoutesConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "propagateStaticRoutes", s.PropagateStaticRoutes) + populate(objectMap, "vnetLocalRouteOverrideCriteria", s.VnetLocalRouteOverrideCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticRoutesConfig. +func (s *StaticRoutesConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "propagateStaticRoutes": + err = unpopulate(val, "PropagateStaticRoutes", &s.PropagateStaticRoutes) + delete(rawMsg, key) + case "vnetLocalRouteOverrideCriteria": + err = unpopulate(val, "VnetLocalRouteOverrideCriteria", &s.VnetLocalRouteOverrideCriteria) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetAssociation. +func (s SubnetAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "securityRules", s.SecurityRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetAssociation. +func (s *SubnetAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "securityRules": + err = unpopulate(val, "SecurityRules", &s.SecurityRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetListResult. +func (s SubnetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetListResult. +func (s *SubnetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. +func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", s.AddressPrefix) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "applicationGatewayIpConfigurations", s.ApplicationGatewayIPConfigurations) + populate(objectMap, "delegations", s.Delegations) + populate(objectMap, "ipAllocations", s.IPAllocations) + populate(objectMap, "ipConfigurationProfiles", s.IPConfigurationProfiles) + populate(objectMap, "ipConfigurations", s.IPConfigurations) + populate(objectMap, "natGateway", s.NatGateway) + populate(objectMap, "networkSecurityGroup", s.NetworkSecurityGroup) + populate(objectMap, "privateEndpointNetworkPolicies", s.PrivateEndpointNetworkPolicies) + populate(objectMap, "privateEndpoints", s.PrivateEndpoints) + populate(objectMap, "privateLinkServiceNetworkPolicies", s.PrivateLinkServiceNetworkPolicies) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "purpose", s.Purpose) + populate(objectMap, "resourceNavigationLinks", s.ResourceNavigationLinks) + populate(objectMap, "routeTable", s.RouteTable) + populate(objectMap, "serviceAssociationLinks", s.ServiceAssociationLinks) + populate(objectMap, "serviceEndpointPolicies", s.ServiceEndpointPolicies) + populate(objectMap, "serviceEndpoints", s.ServiceEndpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. +func (s *SubnetPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) + delete(rawMsg, key) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "applicationGatewayIpConfigurations": + err = unpopulate(val, "ApplicationGatewayIPConfigurations", &s.ApplicationGatewayIPConfigurations) + delete(rawMsg, key) + case "delegations": + err = unpopulate(val, "Delegations", &s.Delegations) + delete(rawMsg, key) + case "ipAllocations": + err = unpopulate(val, "IPAllocations", &s.IPAllocations) + delete(rawMsg, key) + case "ipConfigurationProfiles": + err = unpopulate(val, "IPConfigurationProfiles", &s.IPConfigurationProfiles) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &s.IPConfigurations) + delete(rawMsg, key) + case "natGateway": + err = unpopulate(val, "NatGateway", &s.NatGateway) + delete(rawMsg, key) + case "networkSecurityGroup": + err = unpopulate(val, "NetworkSecurityGroup", &s.NetworkSecurityGroup) + delete(rawMsg, key) + case "privateEndpointNetworkPolicies": + err = unpopulate(val, "PrivateEndpointNetworkPolicies", &s.PrivateEndpointNetworkPolicies) + delete(rawMsg, key) + case "privateEndpoints": + err = unpopulate(val, "PrivateEndpoints", &s.PrivateEndpoints) + delete(rawMsg, key) + case "privateLinkServiceNetworkPolicies": + err = unpopulate(val, "PrivateLinkServiceNetworkPolicies", &s.PrivateLinkServiceNetworkPolicies) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "purpose": + err = unpopulate(val, "Purpose", &s.Purpose) + delete(rawMsg, key) + case "resourceNavigationLinks": + err = unpopulate(val, "ResourceNavigationLinks", &s.ResourceNavigationLinks) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &s.RouteTable) + delete(rawMsg, key) + case "serviceAssociationLinks": + err = unpopulate(val, "ServiceAssociationLinks", &s.ServiceAssociationLinks) + delete(rawMsg, key) + case "serviceEndpointPolicies": + err = unpopulate(val, "ServiceEndpointPolicies", &s.ServiceEndpointPolicies) + delete(rawMsg, key) + case "serviceEndpoints": + err = unpopulate(val, "ServiceEndpoints", &s.ServiceEndpoints) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SwapResource. +func (s SwapResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SwapResource. +func (s *SwapResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SwapResourceListResult. +func (s SwapResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SwapResourceListResult. +func (s *SwapResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SwapResourceProperties. +func (s SwapResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "slotType", s.SlotType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SwapResourceProperties. +func (s *SwapResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "slotType": + err = unpopulate(val, "SlotType", &s.SlotType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsObject. +func (t TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsObject. +func (t *TagsObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Topology. +func (t Topology) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdDateTime", t.CreatedDateTime) + populate(objectMap, "id", t.ID) + populateTimeRFC3339(objectMap, "lastModified", t.LastModified) + populate(objectMap, "resources", t.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Topology. +func (t *Topology) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &t.CreatedDateTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &t.LastModified) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &t.Resources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TopologyAssociation. +func (t TopologyAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associationType", t.AssociationType) + populate(objectMap, "name", t.Name) + populate(objectMap, "resourceId", t.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyAssociation. +func (t *TopologyAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associationType": + err = unpopulate(val, "AssociationType", &t.AssociationType) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TopologyParameters. +func (t TopologyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "targetResourceGroupName", t.TargetResourceGroupName) + populate(objectMap, "targetSubnet", t.TargetSubnet) + populate(objectMap, "targetVirtualNetwork", t.TargetVirtualNetwork) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyParameters. +func (t *TopologyParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetResourceGroupName": + err = unpopulate(val, "TargetResourceGroupName", &t.TargetResourceGroupName) + delete(rawMsg, key) + case "targetSubnet": + err = unpopulate(val, "TargetSubnet", &t.TargetSubnet) + delete(rawMsg, key) + case "targetVirtualNetwork": + err = unpopulate(val, "TargetVirtualNetwork", &t.TargetVirtualNetwork) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TopologyResource. +func (t TopologyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "associations", t.Associations) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResource. +func (t *TopologyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associations": + err = unpopulate(val, "Associations", &t.Associations) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficAnalyticsConfigurationProperties. +func (t TrafficAnalyticsConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", t.Enabled) + populate(objectMap, "trafficAnalyticsInterval", t.TrafficAnalyticsInterval) + populate(objectMap, "workspaceId", t.WorkspaceID) + populate(objectMap, "workspaceRegion", t.WorkspaceRegion) + populate(objectMap, "workspaceResourceId", t.WorkspaceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficAnalyticsConfigurationProperties. +func (t *TrafficAnalyticsConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &t.Enabled) + delete(rawMsg, key) + case "trafficAnalyticsInterval": + err = unpopulate(val, "TrafficAnalyticsInterval", &t.TrafficAnalyticsInterval) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &t.WorkspaceID) + delete(rawMsg, key) + case "workspaceRegion": + err = unpopulate(val, "WorkspaceRegion", &t.WorkspaceRegion) + delete(rawMsg, key) + case "workspaceResourceId": + err = unpopulate(val, "WorkspaceResourceID", &t.WorkspaceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficAnalyticsProperties. +func (t TrafficAnalyticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkWatcherFlowAnalyticsConfiguration", t.NetworkWatcherFlowAnalyticsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficAnalyticsProperties. +func (t *TrafficAnalyticsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkWatcherFlowAnalyticsConfiguration": + err = unpopulate(val, "NetworkWatcherFlowAnalyticsConfiguration", &t.NetworkWatcherFlowAnalyticsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficSelectorPolicy. +func (t TrafficSelectorPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localAddressRanges", t.LocalAddressRanges) + populate(objectMap, "remoteAddressRanges", t.RemoteAddressRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficSelectorPolicy. +func (t *TrafficSelectorPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localAddressRanges": + err = unpopulate(val, "LocalAddressRanges", &t.LocalAddressRanges) + delete(rawMsg, key) + case "remoteAddressRanges": + err = unpopulate(val, "RemoteAddressRanges", &t.RemoteAddressRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingDetails. +func (t TroubleshootingDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "detail", t.Detail) + populate(objectMap, "id", t.ID) + populate(objectMap, "reasonType", t.ReasonType) + populate(objectMap, "recommendedActions", t.RecommendedActions) + populate(objectMap, "summary", t.Summary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingDetails. +func (t *TroubleshootingDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "detail": + err = unpopulate(val, "Detail", &t.Detail) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "reasonType": + err = unpopulate(val, "ReasonType", &t.ReasonType) + delete(rawMsg, key) + case "recommendedActions": + err = unpopulate(val, "RecommendedActions", &t.RecommendedActions) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &t.Summary) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingParameters. +func (t TroubleshootingParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "targetResourceId", t.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingParameters. +func (t *TroubleshootingParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &t.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingProperties. +func (t TroubleshootingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "storageId", t.StorageID) + populate(objectMap, "storagePath", t.StoragePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingProperties. +func (t *TroubleshootingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "storageId": + err = unpopulate(val, "StorageID", &t.StorageID) + delete(rawMsg, key) + case "storagePath": + err = unpopulate(val, "StoragePath", &t.StoragePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingRecommendedActions. +func (t TroubleshootingRecommendedActions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionId", t.ActionID) + populate(objectMap, "actionText", t.ActionText) + populate(objectMap, "actionUri", t.ActionURI) + populate(objectMap, "actionUriText", t.ActionURIText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingRecommendedActions. +func (t *TroubleshootingRecommendedActions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionId": + err = unpopulate(val, "ActionID", &t.ActionID) + delete(rawMsg, key) + case "actionText": + err = unpopulate(val, "ActionText", &t.ActionText) + delete(rawMsg, key) + case "actionUri": + err = unpopulate(val, "ActionURI", &t.ActionURI) + delete(rawMsg, key) + case "actionUriText": + err = unpopulate(val, "ActionURIText", &t.ActionURIText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingResult. +func (t TroubleshootingResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", t.Code) + populateTimeRFC3339(objectMap, "endTime", t.EndTime) + populate(objectMap, "results", t.Results) + populateTimeRFC3339(objectMap, "startTime", t.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingResult. +func (t *TroubleshootingResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &t.Code) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &t.EndTime) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &t.Results) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &t.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TunnelConnectionHealth. +func (t TunnelConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionStatus", t.ConnectionStatus) + populate(objectMap, "egressBytesTransferred", t.EgressBytesTransferred) + populate(objectMap, "ingressBytesTransferred", t.IngressBytesTransferred) + populate(objectMap, "lastConnectionEstablishedUtcTime", t.LastConnectionEstablishedUTCTime) + populate(objectMap, "tunnel", t.Tunnel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TunnelConnectionHealth. +func (t *TunnelConnectionHealth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &t.ConnectionStatus) + delete(rawMsg, key) + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &t.EgressBytesTransferred) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &t.IngressBytesTransferred) + delete(rawMsg, key) + case "lastConnectionEstablishedUtcTime": + err = unpopulate(val, "LastConnectionEstablishedUTCTime", &t.LastConnectionEstablishedUTCTime) + delete(rawMsg, key) + case "tunnel": + err = unpopulate(val, "Tunnel", &t.Tunnel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UnprepareNetworkPoliciesRequest. +func (u UnprepareNetworkPoliciesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceName", u.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UnprepareNetworkPoliciesRequest. +func (u *UnprepareNetworkPoliciesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceName": + err = unpopulate(val, "ServiceName", &u.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "unit", u.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. +func (u *Usage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", u.LocalizedValue) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageName. +func (u *UsageName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &u.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsagesListResult. +func (u UsagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsagesListResult. +func (u *UsagesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VM. +func (v VM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VM. +func (v *VM) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientConfiguration. +func (v VPNClientConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadAudience", v.AADAudience) + populate(objectMap, "aadIssuer", v.AADIssuer) + populate(objectMap, "aadTenant", v.AADTenant) + populate(objectMap, "radiusServerAddress", v.RadiusServerAddress) + populate(objectMap, "radiusServerSecret", v.RadiusServerSecret) + populate(objectMap, "radiusServers", v.RadiusServers) + populate(objectMap, "vpnAuthenticationTypes", v.VPNAuthenticationTypes) + populate(objectMap, "vpnClientAddressPool", v.VPNClientAddressPool) + populate(objectMap, "vpnClientIpsecPolicies", v.VPNClientIPSecPolicies) + populate(objectMap, "vpnClientProtocols", v.VPNClientProtocols) + populate(objectMap, "vpnClientRevokedCertificates", v.VPNClientRevokedCertificates) + populate(objectMap, "vpnClientRootCertificates", v.VPNClientRootCertificates) + populate(objectMap, "vngClientConnectionConfigurations", v.VngClientConnectionConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientConfiguration. +func (v *VPNClientConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadAudience": + err = unpopulate(val, "AADAudience", &v.AADAudience) + delete(rawMsg, key) + case "aadIssuer": + err = unpopulate(val, "AADIssuer", &v.AADIssuer) + delete(rawMsg, key) + case "aadTenant": + err = unpopulate(val, "AADTenant", &v.AADTenant) + delete(rawMsg, key) + case "radiusServerAddress": + err = unpopulate(val, "RadiusServerAddress", &v.RadiusServerAddress) + delete(rawMsg, key) + case "radiusServerSecret": + err = unpopulate(val, "RadiusServerSecret", &v.RadiusServerSecret) + delete(rawMsg, key) + case "radiusServers": + err = unpopulate(val, "RadiusServers", &v.RadiusServers) + delete(rawMsg, key) + case "vpnAuthenticationTypes": + err = unpopulate(val, "VPNAuthenticationTypes", &v.VPNAuthenticationTypes) + delete(rawMsg, key) + case "vpnClientAddressPool": + err = unpopulate(val, "VPNClientAddressPool", &v.VPNClientAddressPool) + delete(rawMsg, key) + case "vpnClientIpsecPolicies": + err = unpopulate(val, "VPNClientIPSecPolicies", &v.VPNClientIPSecPolicies) + delete(rawMsg, key) + case "vpnClientProtocols": + err = unpopulate(val, "VPNClientProtocols", &v.VPNClientProtocols) + delete(rawMsg, key) + case "vpnClientRevokedCertificates": + err = unpopulate(val, "VPNClientRevokedCertificates", &v.VPNClientRevokedCertificates) + delete(rawMsg, key) + case "vpnClientRootCertificates": + err = unpopulate(val, "VPNClientRootCertificates", &v.VPNClientRootCertificates) + delete(rawMsg, key) + case "vngClientConnectionConfigurations": + err = unpopulate(val, "VngClientConnectionConfigurations", &v.VngClientConnectionConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientConnectionHealth. +func (v VPNClientConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allocatedIpAddresses", v.AllocatedIPAddresses) + populate(objectMap, "totalEgressBytesTransferred", v.TotalEgressBytesTransferred) + populate(objectMap, "totalIngressBytesTransferred", v.TotalIngressBytesTransferred) + populate(objectMap, "vpnClientConnectionsCount", v.VPNClientConnectionsCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientConnectionHealth. +func (v *VPNClientConnectionHealth) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allocatedIpAddresses": + err = unpopulate(val, "AllocatedIPAddresses", &v.AllocatedIPAddresses) + delete(rawMsg, key) + case "totalEgressBytesTransferred": + err = unpopulate(val, "TotalEgressBytesTransferred", &v.TotalEgressBytesTransferred) + delete(rawMsg, key) + case "totalIngressBytesTransferred": + err = unpopulate(val, "TotalIngressBytesTransferred", &v.TotalIngressBytesTransferred) + delete(rawMsg, key) + case "vpnClientConnectionsCount": + err = unpopulate(val, "VPNClientConnectionsCount", &v.VPNClientConnectionsCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientConnectionHealthDetail. +func (v VPNClientConnectionHealthDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "egressBytesTransferred", v.EgressBytesTransferred) + populate(objectMap, "egressPacketsTransferred", v.EgressPacketsTransferred) + populate(objectMap, "ingressBytesTransferred", v.IngressBytesTransferred) + populate(objectMap, "ingressPacketsTransferred", v.IngressPacketsTransferred) + populate(objectMap, "maxBandwidth", v.MaxBandwidth) + populate(objectMap, "maxPacketsPerSecond", v.MaxPacketsPerSecond) + populate(objectMap, "privateIpAddress", v.PrivateIPAddress) + populate(objectMap, "publicIpAddress", v.PublicIPAddress) + populate(objectMap, "vpnConnectionDuration", v.VPNConnectionDuration) + populate(objectMap, "vpnConnectionId", v.VPNConnectionID) + populate(objectMap, "vpnConnectionTime", v.VPNConnectionTime) + populate(objectMap, "vpnUserName", v.VPNUserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientConnectionHealthDetail. +func (v *VPNClientConnectionHealthDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &v.EgressBytesTransferred) + delete(rawMsg, key) + case "egressPacketsTransferred": + err = unpopulate(val, "EgressPacketsTransferred", &v.EgressPacketsTransferred) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &v.IngressBytesTransferred) + delete(rawMsg, key) + case "ingressPacketsTransferred": + err = unpopulate(val, "IngressPacketsTransferred", &v.IngressPacketsTransferred) + delete(rawMsg, key) + case "maxBandwidth": + err = unpopulate(val, "MaxBandwidth", &v.MaxBandwidth) + delete(rawMsg, key) + case "maxPacketsPerSecond": + err = unpopulate(val, "MaxPacketsPerSecond", &v.MaxPacketsPerSecond) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &v.PrivateIPAddress) + delete(rawMsg, key) + case "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &v.PublicIPAddress) + delete(rawMsg, key) + case "vpnConnectionDuration": + err = unpopulate(val, "VPNConnectionDuration", &v.VPNConnectionDuration) + delete(rawMsg, key) + case "vpnConnectionId": + err = unpopulate(val, "VPNConnectionID", &v.VPNConnectionID) + delete(rawMsg, key) + case "vpnConnectionTime": + err = unpopulate(val, "VPNConnectionTime", &v.VPNConnectionTime) + delete(rawMsg, key) + case "vpnUserName": + err = unpopulate(val, "VPNUserName", &v.VPNUserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientConnectionHealthDetailListResult. +func (v VPNClientConnectionHealthDetailListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientConnectionHealthDetailListResult. +func (v *VPNClientConnectionHealthDetailListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientIPsecParameters. +func (v VPNClientIPsecParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dhGroup", v.DhGroup) + populate(objectMap, "ipsecEncryption", v.IPSecEncryption) + populate(objectMap, "ipsecIntegrity", v.IPSecIntegrity) + populate(objectMap, "ikeEncryption", v.IkeEncryption) + populate(objectMap, "ikeIntegrity", v.IkeIntegrity) + populate(objectMap, "pfsGroup", v.PfsGroup) + populate(objectMap, "saDataSizeKilobytes", v.SaDataSizeKilobytes) + populate(objectMap, "saLifeTimeSeconds", v.SaLifeTimeSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientIPsecParameters. +func (v *VPNClientIPsecParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhGroup": + err = unpopulate(val, "DhGroup", &v.DhGroup) + delete(rawMsg, key) + case "ipsecEncryption": + err = unpopulate(val, "IPSecEncryption", &v.IPSecEncryption) + delete(rawMsg, key) + case "ipsecIntegrity": + err = unpopulate(val, "IPSecIntegrity", &v.IPSecIntegrity) + delete(rawMsg, key) + case "ikeEncryption": + err = unpopulate(val, "IkeEncryption", &v.IkeEncryption) + delete(rawMsg, key) + case "ikeIntegrity": + err = unpopulate(val, "IkeIntegrity", &v.IkeIntegrity) + delete(rawMsg, key) + case "pfsGroup": + err = unpopulate(val, "PfsGroup", &v.PfsGroup) + delete(rawMsg, key) + case "saDataSizeKilobytes": + err = unpopulate(val, "SaDataSizeKilobytes", &v.SaDataSizeKilobytes) + delete(rawMsg, key) + case "saLifeTimeSeconds": + err = unpopulate(val, "SaLifeTimeSeconds", &v.SaLifeTimeSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientParameters. +func (v VPNClientParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationMethod", v.AuthenticationMethod) + populate(objectMap, "clientRootCertificates", v.ClientRootCertificates) + populate(objectMap, "processorArchitecture", v.ProcessorArchitecture) + populate(objectMap, "radiusServerAuthCertificate", v.RadiusServerAuthCertificate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientParameters. +func (v *VPNClientParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationMethod": + err = unpopulate(val, "AuthenticationMethod", &v.AuthenticationMethod) + delete(rawMsg, key) + case "clientRootCertificates": + err = unpopulate(val, "ClientRootCertificates", &v.ClientRootCertificates) + delete(rawMsg, key) + case "processorArchitecture": + err = unpopulate(val, "ProcessorArchitecture", &v.ProcessorArchitecture) + delete(rawMsg, key) + case "radiusServerAuthCertificate": + err = unpopulate(val, "RadiusServerAuthCertificate", &v.RadiusServerAuthCertificate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientRevokedCertificate. +func (v VPNClientRevokedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientRevokedCertificate. +func (v *VPNClientRevokedCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientRevokedCertificatePropertiesFormat. +func (v VPNClientRevokedCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "thumbprint", v.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientRevokedCertificatePropertiesFormat. +func (v *VPNClientRevokedCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &v.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientRootCertificate. +func (v VPNClientRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientRootCertificate. +func (v *VPNClientRootCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNClientRootCertificatePropertiesFormat. +func (v VPNClientRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publicCertData", v.PublicCertData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNClientRootCertificatePropertiesFormat. +func (v *VPNClientRootCertificatePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publicCertData": + err = unpopulate(val, "PublicCertData", &v.PublicCertData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNConnection. +func (v VPNConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnection. +func (v *VPNConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNConnectionPacketCaptureStartParameters. +func (v VPNConnectionPacketCaptureStartParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterData", v.FilterData) + populate(objectMap, "linkConnectionNames", v.LinkConnectionNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnectionPacketCaptureStartParameters. +func (v *VPNConnectionPacketCaptureStartParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filterData": + err = unpopulate(val, "FilterData", &v.FilterData) + delete(rawMsg, key) + case "linkConnectionNames": + err = unpopulate(val, "LinkConnectionNames", &v.LinkConnectionNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNConnectionPacketCaptureStopParameters. +func (v VPNConnectionPacketCaptureStopParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkConnectionNames", v.LinkConnectionNames) + populate(objectMap, "sasUrl", v.SasURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnectionPacketCaptureStopParameters. +func (v *VPNConnectionPacketCaptureStopParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkConnectionNames": + err = unpopulate(val, "LinkConnectionNames", &v.LinkConnectionNames) + delete(rawMsg, key) + case "sasUrl": + err = unpopulate(val, "SasURL", &v.SasURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNConnectionProperties. +func (v VPNConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionBandwidth", v.ConnectionBandwidth) + populate(objectMap, "connectionStatus", v.ConnectionStatus) + populate(objectMap, "dpdTimeoutSeconds", v.DpdTimeoutSeconds) + populate(objectMap, "egressBytesTransferred", v.EgressBytesTransferred) + populate(objectMap, "enableBgp", v.EnableBgp) + populate(objectMap, "enableInternetSecurity", v.EnableInternetSecurity) + populate(objectMap, "enableRateLimiting", v.EnableRateLimiting) + populate(objectMap, "ipsecPolicies", v.IPSecPolicies) + populate(objectMap, "ingressBytesTransferred", v.IngressBytesTransferred) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "remoteVpnSite", v.RemoteVPNSite) + populate(objectMap, "routingConfiguration", v.RoutingConfiguration) + populate(objectMap, "routingWeight", v.RoutingWeight) + populate(objectMap, "sharedKey", v.SharedKey) + populate(objectMap, "trafficSelectorPolicies", v.TrafficSelectorPolicies) + populate(objectMap, "useLocalAzureIpAddress", v.UseLocalAzureIPAddress) + populate(objectMap, "usePolicyBasedTrafficSelectors", v.UsePolicyBasedTrafficSelectors) + populate(objectMap, "vpnConnectionProtocolType", v.VPNConnectionProtocolType) + populate(objectMap, "vpnLinkConnections", v.VPNLinkConnections) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnectionProperties. +func (v *VPNConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionBandwidth": + err = unpopulate(val, "ConnectionBandwidth", &v.ConnectionBandwidth) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &v.ConnectionStatus) + delete(rawMsg, key) + case "dpdTimeoutSeconds": + err = unpopulate(val, "DpdTimeoutSeconds", &v.DpdTimeoutSeconds) + delete(rawMsg, key) + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &v.EgressBytesTransferred) + delete(rawMsg, key) + case "enableBgp": + err = unpopulate(val, "EnableBgp", &v.EnableBgp) + delete(rawMsg, key) + case "enableInternetSecurity": + err = unpopulate(val, "EnableInternetSecurity", &v.EnableInternetSecurity) + delete(rawMsg, key) + case "enableRateLimiting": + err = unpopulate(val, "EnableRateLimiting", &v.EnableRateLimiting) + delete(rawMsg, key) + case "ipsecPolicies": + err = unpopulate(val, "IPSecPolicies", &v.IPSecPolicies) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &v.IngressBytesTransferred) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "remoteVpnSite": + err = unpopulate(val, "RemoteVPNSite", &v.RemoteVPNSite) + delete(rawMsg, key) + case "routingConfiguration": + err = unpopulate(val, "RoutingConfiguration", &v.RoutingConfiguration) + delete(rawMsg, key) + case "routingWeight": + err = unpopulate(val, "RoutingWeight", &v.RoutingWeight) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &v.SharedKey) + delete(rawMsg, key) + case "trafficSelectorPolicies": + err = unpopulate(val, "TrafficSelectorPolicies", &v.TrafficSelectorPolicies) + delete(rawMsg, key) + case "useLocalAzureIpAddress": + err = unpopulate(val, "UseLocalAzureIPAddress", &v.UseLocalAzureIPAddress) + delete(rawMsg, key) + case "usePolicyBasedTrafficSelectors": + err = unpopulate(val, "UsePolicyBasedTrafficSelectors", &v.UsePolicyBasedTrafficSelectors) + delete(rawMsg, key) + case "vpnConnectionProtocolType": + err = unpopulate(val, "VPNConnectionProtocolType", &v.VPNConnectionProtocolType) + delete(rawMsg, key) + case "vpnLinkConnections": + err = unpopulate(val, "VPNLinkConnections", &v.VPNLinkConnections) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNDeviceScriptParameters. +func (v VPNDeviceScriptParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceFamily", v.DeviceFamily) + populate(objectMap, "firmwareVersion", v.FirmwareVersion) + populate(objectMap, "vendor", v.Vendor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNDeviceScriptParameters. +func (v *VPNDeviceScriptParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceFamily": + err = unpopulate(val, "DeviceFamily", &v.DeviceFamily) + delete(rawMsg, key) + case "firmwareVersion": + err = unpopulate(val, "FirmwareVersion", &v.FirmwareVersion) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &v.Vendor) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGateway. +func (v VPNGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGateway. +func (v *VPNGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayIPConfiguration. +func (v VPNGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "privateIpAddress", v.PrivateIPAddress) + populate(objectMap, "publicIpAddress", v.PublicIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayIPConfiguration. +func (v *VPNGatewayIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &v.PrivateIPAddress) + delete(rawMsg, key) + case "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &v.PublicIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayNatRule. +func (v VPNGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayNatRule. +func (v *VPNGatewayNatRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayNatRuleProperties. +func (v VPNGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "egressVpnSiteLinkConnections", v.EgressVPNSiteLinkConnections) + populate(objectMap, "externalMappings", v.ExternalMappings) + populate(objectMap, "ipConfigurationId", v.IPConfigurationID) + populate(objectMap, "ingressVpnSiteLinkConnections", v.IngressVPNSiteLinkConnections) + populate(objectMap, "internalMappings", v.InternalMappings) + populate(objectMap, "mode", v.Mode) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayNatRuleProperties. +func (v *VPNGatewayNatRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "egressVpnSiteLinkConnections": + err = unpopulate(val, "EgressVPNSiteLinkConnections", &v.EgressVPNSiteLinkConnections) + delete(rawMsg, key) + case "externalMappings": + err = unpopulate(val, "ExternalMappings", &v.ExternalMappings) + delete(rawMsg, key) + case "ipConfigurationId": + err = unpopulate(val, "IPConfigurationID", &v.IPConfigurationID) + delete(rawMsg, key) + case "ingressVpnSiteLinkConnections": + err = unpopulate(val, "IngressVPNSiteLinkConnections", &v.IngressVPNSiteLinkConnections) + delete(rawMsg, key) + case "internalMappings": + err = unpopulate(val, "InternalMappings", &v.InternalMappings) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &v.Mode) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayPacketCaptureStartParameters. +func (v VPNGatewayPacketCaptureStartParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterData", v.FilterData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayPacketCaptureStartParameters. +func (v *VPNGatewayPacketCaptureStartParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filterData": + err = unpopulate(val, "FilterData", &v.FilterData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayPacketCaptureStopParameters. +func (v VPNGatewayPacketCaptureStopParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sasUrl", v.SasURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayPacketCaptureStopParameters. +func (v *VPNGatewayPacketCaptureStopParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sasUrl": + err = unpopulate(val, "SasURL", &v.SasURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNGatewayProperties. +func (v VPNGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bgpSettings", v.BgpSettings) + populate(objectMap, "connections", v.Connections) + populate(objectMap, "enableBgpRouteTranslationForNat", v.EnableBgpRouteTranslationForNat) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "isRoutingPreferenceInternet", v.IsRoutingPreferenceInternet) + populate(objectMap, "natRules", v.NatRules) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "vpnGatewayScaleUnit", v.VPNGatewayScaleUnit) + populate(objectMap, "virtualHub", v.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewayProperties. +func (v *VPNGatewayProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpSettings": + err = unpopulate(val, "BgpSettings", &v.BgpSettings) + delete(rawMsg, key) + case "connections": + err = unpopulate(val, "Connections", &v.Connections) + delete(rawMsg, key) + case "enableBgpRouteTranslationForNat": + err = unpopulate(val, "EnableBgpRouteTranslationForNat", &v.EnableBgpRouteTranslationForNat) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "isRoutingPreferenceInternet": + err = unpopulate(val, "IsRoutingPreferenceInternet", &v.IsRoutingPreferenceInternet) + delete(rawMsg, key) + case "natRules": + err = unpopulate(val, "NatRules", &v.NatRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "vpnGatewayScaleUnit": + err = unpopulate(val, "VPNGatewayScaleUnit", &v.VPNGatewayScaleUnit) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &v.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNLinkBgpSettings. +func (v VPNLinkBgpSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", v.Asn) + populate(objectMap, "bgpPeeringAddress", v.BgpPeeringAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNLinkBgpSettings. +func (v *VPNLinkBgpSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &v.Asn) + delete(rawMsg, key) + case "bgpPeeringAddress": + err = unpopulate(val, "BgpPeeringAddress", &v.BgpPeeringAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNLinkProviderProperties. +func (v VPNLinkProviderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkProviderName", v.LinkProviderName) + populate(objectMap, "linkSpeedInMbps", v.LinkSpeedInMbps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNLinkProviderProperties. +func (v *VPNLinkProviderProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkProviderName": + err = unpopulate(val, "LinkProviderName", &v.LinkProviderName) + delete(rawMsg, key) + case "linkSpeedInMbps": + err = unpopulate(val, "LinkSpeedInMbps", &v.LinkSpeedInMbps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNNatRuleMapping. +func (v VPNNatRuleMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressSpace", v.AddressSpace) + populate(objectMap, "portRange", v.PortRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNNatRuleMapping. +func (v *VPNNatRuleMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressSpace": + err = unpopulate(val, "AddressSpace", &v.AddressSpace) + delete(rawMsg, key) + case "portRange": + err = unpopulate(val, "PortRange", &v.PortRange) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNPacketCaptureStartParameters. +func (v VPNPacketCaptureStartParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterData", v.FilterData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNPacketCaptureStartParameters. +func (v *VPNPacketCaptureStartParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filterData": + err = unpopulate(val, "FilterData", &v.FilterData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNPacketCaptureStopParameters. +func (v VPNPacketCaptureStopParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sasUrl", v.SasURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNPacketCaptureStopParameters. +func (v *VPNPacketCaptureStopParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sasUrl": + err = unpopulate(val, "SasURL", &v.SasURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNProfileResponse. +func (v VPNProfileResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "profileUrl", v.ProfileURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNProfileResponse. +func (v *VPNProfileResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "profileUrl": + err = unpopulate(val, "ProfileURL", &v.ProfileURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigRadiusClientRootCertificate. +func (v VPNServerConfigRadiusClientRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "thumbprint", v.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigRadiusClientRootCertificate. +func (v *VPNServerConfigRadiusClientRootCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &v.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigRadiusServerRootCertificate. +func (v VPNServerConfigRadiusServerRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "publicCertData", v.PublicCertData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigRadiusServerRootCertificate. +func (v *VPNServerConfigRadiusServerRootCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "publicCertData": + err = unpopulate(val, "PublicCertData", &v.PublicCertData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigVPNClientRevokedCertificate. +func (v VPNServerConfigVPNClientRevokedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "thumbprint", v.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigVPNClientRevokedCertificate. +func (v *VPNServerConfigVPNClientRevokedCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &v.Thumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigVPNClientRootCertificate. +func (v VPNServerConfigVPNClientRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "publicCertData", v.PublicCertData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigVPNClientRootCertificate. +func (v *VPNServerConfigVPNClientRootCertificate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "publicCertData": + err = unpopulate(val, "PublicCertData", &v.PublicCertData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfiguration. +func (v VPNServerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfiguration. +func (v *VPNServerConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigurationPolicyGroup. +func (v VPNServerConfigurationPolicyGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigurationPolicyGroup. +func (v *VPNServerConfigurationPolicyGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigurationPolicyGroupMember. +func (v VPNServerConfigurationPolicyGroupMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attributeType", v.AttributeType) + populate(objectMap, "attributeValue", v.AttributeValue) + populate(objectMap, "name", v.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigurationPolicyGroupMember. +func (v *VPNServerConfigurationPolicyGroupMember) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributeType": + err = unpopulate(val, "AttributeType", &v.AttributeType) + delete(rawMsg, key) + case "attributeValue": + err = unpopulate(val, "AttributeValue", &v.AttributeValue) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigurationPolicyGroupProperties. +func (v VPNServerConfigurationPolicyGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isDefault", v.IsDefault) + populate(objectMap, "p2SConnectionConfigurations", v.P2SConnectionConfigurations) + populate(objectMap, "policyMembers", v.PolicyMembers) + populate(objectMap, "priority", v.Priority) + populate(objectMap, "provisioningState", v.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigurationPolicyGroupProperties. +func (v *VPNServerConfigurationPolicyGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDefault": + err = unpopulate(val, "IsDefault", &v.IsDefault) + delete(rawMsg, key) + case "p2SConnectionConfigurations": + err = unpopulate(val, "P2SConnectionConfigurations", &v.P2SConnectionConfigurations) + delete(rawMsg, key) + case "policyMembers": + err = unpopulate(val, "PolicyMembers", &v.PolicyMembers) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &v.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigurationProperties. +func (v VPNServerConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadAuthenticationParameters", v.AADAuthenticationParameters) + populate(objectMap, "configurationPolicyGroups", v.ConfigurationPolicyGroups) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "name", v.Name) + populate(objectMap, "p2SVpnGateways", v.P2SVPNGateways) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "radiusClientRootCertificates", v.RadiusClientRootCertificates) + populate(objectMap, "radiusServerAddress", v.RadiusServerAddress) + populate(objectMap, "radiusServerRootCertificates", v.RadiusServerRootCertificates) + populate(objectMap, "radiusServerSecret", v.RadiusServerSecret) + populate(objectMap, "radiusServers", v.RadiusServers) + populate(objectMap, "vpnAuthenticationTypes", v.VPNAuthenticationTypes) + populate(objectMap, "vpnClientIpsecPolicies", v.VPNClientIPSecPolicies) + populate(objectMap, "vpnClientRevokedCertificates", v.VPNClientRevokedCertificates) + populate(objectMap, "vpnClientRootCertificates", v.VPNClientRootCertificates) + populate(objectMap, "vpnProtocols", v.VPNProtocols) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigurationProperties. +func (v *VPNServerConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadAuthenticationParameters": + err = unpopulate(val, "AADAuthenticationParameters", &v.AADAuthenticationParameters) + delete(rawMsg, key) + case "configurationPolicyGroups": + err = unpopulate(val, "ConfigurationPolicyGroups", &v.ConfigurationPolicyGroups) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "p2SVpnGateways": + err = unpopulate(val, "P2SVPNGateways", &v.P2SVPNGateways) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "radiusClientRootCertificates": + err = unpopulate(val, "RadiusClientRootCertificates", &v.RadiusClientRootCertificates) + delete(rawMsg, key) + case "radiusServerAddress": + err = unpopulate(val, "RadiusServerAddress", &v.RadiusServerAddress) + delete(rawMsg, key) + case "radiusServerRootCertificates": + err = unpopulate(val, "RadiusServerRootCertificates", &v.RadiusServerRootCertificates) + delete(rawMsg, key) + case "radiusServerSecret": + err = unpopulate(val, "RadiusServerSecret", &v.RadiusServerSecret) + delete(rawMsg, key) + case "radiusServers": + err = unpopulate(val, "RadiusServers", &v.RadiusServers) + delete(rawMsg, key) + case "vpnAuthenticationTypes": + err = unpopulate(val, "VPNAuthenticationTypes", &v.VPNAuthenticationTypes) + delete(rawMsg, key) + case "vpnClientIpsecPolicies": + err = unpopulate(val, "VPNClientIPSecPolicies", &v.VPNClientIPSecPolicies) + delete(rawMsg, key) + case "vpnClientRevokedCertificates": + err = unpopulate(val, "VPNClientRevokedCertificates", &v.VPNClientRevokedCertificates) + delete(rawMsg, key) + case "vpnClientRootCertificates": + err = unpopulate(val, "VPNClientRootCertificates", &v.VPNClientRootCertificates) + delete(rawMsg, key) + case "vpnProtocols": + err = unpopulate(val, "VPNProtocols", &v.VPNProtocols) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNServerConfigurationsResponse. +func (v VPNServerConfigurationsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vpnServerConfigurationResourceIds", v.VPNServerConfigurationResourceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNServerConfigurationsResponse. +func (v *VPNServerConfigurationsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vpnServerConfigurationResourceIds": + err = unpopulate(val, "VPNServerConfigurationResourceIDs", &v.VPNServerConfigurationResourceIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSite. +func (v VPNSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSite. +func (v *VPNSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteID. +func (v VPNSiteID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "vpnSite", v.VPNSite) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteID. +func (v *VPNSiteID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vpnSite": + err = unpopulate(val, "VPNSite", &v.VPNSite) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteLink. +func (v VPNSiteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteLink. +func (v *VPNSiteLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteLinkConnection. +func (v VPNSiteLinkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteLinkConnection. +func (v *VPNSiteLinkConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteLinkConnectionProperties. +func (v VPNSiteLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionBandwidth", v.ConnectionBandwidth) + populate(objectMap, "connectionStatus", v.ConnectionStatus) + populate(objectMap, "egressBytesTransferred", v.EgressBytesTransferred) + populate(objectMap, "egressNatRules", v.EgressNatRules) + populate(objectMap, "enableBgp", v.EnableBgp) + populate(objectMap, "enableRateLimiting", v.EnableRateLimiting) + populate(objectMap, "ipsecPolicies", v.IPSecPolicies) + populate(objectMap, "ingressBytesTransferred", v.IngressBytesTransferred) + populate(objectMap, "ingressNatRules", v.IngressNatRules) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "routingWeight", v.RoutingWeight) + populate(objectMap, "sharedKey", v.SharedKey) + populate(objectMap, "useLocalAzureIpAddress", v.UseLocalAzureIPAddress) + populate(objectMap, "usePolicyBasedTrafficSelectors", v.UsePolicyBasedTrafficSelectors) + populate(objectMap, "vpnConnectionProtocolType", v.VPNConnectionProtocolType) + populate(objectMap, "vpnGatewayCustomBgpAddresses", v.VPNGatewayCustomBgpAddresses) + populate(objectMap, "vpnLinkConnectionMode", v.VPNLinkConnectionMode) + populate(objectMap, "vpnSiteLink", v.VPNSiteLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteLinkConnectionProperties. +func (v *VPNSiteLinkConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionBandwidth": + err = unpopulate(val, "ConnectionBandwidth", &v.ConnectionBandwidth) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &v.ConnectionStatus) + delete(rawMsg, key) + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &v.EgressBytesTransferred) + delete(rawMsg, key) + case "egressNatRules": + err = unpopulate(val, "EgressNatRules", &v.EgressNatRules) + delete(rawMsg, key) + case "enableBgp": + err = unpopulate(val, "EnableBgp", &v.EnableBgp) + delete(rawMsg, key) + case "enableRateLimiting": + err = unpopulate(val, "EnableRateLimiting", &v.EnableRateLimiting) + delete(rawMsg, key) + case "ipsecPolicies": + err = unpopulate(val, "IPSecPolicies", &v.IPSecPolicies) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &v.IngressBytesTransferred) + delete(rawMsg, key) + case "ingressNatRules": + err = unpopulate(val, "IngressNatRules", &v.IngressNatRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "routingWeight": + err = unpopulate(val, "RoutingWeight", &v.RoutingWeight) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &v.SharedKey) + delete(rawMsg, key) + case "useLocalAzureIpAddress": + err = unpopulate(val, "UseLocalAzureIPAddress", &v.UseLocalAzureIPAddress) + delete(rawMsg, key) + case "usePolicyBasedTrafficSelectors": + err = unpopulate(val, "UsePolicyBasedTrafficSelectors", &v.UsePolicyBasedTrafficSelectors) + delete(rawMsg, key) + case "vpnConnectionProtocolType": + err = unpopulate(val, "VPNConnectionProtocolType", &v.VPNConnectionProtocolType) + delete(rawMsg, key) + case "vpnGatewayCustomBgpAddresses": + err = unpopulate(val, "VPNGatewayCustomBgpAddresses", &v.VPNGatewayCustomBgpAddresses) + delete(rawMsg, key) + case "vpnLinkConnectionMode": + err = unpopulate(val, "VPNLinkConnectionMode", &v.VPNLinkConnectionMode) + delete(rawMsg, key) + case "vpnSiteLink": + err = unpopulate(val, "VPNSiteLink", &v.VPNSiteLink) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteLinkProperties. +func (v VPNSiteLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bgpProperties", v.BgpProperties) + populate(objectMap, "fqdn", v.Fqdn) + populate(objectMap, "ipAddress", v.IPAddress) + populate(objectMap, "linkProperties", v.LinkProperties) + populate(objectMap, "provisioningState", v.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteLinkProperties. +func (v *VPNSiteLinkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpProperties": + err = unpopulate(val, "BgpProperties", &v.BgpProperties) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &v.Fqdn) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &v.IPAddress) + delete(rawMsg, key) + case "linkProperties": + err = unpopulate(val, "LinkProperties", &v.LinkProperties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VPNSiteProperties. +func (v VPNSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressSpace", v.AddressSpace) + populate(objectMap, "bgpProperties", v.BgpProperties) + populate(objectMap, "deviceProperties", v.DeviceProperties) + populate(objectMap, "ipAddress", v.IPAddress) + populate(objectMap, "isSecuritySite", v.IsSecuritySite) + populate(objectMap, "o365Policy", v.O365Policy) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "siteKey", v.SiteKey) + populate(objectMap, "vpnSiteLinks", v.VPNSiteLinks) + populate(objectMap, "virtualWan", v.VirtualWan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNSiteProperties. +func (v *VPNSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressSpace": + err = unpopulate(val, "AddressSpace", &v.AddressSpace) + delete(rawMsg, key) + case "bgpProperties": + err = unpopulate(val, "BgpProperties", &v.BgpProperties) + delete(rawMsg, key) + case "deviceProperties": + err = unpopulate(val, "DeviceProperties", &v.DeviceProperties) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &v.IPAddress) + delete(rawMsg, key) + case "isSecuritySite": + err = unpopulate(val, "IsSecuritySite", &v.IsSecuritySite) + delete(rawMsg, key) + case "o365Policy": + err = unpopulate(val, "O365Policy", &v.O365Policy) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "siteKey": + err = unpopulate(val, "SiteKey", &v.SiteKey) + delete(rawMsg, key) + case "vpnSiteLinks": + err = unpopulate(val, "VPNSiteLinks", &v.VPNSiteLinks) + delete(rawMsg, key) + case "virtualWan": + err = unpopulate(val, "VirtualWan", &v.VirtualWan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VerificationIPFlowParameters. +func (v VerificationIPFlowParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "direction", v.Direction) + populate(objectMap, "localIPAddress", v.LocalIPAddress) + populate(objectMap, "localPort", v.LocalPort) + populate(objectMap, "protocol", v.Protocol) + populate(objectMap, "remoteIPAddress", v.RemoteIPAddress) + populate(objectMap, "remotePort", v.RemotePort) + populate(objectMap, "targetNicResourceId", v.TargetNicResourceID) + populate(objectMap, "targetResourceId", v.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VerificationIPFlowParameters. +func (v *VerificationIPFlowParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "direction": + err = unpopulate(val, "Direction", &v.Direction) + delete(rawMsg, key) + case "localIPAddress": + err = unpopulate(val, "LocalIPAddress", &v.LocalIPAddress) + delete(rawMsg, key) + case "localPort": + err = unpopulate(val, "LocalPort", &v.LocalPort) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &v.Protocol) + delete(rawMsg, key) + case "remoteIPAddress": + err = unpopulate(val, "RemoteIPAddress", &v.RemoteIPAddress) + delete(rawMsg, key) + case "remotePort": + err = unpopulate(val, "RemotePort", &v.RemotePort) + delete(rawMsg, key) + case "targetNicResourceId": + err = unpopulate(val, "TargetNicResourceID", &v.TargetNicResourceID) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &v.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VerificationIPFlowResult. +func (v VerificationIPFlowResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "access", v.Access) + populate(objectMap, "ruleName", v.RuleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VerificationIPFlowResult. +func (v *VerificationIPFlowResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "access": + err = unpopulate(val, "Access", &v.Access) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &v.RuleName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualAppliance. +func (v VirtualAppliance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualAppliance. +func (v *VirtualAppliance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceListResult. +func (v VirtualApplianceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceListResult. +func (v *VirtualApplianceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceNicProperties. +func (v VirtualApplianceNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "privateIpAddress", v.PrivateIPAddress) + populate(objectMap, "publicIpAddress", v.PublicIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceNicProperties. +func (v *VirtualApplianceNicProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &v.PrivateIPAddress) + delete(rawMsg, key) + case "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &v.PublicIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualAppliancePropertiesFormat. +func (v VirtualAppliancePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", v.AddressPrefix) + populate(objectMap, "bootStrapConfigurationBlobs", v.BootStrapConfigurationBlobs) + populate(objectMap, "cloudInitConfiguration", v.CloudInitConfiguration) + populate(objectMap, "cloudInitConfigurationBlobs", v.CloudInitConfigurationBlobs) + populate(objectMap, "inboundSecurityRules", v.InboundSecurityRules) + populate(objectMap, "nvaSku", v.NvaSKU) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "sshPublicKey", v.SSHPublicKey) + populate(objectMap, "virtualApplianceAsn", v.VirtualApplianceAsn) + populate(objectMap, "virtualApplianceNics", v.VirtualApplianceNics) + populate(objectMap, "virtualApplianceSites", v.VirtualApplianceSites) + populate(objectMap, "virtualHub", v.VirtualHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualAppliancePropertiesFormat. +func (v *VirtualAppliancePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &v.AddressPrefix) + delete(rawMsg, key) + case "bootStrapConfigurationBlobs": + err = unpopulate(val, "BootStrapConfigurationBlobs", &v.BootStrapConfigurationBlobs) + delete(rawMsg, key) + case "cloudInitConfiguration": + err = unpopulate(val, "CloudInitConfiguration", &v.CloudInitConfiguration) + delete(rawMsg, key) + case "cloudInitConfigurationBlobs": + err = unpopulate(val, "CloudInitConfigurationBlobs", &v.CloudInitConfigurationBlobs) + delete(rawMsg, key) + case "inboundSecurityRules": + err = unpopulate(val, "InboundSecurityRules", &v.InboundSecurityRules) + delete(rawMsg, key) + case "nvaSku": + err = unpopulate(val, "NvaSKU", &v.NvaSKU) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "sshPublicKey": + err = unpopulate(val, "SSHPublicKey", &v.SSHPublicKey) + delete(rawMsg, key) + case "virtualApplianceAsn": + err = unpopulate(val, "VirtualApplianceAsn", &v.VirtualApplianceAsn) + delete(rawMsg, key) + case "virtualApplianceNics": + err = unpopulate(val, "VirtualApplianceNics", &v.VirtualApplianceNics) + delete(rawMsg, key) + case "virtualApplianceSites": + err = unpopulate(val, "VirtualApplianceSites", &v.VirtualApplianceSites) + delete(rawMsg, key) + case "virtualHub": + err = unpopulate(val, "VirtualHub", &v.VirtualHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSKU. +func (v VirtualApplianceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSKU. +func (v *VirtualApplianceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSKUInstances. +func (v VirtualApplianceSKUInstances) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceCount", v.InstanceCount) + populate(objectMap, "scaleUnit", v.ScaleUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSKUInstances. +func (v *VirtualApplianceSKUInstances) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceCount": + err = unpopulate(val, "InstanceCount", &v.InstanceCount) + delete(rawMsg, key) + case "scaleUnit": + err = unpopulate(val, "ScaleUnit", &v.ScaleUnit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSKUListResult. +func (v VirtualApplianceSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSKUListResult. +func (v *VirtualApplianceSKUListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSKUProperties. +func (v VirtualApplianceSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bundledScaleUnit", v.BundledScaleUnit) + populate(objectMap, "marketPlaceVersion", v.MarketPlaceVersion) + populate(objectMap, "vendor", v.Vendor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSKUProperties. +func (v *VirtualApplianceSKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bundledScaleUnit": + err = unpopulate(val, "BundledScaleUnit", &v.BundledScaleUnit) + delete(rawMsg, key) + case "marketPlaceVersion": + err = unpopulate(val, "MarketPlaceVersion", &v.MarketPlaceVersion) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &v.Vendor) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSKUPropertiesFormat. +func (v VirtualApplianceSKUPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availableScaleUnits", v.AvailableScaleUnits) + populate(objectMap, "availableVersions", v.AvailableVersions) + populate(objectMap, "vendor", v.Vendor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSKUPropertiesFormat. +func (v *VirtualApplianceSKUPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availableScaleUnits": + err = unpopulate(val, "AvailableScaleUnits", &v.AvailableScaleUnits) + delete(rawMsg, key) + case "availableVersions": + err = unpopulate(val, "AvailableVersions", &v.AvailableVersions) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &v.Vendor) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSite. +func (v VirtualApplianceSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSite. +func (v *VirtualApplianceSite) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSiteListResult. +func (v VirtualApplianceSiteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSiteListResult. +func (v *VirtualApplianceSiteListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualApplianceSiteProperties. +func (v VirtualApplianceSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", v.AddressPrefix) + populate(objectMap, "o365Policy", v.O365Policy) + populate(objectMap, "provisioningState", v.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualApplianceSiteProperties. +func (v *VirtualApplianceSiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &v.AddressPrefix) + delete(rawMsg, key) + case "o365Policy": + err = unpopulate(val, "O365Policy", &v.O365Policy) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHub. +func (v VirtualHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "kind", v.Kind) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHub. +func (v *VirtualHub) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &v.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubEffectiveRoute. +func (v VirtualHubEffectiveRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefixes", v.AddressPrefixes) + populate(objectMap, "asPath", v.AsPath) + populate(objectMap, "nextHopType", v.NextHopType) + populate(objectMap, "nextHops", v.NextHops) + populate(objectMap, "routeOrigin", v.RouteOrigin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubEffectiveRoute. +func (v *VirtualHubEffectiveRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &v.AddressPrefixes) + delete(rawMsg, key) + case "asPath": + err = unpopulate(val, "AsPath", &v.AsPath) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &v.NextHopType) + delete(rawMsg, key) + case "nextHops": + err = unpopulate(val, "NextHops", &v.NextHops) + delete(rawMsg, key) + case "routeOrigin": + err = unpopulate(val, "RouteOrigin", &v.RouteOrigin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubEffectiveRouteList. +func (v VirtualHubEffectiveRouteList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubEffectiveRouteList. +func (v *VirtualHubEffectiveRouteList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubID. +func (v VirtualHubID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubID. +func (v *VirtualHubID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubProperties. +func (v VirtualHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefix", v.AddressPrefix) + populate(objectMap, "allowBranchToBranchTraffic", v.AllowBranchToBranchTraffic) + populate(objectMap, "azureFirewall", v.AzureFirewall) + populate(objectMap, "bgpConnections", v.BgpConnections) + populate(objectMap, "expressRouteGateway", v.ExpressRouteGateway) + populate(objectMap, "hubRoutingPreference", v.HubRoutingPreference) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "p2SVpnGateway", v.P2SVPNGateway) + populate(objectMap, "preferredRoutingGateway", v.PreferredRoutingGateway) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "routeMaps", v.RouteMaps) + populate(objectMap, "routeTable", v.RouteTable) + populate(objectMap, "routingState", v.RoutingState) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "securityPartnerProvider", v.SecurityPartnerProvider) + populate(objectMap, "securityProviderName", v.SecurityProviderName) + populate(objectMap, "vpnGateway", v.VPNGateway) + populate(objectMap, "virtualHubRouteTableV2s", v.VirtualHubRouteTableV2S) + populate(objectMap, "virtualRouterAsn", v.VirtualRouterAsn) + populate(objectMap, "virtualRouterAutoScaleConfiguration", v.VirtualRouterAutoScaleConfiguration) + populate(objectMap, "virtualRouterIps", v.VirtualRouterIPs) + populate(objectMap, "virtualWan", v.VirtualWan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubProperties. +func (v *VirtualHubProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &v.AddressPrefix) + delete(rawMsg, key) + case "allowBranchToBranchTraffic": + err = unpopulate(val, "AllowBranchToBranchTraffic", &v.AllowBranchToBranchTraffic) + delete(rawMsg, key) + case "azureFirewall": + err = unpopulate(val, "AzureFirewall", &v.AzureFirewall) + delete(rawMsg, key) + case "bgpConnections": + err = unpopulate(val, "BgpConnections", &v.BgpConnections) + delete(rawMsg, key) + case "expressRouteGateway": + err = unpopulate(val, "ExpressRouteGateway", &v.ExpressRouteGateway) + delete(rawMsg, key) + case "hubRoutingPreference": + err = unpopulate(val, "HubRoutingPreference", &v.HubRoutingPreference) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "p2SVpnGateway": + err = unpopulate(val, "P2SVPNGateway", &v.P2SVPNGateway) + delete(rawMsg, key) + case "preferredRoutingGateway": + err = unpopulate(val, "PreferredRoutingGateway", &v.PreferredRoutingGateway) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "routeMaps": + err = unpopulate(val, "RouteMaps", &v.RouteMaps) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &v.RouteTable) + delete(rawMsg, key) + case "routingState": + err = unpopulate(val, "RoutingState", &v.RoutingState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "securityPartnerProvider": + err = unpopulate(val, "SecurityPartnerProvider", &v.SecurityPartnerProvider) + delete(rawMsg, key) + case "securityProviderName": + err = unpopulate(val, "SecurityProviderName", &v.SecurityProviderName) + delete(rawMsg, key) + case "vpnGateway": + err = unpopulate(val, "VPNGateway", &v.VPNGateway) + delete(rawMsg, key) + case "virtualHubRouteTableV2s": + err = unpopulate(val, "VirtualHubRouteTableV2S", &v.VirtualHubRouteTableV2S) + delete(rawMsg, key) + case "virtualRouterAsn": + err = unpopulate(val, "VirtualRouterAsn", &v.VirtualRouterAsn) + delete(rawMsg, key) + case "virtualRouterAutoScaleConfiguration": + err = unpopulate(val, "VirtualRouterAutoScaleConfiguration", &v.VirtualRouterAutoScaleConfiguration) + delete(rawMsg, key) + case "virtualRouterIps": + err = unpopulate(val, "VirtualRouterIPs", &v.VirtualRouterIPs) + delete(rawMsg, key) + case "virtualWan": + err = unpopulate(val, "VirtualWan", &v.VirtualWan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubRoute. +func (v VirtualHubRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressPrefixes", v.AddressPrefixes) + populate(objectMap, "nextHopIpAddress", v.NextHopIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubRoute. +func (v *VirtualHubRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &v.AddressPrefixes) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &v.NextHopIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubRouteTable. +func (v VirtualHubRouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "routes", v.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubRouteTable. +func (v *VirtualHubRouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "routes": + err = unpopulate(val, "Routes", &v.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubRouteTableV2. +func (v VirtualHubRouteTableV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubRouteTableV2. +func (v *VirtualHubRouteTableV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubRouteTableV2Properties. +func (v VirtualHubRouteTableV2Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attachedConnections", v.AttachedConnections) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "routes", v.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubRouteTableV2Properties. +func (v *VirtualHubRouteTableV2Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attachedConnections": + err = unpopulate(val, "AttachedConnections", &v.AttachedConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &v.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualHubRouteV2. +func (v VirtualHubRouteV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationType", v.DestinationType) + populate(objectMap, "destinations", v.Destinations) + populate(objectMap, "nextHopType", v.NextHopType) + populate(objectMap, "nextHops", v.NextHops) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualHubRouteV2. +func (v *VirtualHubRouteV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationType": + err = unpopulate(val, "DestinationType", &v.DestinationType) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &v.Destinations) + delete(rawMsg, key) + case "nextHopType": + err = unpopulate(val, "NextHopType", &v.NextHopType) + delete(rawMsg, key) + case "nextHops": + err = unpopulate(val, "NextHops", &v.NextHops) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetwork. +func (v VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetwork. +func (v *VirtualNetwork) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkBgpCommunities. +func (v VirtualNetworkBgpCommunities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "regionalCommunity", v.RegionalCommunity) + populate(objectMap, "virtualNetworkCommunity", v.VirtualNetworkCommunity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkBgpCommunities. +func (v *VirtualNetworkBgpCommunities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "regionalCommunity": + err = unpopulate(val, "RegionalCommunity", &v.RegionalCommunity) + delete(rawMsg, key) + case "virtualNetworkCommunity": + err = unpopulate(val, "VirtualNetworkCommunity", &v.VirtualNetworkCommunity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkConnectionGatewayReference. +func (v VirtualNetworkConnectionGatewayReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkConnectionGatewayReference. +func (v *VirtualNetworkConnectionGatewayReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkDdosProtectionStatusResult. +func (v VirtualNetworkDdosProtectionStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkDdosProtectionStatusResult. +func (v *VirtualNetworkDdosProtectionStatusResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkEncryption. +func (v VirtualNetworkEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", v.Enabled) + populate(objectMap, "enforcement", v.Enforcement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkEncryption. +func (v *VirtualNetworkEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &v.Enabled) + delete(rawMsg, key) + case "enforcement": + err = unpopulate(val, "Enforcement", &v.Enforcement) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGateway. +func (v VirtualNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGateway. +func (v *VirtualNetworkGateway) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayConnection. +func (v VirtualNetworkGatewayConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnection. +func (v *VirtualNetworkGatewayConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayConnectionListEntity. +func (v VirtualNetworkGatewayConnectionListEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionListEntity. +func (v *VirtualNetworkGatewayConnectionListEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayConnectionListEntityPropertiesFormat. +func (v VirtualNetworkGatewayConnectionListEntityPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationKey", v.AuthorizationKey) + populate(objectMap, "connectionMode", v.ConnectionMode) + populate(objectMap, "connectionProtocol", v.ConnectionProtocol) + populate(objectMap, "connectionStatus", v.ConnectionStatus) + populate(objectMap, "connectionType", v.ConnectionType) + populate(objectMap, "egressBytesTransferred", v.EgressBytesTransferred) + populate(objectMap, "enableBgp", v.EnableBgp) + populate(objectMap, "enablePrivateLinkFastPath", v.EnablePrivateLinkFastPath) + populate(objectMap, "expressRouteGatewayBypass", v.ExpressRouteGatewayBypass) + populate(objectMap, "gatewayCustomBgpIpAddresses", v.GatewayCustomBgpIPAddresses) + populate(objectMap, "ipsecPolicies", v.IPSecPolicies) + populate(objectMap, "ingressBytesTransferred", v.IngressBytesTransferred) + populate(objectMap, "localNetworkGateway2", v.LocalNetworkGateway2) + populate(objectMap, "peer", v.Peer) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceGuid", v.ResourceGUID) + populate(objectMap, "routingWeight", v.RoutingWeight) + populate(objectMap, "sharedKey", v.SharedKey) + populate(objectMap, "trafficSelectorPolicies", v.TrafficSelectorPolicies) + populate(objectMap, "tunnelConnectionStatus", v.TunnelConnectionStatus) + populate(objectMap, "usePolicyBasedTrafficSelectors", v.UsePolicyBasedTrafficSelectors) + populate(objectMap, "virtualNetworkGateway1", v.VirtualNetworkGateway1) + populate(objectMap, "virtualNetworkGateway2", v.VirtualNetworkGateway2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionListEntityPropertiesFormat. +func (v *VirtualNetworkGatewayConnectionListEntityPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &v.AuthorizationKey) + delete(rawMsg, key) + case "connectionMode": + err = unpopulate(val, "ConnectionMode", &v.ConnectionMode) + delete(rawMsg, key) + case "connectionProtocol": + err = unpopulate(val, "ConnectionProtocol", &v.ConnectionProtocol) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &v.ConnectionStatus) + delete(rawMsg, key) + case "connectionType": + err = unpopulate(val, "ConnectionType", &v.ConnectionType) + delete(rawMsg, key) + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &v.EgressBytesTransferred) + delete(rawMsg, key) + case "enableBgp": + err = unpopulate(val, "EnableBgp", &v.EnableBgp) + delete(rawMsg, key) + case "enablePrivateLinkFastPath": + err = unpopulate(val, "EnablePrivateLinkFastPath", &v.EnablePrivateLinkFastPath) + delete(rawMsg, key) + case "expressRouteGatewayBypass": + err = unpopulate(val, "ExpressRouteGatewayBypass", &v.ExpressRouteGatewayBypass) + delete(rawMsg, key) + case "gatewayCustomBgpIpAddresses": + err = unpopulate(val, "GatewayCustomBgpIPAddresses", &v.GatewayCustomBgpIPAddresses) + delete(rawMsg, key) + case "ipsecPolicies": + err = unpopulate(val, "IPSecPolicies", &v.IPSecPolicies) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &v.IngressBytesTransferred) + delete(rawMsg, key) + case "localNetworkGateway2": + err = unpopulate(val, "LocalNetworkGateway2", &v.LocalNetworkGateway2) + delete(rawMsg, key) + case "peer": + err = unpopulate(val, "Peer", &v.Peer) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + case "routingWeight": + err = unpopulate(val, "RoutingWeight", &v.RoutingWeight) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &v.SharedKey) + delete(rawMsg, key) + case "trafficSelectorPolicies": + err = unpopulate(val, "TrafficSelectorPolicies", &v.TrafficSelectorPolicies) + delete(rawMsg, key) + case "tunnelConnectionStatus": + err = unpopulate(val, "TunnelConnectionStatus", &v.TunnelConnectionStatus) + delete(rawMsg, key) + case "usePolicyBasedTrafficSelectors": + err = unpopulate(val, "UsePolicyBasedTrafficSelectors", &v.UsePolicyBasedTrafficSelectors) + delete(rawMsg, key) + case "virtualNetworkGateway1": + err = unpopulate(val, "VirtualNetworkGateway1", &v.VirtualNetworkGateway1) + delete(rawMsg, key) + case "virtualNetworkGateway2": + err = unpopulate(val, "VirtualNetworkGateway2", &v.VirtualNetworkGateway2) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayConnectionListResult. +func (v VirtualNetworkGatewayConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionListResult. +func (v *VirtualNetworkGatewayConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayConnectionPropertiesFormat. +func (v VirtualNetworkGatewayConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationKey", v.AuthorizationKey) + populate(objectMap, "connectionMode", v.ConnectionMode) + populate(objectMap, "connectionProtocol", v.ConnectionProtocol) + populate(objectMap, "connectionStatus", v.ConnectionStatus) + populate(objectMap, "connectionType", v.ConnectionType) + populate(objectMap, "dpdTimeoutSeconds", v.DpdTimeoutSeconds) + populate(objectMap, "egressBytesTransferred", v.EgressBytesTransferred) + populate(objectMap, "egressNatRules", v.EgressNatRules) + populate(objectMap, "enableBgp", v.EnableBgp) + populate(objectMap, "enablePrivateLinkFastPath", v.EnablePrivateLinkFastPath) + populate(objectMap, "expressRouteGatewayBypass", v.ExpressRouteGatewayBypass) + populate(objectMap, "gatewayCustomBgpIpAddresses", v.GatewayCustomBgpIPAddresses) + populate(objectMap, "ipsecPolicies", v.IPSecPolicies) + populate(objectMap, "ingressBytesTransferred", v.IngressBytesTransferred) + populate(objectMap, "ingressNatRules", v.IngressNatRules) + populate(objectMap, "localNetworkGateway2", v.LocalNetworkGateway2) + populate(objectMap, "peer", v.Peer) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceGuid", v.ResourceGUID) + populate(objectMap, "routingWeight", v.RoutingWeight) + populate(objectMap, "sharedKey", v.SharedKey) + populate(objectMap, "trafficSelectorPolicies", v.TrafficSelectorPolicies) + populate(objectMap, "tunnelConnectionStatus", v.TunnelConnectionStatus) + populate(objectMap, "useLocalAzureIpAddress", v.UseLocalAzureIPAddress) + populate(objectMap, "usePolicyBasedTrafficSelectors", v.UsePolicyBasedTrafficSelectors) + populate(objectMap, "virtualNetworkGateway1", v.VirtualNetworkGateway1) + populate(objectMap, "virtualNetworkGateway2", v.VirtualNetworkGateway2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionPropertiesFormat. +func (v *VirtualNetworkGatewayConnectionPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationKey": + err = unpopulate(val, "AuthorizationKey", &v.AuthorizationKey) + delete(rawMsg, key) + case "connectionMode": + err = unpopulate(val, "ConnectionMode", &v.ConnectionMode) + delete(rawMsg, key) + case "connectionProtocol": + err = unpopulate(val, "ConnectionProtocol", &v.ConnectionProtocol) + delete(rawMsg, key) + case "connectionStatus": + err = unpopulate(val, "ConnectionStatus", &v.ConnectionStatus) + delete(rawMsg, key) + case "connectionType": + err = unpopulate(val, "ConnectionType", &v.ConnectionType) + delete(rawMsg, key) + case "dpdTimeoutSeconds": + err = unpopulate(val, "DpdTimeoutSeconds", &v.DpdTimeoutSeconds) + delete(rawMsg, key) + case "egressBytesTransferred": + err = unpopulate(val, "EgressBytesTransferred", &v.EgressBytesTransferred) + delete(rawMsg, key) + case "egressNatRules": + err = unpopulate(val, "EgressNatRules", &v.EgressNatRules) + delete(rawMsg, key) + case "enableBgp": + err = unpopulate(val, "EnableBgp", &v.EnableBgp) + delete(rawMsg, key) + case "enablePrivateLinkFastPath": + err = unpopulate(val, "EnablePrivateLinkFastPath", &v.EnablePrivateLinkFastPath) + delete(rawMsg, key) + case "expressRouteGatewayBypass": + err = unpopulate(val, "ExpressRouteGatewayBypass", &v.ExpressRouteGatewayBypass) + delete(rawMsg, key) + case "gatewayCustomBgpIpAddresses": + err = unpopulate(val, "GatewayCustomBgpIPAddresses", &v.GatewayCustomBgpIPAddresses) + delete(rawMsg, key) + case "ipsecPolicies": + err = unpopulate(val, "IPSecPolicies", &v.IPSecPolicies) + delete(rawMsg, key) + case "ingressBytesTransferred": + err = unpopulate(val, "IngressBytesTransferred", &v.IngressBytesTransferred) + delete(rawMsg, key) + case "ingressNatRules": + err = unpopulate(val, "IngressNatRules", &v.IngressNatRules) + delete(rawMsg, key) + case "localNetworkGateway2": + err = unpopulate(val, "LocalNetworkGateway2", &v.LocalNetworkGateway2) + delete(rawMsg, key) + case "peer": + err = unpopulate(val, "Peer", &v.Peer) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + case "routingWeight": + err = unpopulate(val, "RoutingWeight", &v.RoutingWeight) + delete(rawMsg, key) + case "sharedKey": + err = unpopulate(val, "SharedKey", &v.SharedKey) + delete(rawMsg, key) + case "trafficSelectorPolicies": + err = unpopulate(val, "TrafficSelectorPolicies", &v.TrafficSelectorPolicies) + delete(rawMsg, key) + case "tunnelConnectionStatus": + err = unpopulate(val, "TunnelConnectionStatus", &v.TunnelConnectionStatus) + delete(rawMsg, key) + case "useLocalAzureIpAddress": + err = unpopulate(val, "UseLocalAzureIPAddress", &v.UseLocalAzureIPAddress) + delete(rawMsg, key) + case "usePolicyBasedTrafficSelectors": + err = unpopulate(val, "UsePolicyBasedTrafficSelectors", &v.UsePolicyBasedTrafficSelectors) + delete(rawMsg, key) + case "virtualNetworkGateway1": + err = unpopulate(val, "VirtualNetworkGateway1", &v.VirtualNetworkGateway1) + delete(rawMsg, key) + case "virtualNetworkGateway2": + err = unpopulate(val, "VirtualNetworkGateway2", &v.VirtualNetworkGateway2) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayIPConfiguration. +func (v VirtualNetworkGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayIPConfiguration. +func (v *VirtualNetworkGatewayIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayIPConfigurationPropertiesFormat. +func (v VirtualNetworkGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIPAddress", v.PrivateIPAddress) + populate(objectMap, "privateIPAllocationMethod", v.PrivateIPAllocationMethod) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "publicIPAddress", v.PublicIPAddress) + populate(objectMap, "subnet", v.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayIPConfigurationPropertiesFormat. +func (v *VirtualNetworkGatewayIPConfigurationPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIPAddress": + err = unpopulate(val, "PrivateIPAddress", &v.PrivateIPAddress) + delete(rawMsg, key) + case "privateIPAllocationMethod": + err = unpopulate(val, "PrivateIPAllocationMethod", &v.PrivateIPAllocationMethod) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "publicIPAddress": + err = unpopulate(val, "PublicIPAddress", &v.PublicIPAddress) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &v.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayListConnectionsResult. +func (v VirtualNetworkGatewayListConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayListConnectionsResult. +func (v *VirtualNetworkGatewayListConnectionsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayListResult. +func (v VirtualNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayListResult. +func (v *VirtualNetworkGatewayListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayNatRule. +func (v VirtualNetworkGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayNatRule. +func (v *VirtualNetworkGatewayNatRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayNatRuleProperties. +func (v VirtualNetworkGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "externalMappings", v.ExternalMappings) + populate(objectMap, "ipConfigurationId", v.IPConfigurationID) + populate(objectMap, "internalMappings", v.InternalMappings) + populate(objectMap, "mode", v.Mode) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayNatRuleProperties. +func (v *VirtualNetworkGatewayNatRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "externalMappings": + err = unpopulate(val, "ExternalMappings", &v.ExternalMappings) + delete(rawMsg, key) + case "ipConfigurationId": + err = unpopulate(val, "IPConfigurationID", &v.IPConfigurationID) + delete(rawMsg, key) + case "internalMappings": + err = unpopulate(val, "InternalMappings", &v.InternalMappings) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &v.Mode) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayPolicyGroup. +func (v VirtualNetworkGatewayPolicyGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayPolicyGroup. +func (v *VirtualNetworkGatewayPolicyGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayPolicyGroupMember. +func (v VirtualNetworkGatewayPolicyGroupMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attributeType", v.AttributeType) + populate(objectMap, "attributeValue", v.AttributeValue) + populate(objectMap, "name", v.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayPolicyGroupMember. +func (v *VirtualNetworkGatewayPolicyGroupMember) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attributeType": + err = unpopulate(val, "AttributeType", &v.AttributeType) + delete(rawMsg, key) + case "attributeValue": + err = unpopulate(val, "AttributeValue", &v.AttributeValue) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayPolicyGroupProperties. +func (v VirtualNetworkGatewayPolicyGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isDefault", v.IsDefault) + populate(objectMap, "policyMembers", v.PolicyMembers) + populate(objectMap, "priority", v.Priority) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "vngClientConnectionConfigurations", v.VngClientConnectionConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayPolicyGroupProperties. +func (v *VirtualNetworkGatewayPolicyGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDefault": + err = unpopulate(val, "IsDefault", &v.IsDefault) + delete(rawMsg, key) + case "policyMembers": + err = unpopulate(val, "PolicyMembers", &v.PolicyMembers) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &v.Priority) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "vngClientConnectionConfigurations": + err = unpopulate(val, "VngClientConnectionConfigurations", &v.VngClientConnectionConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewayPropertiesFormat. +func (v VirtualNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeActive", v.Active) + populate(objectMap, "allowRemoteVnetTraffic", v.AllowRemoteVnetTraffic) + populate(objectMap, "allowVirtualWanTraffic", v.AllowVirtualWanTraffic) + populate(objectMap, "bgpSettings", v.BgpSettings) + populate(objectMap, "customRoutes", v.CustomRoutes) + populate(objectMap, "disableIPSecReplayProtection", v.DisableIPSecReplayProtection) + populate(objectMap, "enableBgp", v.EnableBgp) + populate(objectMap, "enableBgpRouteTranslationForNat", v.EnableBgpRouteTranslationForNat) + populate(objectMap, "enableDnsForwarding", v.EnableDNSForwarding) + populate(objectMap, "enablePrivateIpAddress", v.EnablePrivateIPAddress) + populate(objectMap, "gatewayDefaultSite", v.GatewayDefaultSite) + populate(objectMap, "gatewayType", v.GatewayType) + populate(objectMap, "ipConfigurations", v.IPConfigurations) + populate(objectMap, "inboundDnsForwardingEndpoint", v.InboundDNSForwardingEndpoint) + populate(objectMap, "natRules", v.NatRules) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceGuid", v.ResourceGUID) + populate(objectMap, "sku", v.SKU) + populate(objectMap, "vNetExtendedLocationResourceId", v.VNetExtendedLocationResourceID) + populate(objectMap, "vpnClientConfiguration", v.VPNClientConfiguration) + populate(objectMap, "vpnGatewayGeneration", v.VPNGatewayGeneration) + populate(objectMap, "vpnType", v.VPNType) + populate(objectMap, "virtualNetworkGatewayPolicyGroups", v.VirtualNetworkGatewayPolicyGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayPropertiesFormat. +func (v *VirtualNetworkGatewayPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activeActive": + err = unpopulate(val, "Active", &v.Active) + delete(rawMsg, key) + case "allowRemoteVnetTraffic": + err = unpopulate(val, "AllowRemoteVnetTraffic", &v.AllowRemoteVnetTraffic) + delete(rawMsg, key) + case "allowVirtualWanTraffic": + err = unpopulate(val, "AllowVirtualWanTraffic", &v.AllowVirtualWanTraffic) + delete(rawMsg, key) + case "bgpSettings": + err = unpopulate(val, "BgpSettings", &v.BgpSettings) + delete(rawMsg, key) + case "customRoutes": + err = unpopulate(val, "CustomRoutes", &v.CustomRoutes) + delete(rawMsg, key) + case "disableIPSecReplayProtection": + err = unpopulate(val, "DisableIPSecReplayProtection", &v.DisableIPSecReplayProtection) + delete(rawMsg, key) + case "enableBgp": + err = unpopulate(val, "EnableBgp", &v.EnableBgp) + delete(rawMsg, key) + case "enableBgpRouteTranslationForNat": + err = unpopulate(val, "EnableBgpRouteTranslationForNat", &v.EnableBgpRouteTranslationForNat) + delete(rawMsg, key) + case "enableDnsForwarding": + err = unpopulate(val, "EnableDNSForwarding", &v.EnableDNSForwarding) + delete(rawMsg, key) + case "enablePrivateIpAddress": + err = unpopulate(val, "EnablePrivateIPAddress", &v.EnablePrivateIPAddress) + delete(rawMsg, key) + case "gatewayDefaultSite": + err = unpopulate(val, "GatewayDefaultSite", &v.GatewayDefaultSite) + delete(rawMsg, key) + case "gatewayType": + err = unpopulate(val, "GatewayType", &v.GatewayType) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, "IPConfigurations", &v.IPConfigurations) + delete(rawMsg, key) + case "inboundDnsForwardingEndpoint": + err = unpopulate(val, "InboundDNSForwardingEndpoint", &v.InboundDNSForwardingEndpoint) + delete(rawMsg, key) + case "natRules": + err = unpopulate(val, "NatRules", &v.NatRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &v.SKU) + delete(rawMsg, key) + case "vNetExtendedLocationResourceId": + err = unpopulate(val, "VNetExtendedLocationResourceID", &v.VNetExtendedLocationResourceID) + delete(rawMsg, key) + case "vpnClientConfiguration": + err = unpopulate(val, "VPNClientConfiguration", &v.VPNClientConfiguration) + delete(rawMsg, key) + case "vpnGatewayGeneration": + err = unpopulate(val, "VPNGatewayGeneration", &v.VPNGatewayGeneration) + delete(rawMsg, key) + case "vpnType": + err = unpopulate(val, "VPNType", &v.VPNType) + delete(rawMsg, key) + case "virtualNetworkGatewayPolicyGroups": + err = unpopulate(val, "VirtualNetworkGatewayPolicyGroups", &v.VirtualNetworkGatewayPolicyGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkGatewaySKU. +func (v VirtualNetworkGatewaySKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", v.Capacity) + populate(objectMap, "name", v.Name) + populate(objectMap, "tier", v.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaySKU. +func (v *VirtualNetworkGatewaySKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &v.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &v.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkListResult. +func (v VirtualNetworkListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkListResult. +func (v *VirtualNetworkListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkListUsageResult. +func (v VirtualNetworkListUsageResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkListUsageResult. +func (v *VirtualNetworkListUsageResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPeering. +func (v VirtualNetworkPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPeering. +func (v *VirtualNetworkPeering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPeeringListResult. +func (v VirtualNetworkPeeringListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPeeringListResult. +func (v *VirtualNetworkPeeringListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPeeringPropertiesFormat. +func (v VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowForwardedTraffic", v.AllowForwardedTraffic) + populate(objectMap, "allowGatewayTransit", v.AllowGatewayTransit) + populate(objectMap, "allowVirtualNetworkAccess", v.AllowVirtualNetworkAccess) + populate(objectMap, "doNotVerifyRemoteGateways", v.DoNotVerifyRemoteGateways) + populate(objectMap, "peeringState", v.PeeringState) + populate(objectMap, "peeringSyncLevel", v.PeeringSyncLevel) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "remoteAddressSpace", v.RemoteAddressSpace) + populate(objectMap, "remoteBgpCommunities", v.RemoteBgpCommunities) + populate(objectMap, "remoteVirtualNetwork", v.RemoteVirtualNetwork) + populate(objectMap, "remoteVirtualNetworkAddressSpace", v.RemoteVirtualNetworkAddressSpace) + populate(objectMap, "remoteVirtualNetworkEncryption", v.RemoteVirtualNetworkEncryption) + populate(objectMap, "resourceGuid", v.ResourceGUID) + populate(objectMap, "useRemoteGateways", v.UseRemoteGateways) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPeeringPropertiesFormat. +func (v *VirtualNetworkPeeringPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowForwardedTraffic": + err = unpopulate(val, "AllowForwardedTraffic", &v.AllowForwardedTraffic) + delete(rawMsg, key) + case "allowGatewayTransit": + err = unpopulate(val, "AllowGatewayTransit", &v.AllowGatewayTransit) + delete(rawMsg, key) + case "allowVirtualNetworkAccess": + err = unpopulate(val, "AllowVirtualNetworkAccess", &v.AllowVirtualNetworkAccess) + delete(rawMsg, key) + case "doNotVerifyRemoteGateways": + err = unpopulate(val, "DoNotVerifyRemoteGateways", &v.DoNotVerifyRemoteGateways) + delete(rawMsg, key) + case "peeringState": + err = unpopulate(val, "PeeringState", &v.PeeringState) + delete(rawMsg, key) + case "peeringSyncLevel": + err = unpopulate(val, "PeeringSyncLevel", &v.PeeringSyncLevel) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "remoteAddressSpace": + err = unpopulate(val, "RemoteAddressSpace", &v.RemoteAddressSpace) + delete(rawMsg, key) + case "remoteBgpCommunities": + err = unpopulate(val, "RemoteBgpCommunities", &v.RemoteBgpCommunities) + delete(rawMsg, key) + case "remoteVirtualNetwork": + err = unpopulate(val, "RemoteVirtualNetwork", &v.RemoteVirtualNetwork) + delete(rawMsg, key) + case "remoteVirtualNetworkAddressSpace": + err = unpopulate(val, "RemoteVirtualNetworkAddressSpace", &v.RemoteVirtualNetworkAddressSpace) + delete(rawMsg, key) + case "remoteVirtualNetworkEncryption": + err = unpopulate(val, "RemoteVirtualNetworkEncryption", &v.RemoteVirtualNetworkEncryption) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + case "useRemoteGateways": + err = unpopulate(val, "UseRemoteGateways", &v.UseRemoteGateways) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesFormat. +func (v VirtualNetworkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressSpace", v.AddressSpace) + populate(objectMap, "bgpCommunities", v.BgpCommunities) + populate(objectMap, "ddosProtectionPlan", v.DdosProtectionPlan) + populate(objectMap, "dhcpOptions", v.DhcpOptions) + populate(objectMap, "enableDdosProtection", v.EnableDdosProtection) + populate(objectMap, "enableVmProtection", v.EnableVMProtection) + populate(objectMap, "encryption", v.Encryption) + populate(objectMap, "flowTimeoutInMinutes", v.FlowTimeoutInMinutes) + populate(objectMap, "ipAllocations", v.IPAllocations) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceGuid", v.ResourceGUID) + populate(objectMap, "subnets", v.Subnets) + populate(objectMap, "virtualNetworkPeerings", v.VirtualNetworkPeerings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesFormat. +func (v *VirtualNetworkPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressSpace": + err = unpopulate(val, "AddressSpace", &v.AddressSpace) + delete(rawMsg, key) + case "bgpCommunities": + err = unpopulate(val, "BgpCommunities", &v.BgpCommunities) + delete(rawMsg, key) + case "ddosProtectionPlan": + err = unpopulate(val, "DdosProtectionPlan", &v.DdosProtectionPlan) + delete(rawMsg, key) + case "dhcpOptions": + err = unpopulate(val, "DhcpOptions", &v.DhcpOptions) + delete(rawMsg, key) + case "enableDdosProtection": + err = unpopulate(val, "EnableDdosProtection", &v.EnableDdosProtection) + delete(rawMsg, key) + case "enableVmProtection": + err = unpopulate(val, "EnableVMProtection", &v.EnableVMProtection) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &v.Encryption) + delete(rawMsg, key) + case "flowTimeoutInMinutes": + err = unpopulate(val, "FlowTimeoutInMinutes", &v.FlowTimeoutInMinutes) + delete(rawMsg, key) + case "ipAllocations": + err = unpopulate(val, "IPAllocations", &v.IPAllocations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &v.Subnets) + delete(rawMsg, key) + case "virtualNetworkPeerings": + err = unpopulate(val, "VirtualNetworkPeerings", &v.VirtualNetworkPeerings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkTap. +func (v VirtualNetworkTap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkTap. +func (v *VirtualNetworkTap) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkTapListResult. +func (v VirtualNetworkTapListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkTapListResult. +func (v *VirtualNetworkTapListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkTapPropertiesFormat. +func (v VirtualNetworkTapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationLoadBalancerFrontEndIPConfiguration", v.DestinationLoadBalancerFrontEndIPConfiguration) + populate(objectMap, "destinationNetworkInterfaceIPConfiguration", v.DestinationNetworkInterfaceIPConfiguration) + populate(objectMap, "destinationPort", v.DestinationPort) + populate(objectMap, "networkInterfaceTapConfigurations", v.NetworkInterfaceTapConfigurations) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceGuid", v.ResourceGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkTapPropertiesFormat. +func (v *VirtualNetworkTapPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationLoadBalancerFrontEndIPConfiguration": + err = unpopulate(val, "DestinationLoadBalancerFrontEndIPConfiguration", &v.DestinationLoadBalancerFrontEndIPConfiguration) + delete(rawMsg, key) + case "destinationNetworkInterfaceIPConfiguration": + err = unpopulate(val, "DestinationNetworkInterfaceIPConfiguration", &v.DestinationNetworkInterfaceIPConfiguration) + delete(rawMsg, key) + case "destinationPort": + err = unpopulate(val, "DestinationPort", &v.DestinationPort) + delete(rawMsg, key) + case "networkInterfaceTapConfigurations": + err = unpopulate(val, "NetworkInterfaceTapConfigurations", &v.NetworkInterfaceTapConfigurations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "resourceGuid": + err = unpopulate(val, "ResourceGUID", &v.ResourceGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkUsage. +func (v VirtualNetworkUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", v.CurrentValue) + populate(objectMap, "id", v.ID) + populate(objectMap, "limit", v.Limit) + populate(objectMap, "name", v.Name) + populate(objectMap, "unit", v.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkUsage. +func (v *VirtualNetworkUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &v.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &v.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &v.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkUsageName. +func (v VirtualNetworkUsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", v.LocalizedValue) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkUsageName. +func (v *VirtualNetworkUsageName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &v.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouter. +func (v VirtualRouter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouter. +func (v *VirtualRouter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterAutoScaleConfiguration. +func (v VirtualRouterAutoScaleConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "minCapacity", v.MinCapacity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterAutoScaleConfiguration. +func (v *VirtualRouterAutoScaleConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "minCapacity": + err = unpopulate(val, "MinCapacity", &v.MinCapacity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterListResult. +func (v VirtualRouterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterListResult. +func (v *VirtualRouterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterPeering. +func (v VirtualRouterPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterPeering. +func (v *VirtualRouterPeering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterPeeringListResult. +func (v VirtualRouterPeeringListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterPeeringListResult. +func (v *VirtualRouterPeeringListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterPeeringProperties. +func (v VirtualRouterPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "peerAsn", v.PeerAsn) + populate(objectMap, "peerIp", v.PeerIP) + populate(objectMap, "provisioningState", v.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterPeeringProperties. +func (v *VirtualRouterPeeringProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "peerAsn": + err = unpopulate(val, "PeerAsn", &v.PeerAsn) + delete(rawMsg, key) + case "peerIp": + err = unpopulate(val, "PeerIP", &v.PeerIP) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualRouterPropertiesFormat. +func (v VirtualRouterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostedGateway", v.HostedGateway) + populate(objectMap, "hostedSubnet", v.HostedSubnet) + populate(objectMap, "peerings", v.Peerings) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "virtualRouterAsn", v.VirtualRouterAsn) + populate(objectMap, "virtualRouterIps", v.VirtualRouterIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualRouterPropertiesFormat. +func (v *VirtualRouterPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostedGateway": + err = unpopulate(val, "HostedGateway", &v.HostedGateway) + delete(rawMsg, key) + case "hostedSubnet": + err = unpopulate(val, "HostedSubnet", &v.HostedSubnet) + delete(rawMsg, key) + case "peerings": + err = unpopulate(val, "Peerings", &v.Peerings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "virtualRouterAsn": + err = unpopulate(val, "VirtualRouterAsn", &v.VirtualRouterAsn) + delete(rawMsg, key) + case "virtualRouterIps": + err = unpopulate(val, "VirtualRouterIPs", &v.VirtualRouterIPs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualWAN. +func (v VirtualWAN) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualWAN. +func (v *VirtualWAN) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualWanProperties. +func (v VirtualWanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowBranchToBranchTraffic", v.AllowBranchToBranchTraffic) + populate(objectMap, "allowVnetToVnetTraffic", v.AllowVnetToVnetTraffic) + populate(objectMap, "disableVpnEncryption", v.DisableVPNEncryption) + populate(objectMap, "office365LocalBreakoutCategory", v.Office365LocalBreakoutCategory) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "type", v.Type) + populate(objectMap, "vpnSites", v.VPNSites) + populate(objectMap, "virtualHubs", v.VirtualHubs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualWanProperties. +func (v *VirtualWanProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowBranchToBranchTraffic": + err = unpopulate(val, "AllowBranchToBranchTraffic", &v.AllowBranchToBranchTraffic) + delete(rawMsg, key) + case "allowVnetToVnetTraffic": + err = unpopulate(val, "AllowVnetToVnetTraffic", &v.AllowVnetToVnetTraffic) + delete(rawMsg, key) + case "disableVpnEncryption": + err = unpopulate(val, "DisableVPNEncryption", &v.DisableVPNEncryption) + delete(rawMsg, key) + case "office365LocalBreakoutCategory": + err = unpopulate(val, "Office365LocalBreakoutCategory", &v.Office365LocalBreakoutCategory) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "vpnSites": + err = unpopulate(val, "VPNSites", &v.VPNSites) + delete(rawMsg, key) + case "virtualHubs": + err = unpopulate(val, "VirtualHubs", &v.VirtualHubs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualWanSecurityProvider. +func (v VirtualWanSecurityProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", v.Name) + populate(objectMap, "type", v.Type) + populate(objectMap, "url", v.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualWanSecurityProvider. +func (v *VirtualWanSecurityProvider) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &v.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualWanSecurityProviders. +func (v VirtualWanSecurityProviders) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "supportedProviders", v.SupportedProviders) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualWanSecurityProviders. +func (v *VirtualWanSecurityProviders) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "supportedProviders": + err = unpopulate(val, "SupportedProviders", &v.SupportedProviders) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualWanVPNProfileParameters. +func (v VirtualWanVPNProfileParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationMethod", v.AuthenticationMethod) + populate(objectMap, "vpnServerConfigurationResourceId", v.VPNServerConfigurationResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualWanVPNProfileParameters. +func (v *VirtualWanVPNProfileParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationMethod": + err = unpopulate(val, "AuthenticationMethod", &v.AuthenticationMethod) + delete(rawMsg, key) + case "vpnServerConfigurationResourceId": + err = unpopulate(val, "VPNServerConfigurationResourceID", &v.VPNServerConfigurationResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VnetRoute. +func (v VnetRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bgpConnections", v.BgpConnections) + populate(objectMap, "staticRoutes", v.StaticRoutes) + populate(objectMap, "staticRoutesConfig", v.StaticRoutesConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VnetRoute. +func (v *VnetRoute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bgpConnections": + err = unpopulate(val, "BgpConnections", &v.BgpConnections) + delete(rawMsg, key) + case "staticRoutes": + err = unpopulate(val, "StaticRoutes", &v.StaticRoutes) + delete(rawMsg, key) + case "staticRoutesConfig": + err = unpopulate(val, "StaticRoutesConfig", &v.StaticRoutesConfig) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VngClientConnectionConfiguration. +func (v VngClientConnectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", v.Etag) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VngClientConnectionConfiguration. +func (v *VngClientConnectionConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &v.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VngClientConnectionConfigurationProperties. +func (v VngClientConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "vpnClientAddressPool", v.VPNClientAddressPool) + populate(objectMap, "virtualNetworkGatewayPolicyGroups", v.VirtualNetworkGatewayPolicyGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VngClientConnectionConfigurationProperties. +func (v *VngClientConnectionConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "vpnClientAddressPool": + err = unpopulate(val, "VPNClientAddressPool", &v.VPNClientAddressPool) + delete(rawMsg, key) + case "virtualNetworkGatewayPolicyGroups": + err = unpopulate(val, "VirtualNetworkGatewayPolicyGroups", &v.VirtualNetworkGatewayPolicyGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Watcher. +func (w *Watcher) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherListResult. +func (w WatcherListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherListResult. +func (w *WatcherListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherPropertiesFormat. +func (w WatcherPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", w.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherPropertiesFormat. +func (w *WatcherPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallCustomRule. +func (w WebApplicationFirewallCustomRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", w.Action) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "matchConditions", w.MatchConditions) + populate(objectMap, "name", w.Name) + populate(objectMap, "priority", w.Priority) + populate(objectMap, "ruleType", w.RuleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallCustomRule. +func (w *WebApplicationFirewallCustomRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &w.Action) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "matchConditions": + err = unpopulate(val, "MatchConditions", &w.MatchConditions) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &w.Priority) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &w.RuleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicy. +func (w WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicy. +func (w *WebApplicationFirewallPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicyListResult. +func (w WebApplicationFirewallPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicyListResult. +func (w *WebApplicationFirewallPolicyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebApplicationFirewallPolicyPropertiesFormat. +func (w WebApplicationFirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationGateways", w.ApplicationGateways) + populate(objectMap, "customRules", w.CustomRules) + populate(objectMap, "httpListeners", w.HTTPListeners) + populate(objectMap, "managedRules", w.ManagedRules) + populate(objectMap, "pathBasedRules", w.PathBasedRules) + populate(objectMap, "policySettings", w.PolicySettings) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "resourceState", w.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebApplicationFirewallPolicyPropertiesFormat. +func (w *WebApplicationFirewallPolicyPropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationGateways": + err = unpopulate(val, "ApplicationGateways", &w.ApplicationGateways) + delete(rawMsg, key) + case "customRules": + err = unpopulate(val, "CustomRules", &w.CustomRules) + delete(rawMsg, key) + case "httpListeners": + err = unpopulate(val, "HTTPListeners", &w.HTTPListeners) + delete(rawMsg, key) + case "managedRules": + err = unpopulate(val, "ManagedRules", &w.ManagedRules) + delete(rawMsg, key) + case "pathBasedRules": + err = unpopulate(val, "PathBasedRules", &w.PathBasedRules) + delete(rawMsg, key) + case "policySettings": + err = unpopulate(val, "PolicySettings", &w.PolicySettings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, "ResourceState", &w.ResourceState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natgateways_client.go new file mode 100644 index 000000000..345f0914a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natgateways_client.go @@ -0,0 +1,424 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NatGatewaysClient contains the methods for the NatGateways group. +// Don't use this type directly, use NewNatGatewaysClient() instead. +type NatGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewNatGatewaysClient creates a new instance of NatGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewNatGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NatGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &NatGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// natGatewayName - The name of the nat gateway. +// parameters - Parameters supplied to the create or update nat gateway operation. +// options - NatGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the NatGatewaysClient.BeginCreateOrUpdate +// method. +func (client *NatGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway, options *NatGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[NatGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, natGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NatGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[NatGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *NatGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway, options *NatGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, natGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *NatGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway, options *NatGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if natGatewayName == "" { + return nil, errors.New("parameter natGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natGatewayName}", url.PathEscape(natGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// natGatewayName - The name of the nat gateway. +// options - NatGatewaysClientBeginDeleteOptions contains the optional parameters for the NatGatewaysClient.BeginDelete method. +func (client *NatGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientBeginDeleteOptions) (*runtime.Poller[NatGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, natGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NatGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[NatGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified nat gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *NatGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, natGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *NatGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if natGatewayName == "" { + return nil, errors.New("parameter natGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natGatewayName}", url.PathEscape(natGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified nat gateway in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// natGatewayName - The name of the nat gateway. +// options - NatGatewaysClientGetOptions contains the optional parameters for the NatGatewaysClient.Get method. +func (client *NatGatewaysClient) Get(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientGetOptions) (NatGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, natGatewayName, options) + if err != nil { + return NatGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *NatGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, natGatewayName string, options *NatGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if natGatewayName == "" { + return nil, errors.New("parameter natGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natGatewayName}", url.PathEscape(natGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NatGatewaysClient) getHandleResponse(resp *http.Response) (NatGatewaysClientGetResponse, error) { + result := NatGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NatGateway); err != nil { + return NatGatewaysClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all nat gateways in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - NatGatewaysClientListOptions contains the optional parameters for the NatGatewaysClient.List method. +func (client *NatGatewaysClient) NewListPager(resourceGroupName string, options *NatGatewaysClientListOptions) *runtime.Pager[NatGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[NatGatewaysClientListResponse]{ + More: func(page NatGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NatGatewaysClientListResponse) (NatGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NatGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *NatGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *NatGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NatGatewaysClient) listHandleResponse(resp *http.Response) (NatGatewaysClientListResponse, error) { + result := NatGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NatGatewayListResult); err != nil { + return NatGatewaysClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the Nat Gateways in a subscription. +// Generated from API version 2022-05-01 +// options - NatGatewaysClientListAllOptions contains the optional parameters for the NatGatewaysClient.ListAll method. +func (client *NatGatewaysClient) NewListAllPager(options *NatGatewaysClientListAllOptions) *runtime.Pager[NatGatewaysClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[NatGatewaysClientListAllResponse]{ + More: func(page NatGatewaysClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NatGatewaysClientListAllResponse) (NatGatewaysClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NatGatewaysClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatGatewaysClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatGatewaysClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *NatGatewaysClient) listAllCreateRequest(ctx context.Context, options *NatGatewaysClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *NatGatewaysClient) listAllHandleResponse(resp *http.Response) (NatGatewaysClientListAllResponse, error) { + result := NatGatewaysClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NatGatewayListResult); err != nil { + return NatGatewaysClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates nat gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// natGatewayName - The name of the nat gateway. +// parameters - Parameters supplied to update nat gateway tags. +// options - NatGatewaysClientUpdateTagsOptions contains the optional parameters for the NatGatewaysClient.UpdateTags method. +func (client *NatGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, natGatewayName string, parameters TagsObject, options *NatGatewaysClientUpdateTagsOptions) (NatGatewaysClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, natGatewayName, parameters, options) + if err != nil { + return NatGatewaysClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatGatewaysClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatGatewaysClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *NatGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, natGatewayName string, parameters TagsObject, options *NatGatewaysClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if natGatewayName == "" { + return nil, errors.New("parameter natGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natGatewayName}", url.PathEscape(natGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *NatGatewaysClient) updateTagsHandleResponse(resp *http.Response) (NatGatewaysClientUpdateTagsResponse, error) { + result := NatGatewaysClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NatGateway); err != nil { + return NatGatewaysClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natrules_client.go new file mode 100644 index 000000000..92c89ca47 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/natrules_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NatRulesClient contains the methods for the NatRules group. +// Don't use this type directly, use NewNatRulesClient() instead. +type NatRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewNatRulesClient creates a new instance of NatRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NatRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &NatRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// natRuleParameters - Parameters supplied to create or Update a Nat Rule. +// options - NatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the NatRulesClient.BeginCreateOrUpdate +// method. +func (client *NatRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VPNGatewayNatRule, options *NatRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NatRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, gatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[NatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *NatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VPNGatewayNatRule, options *NatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *NatRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VPNGatewayNatRule, options *NatRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, natRuleParameters) +} + +// BeginDelete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// options - NatRulesClientBeginDeleteOptions contains the optional parameters for the NatRulesClient.BeginDelete method. +func (client *NatRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientBeginDeleteOptions) (*runtime.Poller[NatRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, gatewayName, natRuleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[NatRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *NatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *NatRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a nat ruleGet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// options - NatRulesClientGetOptions contains the optional parameters for the NatRulesClient.Get method. +func (client *NatRulesClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientGetOptions) (NatRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, natRuleName, options) + if err != nil { + return NatRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *NatRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, options *NatRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NatRulesClient) getHandleResponse(resp *http.Response) (NatRulesClientGetResponse, error) { + result := NatRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNGatewayNatRule); err != nil { + return NatRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByVPNGatewayPager - Retrieves all nat rules for a particular virtual wan vpn gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - NatRulesClientListByVPNGatewayOptions contains the optional parameters for the NatRulesClient.ListByVPNGateway +// method. +func (client *NatRulesClient) NewListByVPNGatewayPager(resourceGroupName string, gatewayName string, options *NatRulesClientListByVPNGatewayOptions) *runtime.Pager[NatRulesClientListByVPNGatewayResponse] { + return runtime.NewPager(runtime.PagingHandler[NatRulesClientListByVPNGatewayResponse]{ + More: func(page NatRulesClientListByVPNGatewayResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NatRulesClientListByVPNGatewayResponse) (NatRulesClientListByVPNGatewayResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVPNGatewayCreateRequest(ctx, resourceGroupName, gatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NatRulesClientListByVPNGatewayResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NatRulesClientListByVPNGatewayResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NatRulesClientListByVPNGatewayResponse{}, runtime.NewResponseError(resp) + } + return client.listByVPNGatewayHandleResponse(resp) + }, + }) +} + +// listByVPNGatewayCreateRequest creates the ListByVPNGateway request. +func (client *NatRulesClient) listByVPNGatewayCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *NatRulesClientListByVPNGatewayOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVPNGatewayHandleResponse handles the ListByVPNGateway response. +func (client *NatRulesClient) listByVPNGatewayHandleResponse(resp *http.Response) (NatRulesClientListByVPNGatewayResponse, error) { + result := NatRulesClientListByVPNGatewayResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewayNatRulesResult); err != nil { + return NatRulesClientListByVPNGatewayResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/operations_client.go new file mode 100644 index 000000000..0cf0155e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/operations_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists all of the available Network Rest API operations. +// Generated from API version 2022-05-01 +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Network/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/p2svpngateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/p2svpngateways_client.go new file mode 100644 index 000000000..89834d997 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/p2svpngateways_client.go @@ -0,0 +1,766 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// P2SVPNGatewaysClient contains the methods for the P2SVPNGateways group. +// Don't use this type directly, use NewP2SVPNGatewaysClient() instead. +type P2SVPNGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewP2SVPNGatewaysClient creates a new instance of P2SVPNGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewP2SVPNGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*P2SVPNGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &P2SVPNGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// gatewayName - The name of the gateway. +// p2SVPNGatewayParameters - Parameters supplied to create or Update a virtual wan p2s vpn gateway. +// options - P2SVPNGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginCreateOrUpdate +// method. +func (client *P2SVPNGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters P2SVPNGateway, options *P2SVPNGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[P2SVPNGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters P2SVPNGateway, options *P2SVPNGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *P2SVPNGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters P2SVPNGateway, options *P2SVPNGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, p2SVPNGatewayParameters) +} + +// BeginDelete - Deletes a virtual wan p2s vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// gatewayName - The name of the gateway. +// options - P2SVPNGatewaysClientBeginDeleteOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginDelete +// method. +func (client *P2SVPNGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginDeleteOptions) (*runtime.Poller[P2SVPNGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a virtual wan p2s vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *P2SVPNGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDisconnectP2SVPNConnections - Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// p2SVPNGatewayName - The name of the P2S Vpn Gateway. +// request - The parameters are supplied to disconnect p2s vpn connections. +// options - P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginDisconnectP2SVPNConnections +// method. +func (client *P2SVPNGatewaysClient) BeginDisconnectP2SVPNConnections(ctx context.Context, resourceGroupName string, p2SVPNGatewayName string, request P2SVPNConnectionRequest, options *P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions) (*runtime.Poller[P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.disconnectP2SVPNConnections(ctx, resourceGroupName, p2SVPNGatewayName, request, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse](options.ResumeToken, client.pl, nil) + } +} + +// DisconnectP2SVPNConnections - Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) disconnectP2SVPNConnections(ctx context.Context, resourceGroupName string, p2SVPNGatewayName string, request P2SVPNConnectionRequest, options *P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions) (*http.Response, error) { + req, err := client.disconnectP2SVPNConnectionsCreateRequest(ctx, resourceGroupName, p2SVPNGatewayName, request, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// disconnectP2SVPNConnectionsCreateRequest creates the DisconnectP2SVPNConnections request. +func (client *P2SVPNGatewaysClient) disconnectP2SVPNConnectionsCreateRequest(ctx context.Context, resourceGroupName string, p2SVPNGatewayName string, request P2SVPNConnectionRequest, options *P2SVPNGatewaysClientBeginDisconnectP2SVPNConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if p2SVPNGatewayName == "" { + return nil, errors.New("parameter p2SVPNGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{p2sVpnGatewayName}", url.PathEscape(p2SVPNGatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// BeginGenerateVPNProfile - Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the P2SVpnGateway. +// parameters - Parameters supplied to the generate P2SVpnGateway VPN client package operation. +// options - P2SVPNGatewaysClientBeginGenerateVPNProfileOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGenerateVPNProfile +// method. +func (client *P2SVPNGatewaysClient) BeginGenerateVPNProfile(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVPNProfileParameters, options *P2SVPNGatewaysClientBeginGenerateVPNProfileOptions) (*runtime.Poller[P2SVPNGatewaysClientGenerateVPNProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateVPNProfile(ctx, resourceGroupName, gatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientGenerateVPNProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGenerateVPNProfileResponse](options.ResumeToken, client.pl, nil) + } +} + +// GenerateVPNProfile - Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) generateVPNProfile(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVPNProfileParameters, options *P2SVPNGatewaysClientBeginGenerateVPNProfileOptions) (*http.Response, error) { + req, err := client.generateVPNProfileCreateRequest(ctx, resourceGroupName, gatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateVPNProfileCreateRequest creates the GenerateVPNProfile request. +func (client *P2SVPNGatewaysClient) generateVPNProfileCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVPNProfileParameters, options *P2SVPNGatewaysClientBeginGenerateVPNProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/generatevpnprofile" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Get - Retrieves the details of a virtual wan p2s vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// gatewayName - The name of the gateway. +// options - P2SVPNGatewaysClientGetOptions contains the optional parameters for the P2SVPNGatewaysClient.Get method. +func (client *P2SVPNGatewaysClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientGetOptions) (P2SVPNGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return P2SVPNGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return P2SVPNGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return P2SVPNGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *P2SVPNGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *P2SVPNGatewaysClient) getHandleResponse(resp *http.Response) (P2SVPNGatewaysClientGetResponse, error) { + result := P2SVPNGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.P2SVPNGateway); err != nil { + return P2SVPNGatewaysClientGetResponse{}, err + } + return result, nil +} + +// BeginGetP2SVPNConnectionHealth - Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the P2SVpnGateway. +// options - P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealth +// method. +func (client *P2SVPNGatewaysClient) BeginGetP2SVPNConnectionHealth(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions) (*runtime.Poller[P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getP2SVPNConnectionHealth(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetP2SVPNConnectionHealth - Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealth(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions) (*http.Response, error) { + req, err := client.getP2SVPNConnectionHealthCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getP2SVPNConnectionHealthCreateRequest creates the GetP2SVPNConnectionHealth request. +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetP2SVPNConnectionHealthDetailed - Gets the sas url to get the connection health detail of P2S clients of the virtual +// wan P2SVpnGateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the P2SVpnGateway. +// request - Request parameters supplied to get p2s vpn connections detailed health. +// options - P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginGetP2SVPNConnectionHealthDetailed +// method. +func (client *P2SVPNGatewaysClient) BeginGetP2SVPNConnectionHealthDetailed(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVPNConnectionHealthRequest, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions) (*runtime.Poller[P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getP2SVPNConnectionHealthDetailed(ctx, resourceGroupName, gatewayName, request, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetP2SVPNConnectionHealthDetailed - Gets the sas url to get the connection health detail of P2S clients of the virtual +// wan P2SVpnGateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthDetailed(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVPNConnectionHealthRequest, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions) (*http.Response, error) { + req, err := client.getP2SVPNConnectionHealthDetailedCreateRequest(ctx, resourceGroupName, gatewayName, request, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getP2SVPNConnectionHealthDetailedCreateRequest creates the GetP2SVPNConnectionHealthDetailed request. +func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthDetailedCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVPNConnectionHealthRequest, options *P2SVPNGatewaysClientBeginGetP2SVPNConnectionHealthDetailedOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// NewListPager - Lists all the P2SVpnGateways in a subscription. +// Generated from API version 2022-05-01 +// options - P2SVPNGatewaysClientListOptions contains the optional parameters for the P2SVPNGatewaysClient.List method. +func (client *P2SVPNGatewaysClient) NewListPager(options *P2SVPNGatewaysClientListOptions) *runtime.Pager[P2SVPNGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[P2SVPNGatewaysClientListResponse]{ + More: func(page P2SVPNGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *P2SVPNGatewaysClientListResponse) (P2SVPNGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return P2SVPNGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return P2SVPNGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return P2SVPNGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *P2SVPNGatewaysClient) listCreateRequest(ctx context.Context, options *P2SVPNGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *P2SVPNGatewaysClient) listHandleResponse(resp *http.Response) (P2SVPNGatewaysClientListResponse, error) { + result := P2SVPNGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListP2SVPNGatewaysResult); err != nil { + return P2SVPNGatewaysClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the P2SVpnGateways in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// options - P2SVPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the P2SVPNGatewaysClient.ListByResourceGroup +// method. +func (client *P2SVPNGatewaysClient) NewListByResourceGroupPager(resourceGroupName string, options *P2SVPNGatewaysClientListByResourceGroupOptions) *runtime.Pager[P2SVPNGatewaysClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[P2SVPNGatewaysClientListByResourceGroupResponse]{ + More: func(page P2SVPNGatewaysClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *P2SVPNGatewaysClientListByResourceGroupResponse) (P2SVPNGatewaysClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return P2SVPNGatewaysClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return P2SVPNGatewaysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return P2SVPNGatewaysClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *P2SVPNGatewaysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *P2SVPNGatewaysClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *P2SVPNGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (P2SVPNGatewaysClientListByResourceGroupResponse, error) { + result := P2SVPNGatewaysClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListP2SVPNGatewaysResult); err != nil { + return P2SVPNGatewaysClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginReset - Resets the primary of the p2s vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// gatewayName - The name of the gateway. +// options - P2SVPNGatewaysClientBeginResetOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginReset +// method. +func (client *P2SVPNGatewaysClient) BeginReset(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginResetOptions) (*runtime.Poller[P2SVPNGatewaysClientResetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reset(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientResetResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reset - Resets the primary of the p2s vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) reset(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginResetOptions) (*http.Response, error) { + req, err := client.resetCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetCreateRequest creates the Reset request. +func (client *P2SVPNGatewaysClient) resetCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *P2SVPNGatewaysClientBeginResetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdateTags - Updates virtual wan p2s vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the P2SVpnGateway. +// gatewayName - The name of the gateway. +// p2SVPNGatewayParameters - Parameters supplied to update a virtual wan p2s vpn gateway tags. +// options - P2SVPNGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the P2SVPNGatewaysClient.BeginUpdateTags +// method. +func (client *P2SVPNGatewaysClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters TagsObject, options *P2SVPNGatewaysClientBeginUpdateTagsOptions) (*runtime.Poller[P2SVPNGatewaysClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[P2SVPNGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[P2SVPNGatewaysClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates virtual wan p2s vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *P2SVPNGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters TagsObject, options *P2SVPNGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, gatewayName, p2SVPNGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *P2SVPNGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, p2SVPNGatewayParameters TagsObject, options *P2SVPNGatewaysClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, p2SVPNGatewayParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/packetcaptures_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/packetcaptures_client.go new file mode 100644 index 000000000..2ec0c9f01 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/packetcaptures_client.go @@ -0,0 +1,461 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PacketCapturesClient contains the methods for the PacketCaptures group. +// Don't use this type directly, use NewPacketCapturesClient() instead. +type PacketCapturesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPacketCapturesClient creates a new instance of PacketCapturesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPacketCapturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PacketCapturesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PacketCapturesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Create and start a packet capture on the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// packetCaptureName - The name of the packet capture session. +// parameters - Parameters that define the create packet capture operation. +// options - PacketCapturesClientBeginCreateOptions contains the optional parameters for the PacketCapturesClient.BeginCreate +// method. +func (client *PacketCapturesClient) BeginCreate(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, options *PacketCapturesClientBeginCreateOptions) (*runtime.Poller[PacketCapturesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCapturesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Create and start a packet capture on the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PacketCapturesClient) create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, options *PacketCapturesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *PacketCapturesClient) createCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, options *PacketCapturesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if packetCaptureName == "" { + return nil, errors.New("parameter packetCaptureName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCaptureName}", url.PathEscape(packetCaptureName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// packetCaptureName - The name of the packet capture session. +// options - PacketCapturesClientBeginDeleteOptions contains the optional parameters for the PacketCapturesClient.BeginDelete +// method. +func (client *PacketCapturesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginDeleteOptions) (*runtime.Poller[PacketCapturesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCapturesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PacketCapturesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PacketCapturesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if packetCaptureName == "" { + return nil, errors.New("parameter packetCaptureName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCaptureName}", url.PathEscape(packetCaptureName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a packet capture session by name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// packetCaptureName - The name of the packet capture session. +// options - PacketCapturesClientGetOptions contains the optional parameters for the PacketCapturesClient.Get method. +func (client *PacketCapturesClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientGetOptions) (PacketCapturesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return PacketCapturesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PacketCapturesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PacketCapturesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PacketCapturesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if packetCaptureName == "" { + return nil, errors.New("parameter packetCaptureName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCaptureName}", url.PathEscape(packetCaptureName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PacketCapturesClient) getHandleResponse(resp *http.Response) (PacketCapturesClientGetResponse, error) { + result := PacketCapturesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PacketCaptureResult); err != nil { + return PacketCapturesClientGetResponse{}, err + } + return result, nil +} + +// BeginGetStatus - Query the status of a running packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the Network Watcher resource. +// packetCaptureName - The name given to the packet capture session. +// options - PacketCapturesClientBeginGetStatusOptions contains the optional parameters for the PacketCapturesClient.BeginGetStatus +// method. +func (client *PacketCapturesClient) BeginGetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginGetStatusOptions) (*runtime.Poller[PacketCapturesClientGetStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getStatus(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCapturesClientGetStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientGetStatusResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetStatus - Query the status of a running packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PacketCapturesClient) getStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginGetStatusOptions) (*http.Response, error) { + req, err := client.getStatusCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getStatusCreateRequest creates the GetStatus request. +func (client *PacketCapturesClient) getStatusCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginGetStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if packetCaptureName == "" { + return nil, errors.New("parameter packetCaptureName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCaptureName}", url.PathEscape(packetCaptureName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListPager - Lists all packet capture sessions within the specified resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the Network Watcher resource. +// options - PacketCapturesClientListOptions contains the optional parameters for the PacketCapturesClient.List method. +func (client *PacketCapturesClient) NewListPager(resourceGroupName string, networkWatcherName string, options *PacketCapturesClientListOptions) *runtime.Pager[PacketCapturesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PacketCapturesClientListResponse]{ + More: func(page PacketCapturesClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PacketCapturesClientListResponse) (PacketCapturesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return PacketCapturesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PacketCapturesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PacketCapturesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PacketCapturesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, options *PacketCapturesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PacketCapturesClient) listHandleResponse(resp *http.Response) (PacketCapturesClientListResponse, error) { + result := PacketCapturesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PacketCaptureListResult); err != nil { + return PacketCapturesClientListResponse{}, err + } + return result, nil +} + +// BeginStop - Stops a specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// packetCaptureName - The name of the packet capture session. +// options - PacketCapturesClientBeginStopOptions contains the optional parameters for the PacketCapturesClient.BeginStop +// method. +func (client *PacketCapturesClient) BeginStop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginStopOptions) (*runtime.Poller[PacketCapturesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PacketCapturesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PacketCapturesClientStopResponse](options.ResumeToken, client.pl, nil) + } +} + +// Stop - Stops a specified packet capture session. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PacketCapturesClient) stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, networkWatcherName, packetCaptureName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *PacketCapturesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, options *PacketCapturesClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if packetCaptureName == "" { + return nil, errors.New("parameter packetCaptureName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packetCaptureName}", url.PathEscape(packetCaptureName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/peerexpressroutecircuitconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/peerexpressroutecircuitconnections_client.go new file mode 100644 index 000000000..3aeecc280 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/peerexpressroutecircuitconnections_client.go @@ -0,0 +1,198 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PeerExpressRouteCircuitConnectionsClient contains the methods for the PeerExpressRouteCircuitConnections group. +// Don't use this type directly, use NewPeerExpressRouteCircuitConnectionsClient() instead. +type PeerExpressRouteCircuitConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPeerExpressRouteCircuitConnectionsClient creates a new instance of PeerExpressRouteCircuitConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPeerExpressRouteCircuitConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PeerExpressRouteCircuitConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PeerExpressRouteCircuitConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified Peer Express Route Circuit Connection from the specified express route circuit. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the express route circuit. +// peeringName - The name of the peering. +// connectionName - The name of the peer express route circuit connection. +// options - PeerExpressRouteCircuitConnectionsClientGetOptions contains the optional parameters for the PeerExpressRouteCircuitConnectionsClient.Get +// method. +func (client *PeerExpressRouteCircuitConnectionsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *PeerExpressRouteCircuitConnectionsClientGetOptions) (PeerExpressRouteCircuitConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, peeringName, connectionName, options) + if err != nil { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PeerExpressRouteCircuitConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, options *PeerExpressRouteCircuitConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PeerExpressRouteCircuitConnectionsClient) getHandleResponse(resp *http.Response) (PeerExpressRouteCircuitConnectionsClientGetResponse, error) { + result := PeerExpressRouteCircuitConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PeerExpressRouteCircuitConnection); err != nil { + return PeerExpressRouteCircuitConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all global reach peer connections associated with a private peering in an express route circuit. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// circuitName - The name of the circuit. +// peeringName - The name of the peering. +// options - PeerExpressRouteCircuitConnectionsClientListOptions contains the optional parameters for the PeerExpressRouteCircuitConnectionsClient.List +// method. +func (client *PeerExpressRouteCircuitConnectionsClient) NewListPager(resourceGroupName string, circuitName string, peeringName string, options *PeerExpressRouteCircuitConnectionsClientListOptions) *runtime.Pager[PeerExpressRouteCircuitConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PeerExpressRouteCircuitConnectionsClientListResponse]{ + More: func(page PeerExpressRouteCircuitConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PeerExpressRouteCircuitConnectionsClientListResponse) (PeerExpressRouteCircuitConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PeerExpressRouteCircuitConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PeerExpressRouteCircuitConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PeerExpressRouteCircuitConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PeerExpressRouteCircuitConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *PeerExpressRouteCircuitConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if circuitName == "" { + return nil, errors.New("parameter circuitName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PeerExpressRouteCircuitConnectionsClient) listHandleResponse(resp *http.Response) (PeerExpressRouteCircuitConnectionsClientListResponse, error) { + result := PeerExpressRouteCircuitConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PeerExpressRouteCircuitConnectionListResult); err != nil { + return PeerExpressRouteCircuitConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/polymorphic_helpers.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/polymorphic_helpers.go new file mode 100644 index 000000000..b109bf529 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/polymorphic_helpers.go @@ -0,0 +1,209 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import "encoding/json" + +func unmarshalActiveBaseSecurityAdminRuleClassification(rawMsg json.RawMessage) (ActiveBaseSecurityAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ActiveBaseSecurityAdminRuleClassification + switch m["kind"] { + case string(EffectiveAdminRuleKindCustom): + b = &ActiveSecurityAdminRule{} + case string(EffectiveAdminRuleKindDefault): + b = &ActiveDefaultSecurityAdminRule{} + default: + b = &ActiveBaseSecurityAdminRule{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalActiveBaseSecurityAdminRuleClassificationArray(rawMsg json.RawMessage) ([]ActiveBaseSecurityAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ActiveBaseSecurityAdminRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalActiveBaseSecurityAdminRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalBaseAdminRuleClassification(rawMsg json.RawMessage) (BaseAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b BaseAdminRuleClassification + switch m["kind"] { + case string(AdminRuleKindCustom): + b = &AdminRule{} + case string(AdminRuleKindDefault): + b = &DefaultAdminRule{} + default: + b = &BaseAdminRule{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalBaseAdminRuleClassificationArray(rawMsg json.RawMessage) ([]BaseAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]BaseAdminRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalBaseAdminRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalEffectiveBaseSecurityAdminRuleClassification(rawMsg json.RawMessage) (EffectiveBaseSecurityAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b EffectiveBaseSecurityAdminRuleClassification + switch m["kind"] { + case string(EffectiveAdminRuleKindCustom): + b = &EffectiveSecurityAdminRule{} + case string(EffectiveAdminRuleKindDefault): + b = &EffectiveDefaultSecurityAdminRule{} + default: + b = &EffectiveBaseSecurityAdminRule{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalEffectiveBaseSecurityAdminRuleClassificationArray(rawMsg json.RawMessage) ([]EffectiveBaseSecurityAdminRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]EffectiveBaseSecurityAdminRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalEffectiveBaseSecurityAdminRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalFirewallPolicyRuleClassification(rawMsg json.RawMessage) (FirewallPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FirewallPolicyRuleClassification + switch m["ruleType"] { + case string(FirewallPolicyRuleTypeApplicationRule): + b = &ApplicationRule{} + case string(FirewallPolicyRuleTypeNatRule): + b = &NatRule{} + case string(FirewallPolicyRuleTypeNetworkRule): + b = &Rule{} + default: + b = &FirewallPolicyRule{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFirewallPolicyRuleClassificationArray(rawMsg json.RawMessage) ([]FirewallPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FirewallPolicyRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFirewallPolicyRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalFirewallPolicyRuleCollectionClassification(rawMsg json.RawMessage) (FirewallPolicyRuleCollectionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FirewallPolicyRuleCollectionClassification + switch m["ruleCollectionType"] { + case string(FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection): + b = &FirewallPolicyFilterRuleCollection{} + case string(FirewallPolicyRuleCollectionTypeFirewallPolicyNatRuleCollection): + b = &FirewallPolicyNatRuleCollection{} + default: + b = &FirewallPolicyRuleCollection{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFirewallPolicyRuleCollectionClassificationArray(rawMsg json.RawMessage) ([]FirewallPolicyRuleCollectionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FirewallPolicyRuleCollectionClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFirewallPolicyRuleCollectionClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatednszonegroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatednszonegroups_client.go new file mode 100644 index 000000000..88d7fb26e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatednszonegroups_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateDNSZoneGroupsClient contains the methods for the PrivateDNSZoneGroups group. +// Don't use this type directly, use NewPrivateDNSZoneGroupsClient() instead. +type PrivateDNSZoneGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateDNSZoneGroupsClient creates a new instance of PrivateDNSZoneGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateDNSZoneGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateDNSZoneGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateDNSZoneGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a private dns zone group in the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// privateDNSZoneGroupName - The name of the private dns zone group. +// parameters - Parameters supplied to the create or update private dns zone group operation. +// options - PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.BeginCreateOrUpdate +// method. +func (client *PrivateDNSZoneGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup, options *PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateDNSZoneGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateDNSZoneGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateDNSZoneGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a private dns zone group in the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateDNSZoneGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup, options *PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateDNSZoneGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup, options *PrivateDNSZoneGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if privateDNSZoneGroupName == "" { + return nil, errors.New("parameter privateDNSZoneGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateDnsZoneGroupName}", url.PathEscape(privateDNSZoneGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified private dns zone group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// privateDNSZoneGroupName - The name of the private dns zone group. +// options - PrivateDNSZoneGroupsClientBeginDeleteOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.BeginDelete +// method. +func (client *PrivateDNSZoneGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*runtime.Poller[PrivateDNSZoneGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateDNSZoneGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateDNSZoneGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified private dns zone group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateDNSZoneGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if privateDNSZoneGroupName == "" { + return nil, errors.New("parameter privateDNSZoneGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateDnsZoneGroupName}", url.PathEscape(privateDNSZoneGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private dns zone group resource by specified private dns zone group name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// privateDNSZoneGroupName - The name of the private dns zone group. +// options - PrivateDNSZoneGroupsClientGetOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.Get +// method. +func (client *PrivateDNSZoneGroupsClient) Get(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientGetOptions) (PrivateDNSZoneGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, options) + if err != nil { + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateDNSZoneGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateDNSZoneGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if privateDNSZoneGroupName == "" { + return nil, errors.New("parameter privateDNSZoneGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateDnsZoneGroupName}", url.PathEscape(privateDNSZoneGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateDNSZoneGroupsClient) getHandleResponse(resp *http.Response) (PrivateDNSZoneGroupsClientGetResponse, error) { + result := PrivateDNSZoneGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateDNSZoneGroup); err != nil { + return PrivateDNSZoneGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all private dns zone groups in a private endpoint. +// Generated from API version 2022-05-01 +// privateEndpointName - The name of the private endpoint. +// resourceGroupName - The name of the resource group. +// options - PrivateDNSZoneGroupsClientListOptions contains the optional parameters for the PrivateDNSZoneGroupsClient.List +// method. +func (client *PrivateDNSZoneGroupsClient) NewListPager(privateEndpointName string, resourceGroupName string, options *PrivateDNSZoneGroupsClientListOptions) *runtime.Pager[PrivateDNSZoneGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateDNSZoneGroupsClientListResponse]{ + More: func(page PrivateDNSZoneGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateDNSZoneGroupsClientListResponse) (PrivateDNSZoneGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, privateEndpointName, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateDNSZoneGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateDNSZoneGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateDNSZoneGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateDNSZoneGroupsClient) listCreateRequest(ctx context.Context, privateEndpointName string, resourceGroupName string, options *PrivateDNSZoneGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups" + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateDNSZoneGroupsClient) listHandleResponse(resp *http.Response) (PrivateDNSZoneGroupsClientListResponse, error) { + result := PrivateDNSZoneGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateDNSZoneGroupListResult); err != nil { + return PrivateDNSZoneGroupsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privateendpoints_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privateendpoints_client.go new file mode 100644 index 000000000..d2db7ec37 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privateendpoints_client.go @@ -0,0 +1,369 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointsClient contains the methods for the PrivateEndpoints group. +// Don't use this type directly, use NewPrivateEndpointsClient() instead. +type PrivateEndpointsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateEndpointsClient creates a new instance of PrivateEndpointsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an private endpoint in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// parameters - Parameters supplied to the create or update private endpoint operation. +// options - PrivateEndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointsClient.BeginCreateOrUpdate +// method. +func (client *PrivateEndpointsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint, options *PrivateEndpointsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, privateEndpointName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an private endpoint in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateEndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint, options *PrivateEndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateEndpointName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint, options *PrivateEndpointsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// options - PrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointsClient.BeginDelete +// method. +func (client *PrivateEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateEndpointName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateEndpointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified private endpoint by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// privateEndpointName - The name of the private endpoint. +// options - PrivateEndpointsClientGetOptions contains the optional parameters for the PrivateEndpointsClient.Get method. +func (client *PrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientGetOptions) (PrivateEndpointsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, privateEndpointName, options) + if err != nil { + return PrivateEndpointsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, options *PrivateEndpointsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointsClient) getHandleResponse(resp *http.Response) (PrivateEndpointsClientGetResponse, error) { + result := PrivateEndpointsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { + return PrivateEndpointsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all private endpoints in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - PrivateEndpointsClientListOptions contains the optional parameters for the PrivateEndpointsClient.List method. +func (client *PrivateEndpointsClient) NewListPager(resourceGroupName string, options *PrivateEndpointsClientListOptions) *runtime.Pager[PrivateEndpointsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointsClientListResponse]{ + More: func(page PrivateEndpointsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointsClientListResponse) (PrivateEndpointsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateEndpointsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointsClient) listHandleResponse(resp *http.Response) (PrivateEndpointsClientListResponse, error) { + result := PrivateEndpointsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { + return PrivateEndpointsClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets all private endpoints in a subscription. +// Generated from API version 2022-05-01 +// options - PrivateEndpointsClientListBySubscriptionOptions contains the optional parameters for the PrivateEndpointsClient.ListBySubscription +// method. +func (client *PrivateEndpointsClient) NewListBySubscriptionPager(options *PrivateEndpointsClientListBySubscriptionOptions) *runtime.Pager[PrivateEndpointsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointsClientListBySubscriptionResponse]{ + More: func(page PrivateEndpointsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointsClientListBySubscriptionResponse) (PrivateEndpointsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateEndpointsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PrivateEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PrivateEndpointsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PrivateEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (PrivateEndpointsClientListBySubscriptionResponse, error) { + result := PrivateEndpointsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { + return PrivateEndpointsClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatelinkservices_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatelinkservices_client.go new file mode 100644 index 000000000..4847e8918 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/privatelinkservices_client.go @@ -0,0 +1,902 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkServicesClient contains the methods for the PrivateLinkServices group. +// Don't use this type directly, use NewPrivateLinkServicesClient() instead. +type PrivateLinkServicesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateLinkServicesClient creates a new instance of PrivateLinkServicesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateLinkServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServicesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateLinkServicesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCheckPrivateLinkServiceVisibility - Checks whether the subscription is visible to private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// parameters - The request body of CheckPrivateLinkService API call. +// options - PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions contains the optional parameters for the +// PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibility method. +func (client *PrivateLinkServicesClient) BeginCheckPrivateLinkServiceVisibility(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions) (*runtime.Poller[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.checkPrivateLinkServiceVisibility(ctx, location, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse](options.ResumeToken, client.pl, nil) + } +} + +// CheckPrivateLinkServiceVisibility - Checks whether the subscription is visible to private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibility(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions) (*http.Response, error) { + req, err := client.checkPrivateLinkServiceVisibilityCreateRequest(ctx, location, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// checkPrivateLinkServiceVisibilityCreateRequest creates the CheckPrivateLinkServiceVisibility request. +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityCreateRequest(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCheckPrivateLinkServiceVisibilityByResourceGroup - Checks whether the subscription is visible to private link service +// in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// resourceGroupName - The name of the resource group. +// parameters - The request body of CheckPrivateLinkService API call. +// options - PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions contains the optional parameters +// for the PrivateLinkServicesClient.BeginCheckPrivateLinkServiceVisibilityByResourceGroup method. +func (client *PrivateLinkServicesClient) BeginCheckPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions) (*runtime.Poller[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.checkPrivateLinkServiceVisibilityByResourceGroup(ctx, location, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse](options.ResumeToken, client.pl, nil) + } +} + +// CheckPrivateLinkServiceVisibilityByResourceGroup - Checks whether the subscription is visible to private link service in +// the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions) (*http.Response, error) { + req, err := client.checkPrivateLinkServiceVisibilityByResourceGroupCreateRequest(ctx, location, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// checkPrivateLinkServiceVisibilityByResourceGroupCreateRequest creates the CheckPrivateLinkServiceVisibilityByResourceGroup request. +func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityByResourceGroupCreateRequest(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest, options *PrivateLinkServicesClientBeginCheckPrivateLinkServiceVisibilityByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdate - Creates or updates an private link service in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// parameters - Parameters supplied to the create or update private link service operation. +// options - PrivateLinkServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkServicesClient.BeginCreateOrUpdate +// method. +func (client *PrivateLinkServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService, options *PrivateLinkServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateLinkServicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates an private link service in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateLinkServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService, options *PrivateLinkServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateLinkServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService, options *PrivateLinkServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// options - PrivateLinkServicesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkServicesClient.BeginDelete +// method. +func (client *PrivateLinkServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkServicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified private link service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateLinkServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinkServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeletePrivateEndpointConnection - Delete private end point connection for a private link service in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// peConnectionName - The name of the private end point connection. +// options - PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions contains the optional parameters for the +// PrivateLinkServicesClient.BeginDeletePrivateEndpointConnection method. +func (client *PrivateLinkServicesClient) BeginDeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions) (*runtime.Poller[PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deletePrivateEndpointConnection(ctx, resourceGroupName, serviceName, peConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeletePrivateEndpointConnection - Delete private end point connection for a private link service in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PrivateLinkServicesClient) deletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions) (*http.Response, error) { + req, err := client.deletePrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deletePrivateEndpointConnectionCreateRequest creates the DeletePrivateEndpointConnection request. +func (client *PrivateLinkServicesClient) deletePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientBeginDeletePrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified private link service by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// options - PrivateLinkServicesClientGetOptions contains the optional parameters for the PrivateLinkServicesClient.Get method. +func (client *PrivateLinkServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientGetOptions) (PrivateLinkServicesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return PrivateLinkServicesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkServicesClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesClientGetResponse, error) { + result := PrivateLinkServicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkService); err != nil { + return PrivateLinkServicesClientGetResponse{}, err + } + return result, nil +} + +// GetPrivateEndpointConnection - Get the specific private end point connection by specific private link service in the resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// peConnectionName - The name of the private end point connection. +// options - PrivateLinkServicesClientGetPrivateEndpointConnectionOptions contains the optional parameters for the PrivateLinkServicesClient.GetPrivateEndpointConnection +// method. +func (client *PrivateLinkServicesClient) GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientGetPrivateEndpointConnectionOptions) (PrivateLinkServicesClientGetPrivateEndpointConnectionResponse, error) { + req, err := client.getPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, options) + if err != nil { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, runtime.NewResponseError(resp) + } + return client.getPrivateEndpointConnectionHandleResponse(resp) +} + +// getPrivateEndpointConnectionCreateRequest creates the GetPrivateEndpointConnection request. +func (client *PrivateLinkServicesClient) getPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, options *PrivateLinkServicesClientGetPrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPrivateEndpointConnectionHandleResponse handles the GetPrivateEndpointConnection response. +func (client *PrivateLinkServicesClient) getPrivateEndpointConnectionHandleResponse(resp *http.Response) (PrivateLinkServicesClientGetPrivateEndpointConnectionResponse, error) { + result := PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateLinkServicesClientGetPrivateEndpointConnectionResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all private link services in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - PrivateLinkServicesClientListOptions contains the optional parameters for the PrivateLinkServicesClient.List +// method. +func (client *PrivateLinkServicesClient) NewListPager(resourceGroupName string, options *PrivateLinkServicesClientListOptions) *runtime.Pager[PrivateLinkServicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkServicesClientListResponse]{ + More: func(page PrivateLinkServicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkServicesClientListResponse) (PrivateLinkServicesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkServicesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkServicesClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesClientListResponse, error) { + result := PrivateLinkServicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServiceListResult); err != nil { + return PrivateLinkServicesClientListResponse{}, err + } + return result, nil +} + +// NewListAutoApprovedPrivateLinkServicesPager - Returns all of the private link service ids that can be linked to a Private +// Endpoint with auto approved in this subscription in this region. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// options - PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions contains the optional parameters for the +// PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices method. +func (client *PrivateLinkServicesClient) NewListAutoApprovedPrivateLinkServicesPager(location string, options *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions) *runtime.Pager[PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse]{ + More: func(page PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse) (PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAutoApprovedPrivateLinkServicesCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse{}, runtime.NewResponseError(resp) + } + return client.listAutoApprovedPrivateLinkServicesHandleResponse(resp) + }, + }) +} + +// listAutoApprovedPrivateLinkServicesCreateRequest creates the ListAutoApprovedPrivateLinkServices request. +func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesCreateRequest(ctx context.Context, location string, options *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAutoApprovedPrivateLinkServicesHandleResponse handles the ListAutoApprovedPrivateLinkServices response. +func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesHandleResponse(resp *http.Response) (PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse, error) { + result := PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutoApprovedPrivateLinkServicesResult); err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse{}, err + } + return result, nil +} + +// NewListAutoApprovedPrivateLinkServicesByResourceGroupPager - Returns all of the private link service ids that can be linked +// to a Private Endpoint with auto approved in this subscription in this region. +// Generated from API version 2022-05-01 +// location - The location of the domain name. +// resourceGroupName - The name of the resource group. +// options - PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions contains the optional parameters +// for the PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup method. +func (client *PrivateLinkServicesClient) NewListAutoApprovedPrivateLinkServicesByResourceGroupPager(location string, resourceGroupName string, options *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions) *runtime.Pager[PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse]{ + More: func(page PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse) (PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAutoApprovedPrivateLinkServicesByResourceGroupCreateRequest(ctx, location, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listAutoApprovedPrivateLinkServicesByResourceGroupHandleResponse(resp) + }, + }) +} + +// listAutoApprovedPrivateLinkServicesByResourceGroupCreateRequest creates the ListAutoApprovedPrivateLinkServicesByResourceGroup request. +func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByResourceGroupCreateRequest(ctx context.Context, location string, resourceGroupName string, options *PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAutoApprovedPrivateLinkServicesByResourceGroupHandleResponse handles the ListAutoApprovedPrivateLinkServicesByResourceGroup response. +func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse, error) { + result := PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AutoApprovedPrivateLinkServicesResult); err != nil { + return PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets all private link service in a subscription. +// Generated from API version 2022-05-01 +// options - PrivateLinkServicesClientListBySubscriptionOptions contains the optional parameters for the PrivateLinkServicesClient.ListBySubscription +// method. +func (client *PrivateLinkServicesClient) NewListBySubscriptionPager(options *PrivateLinkServicesClientListBySubscriptionOptions) *runtime.Pager[PrivateLinkServicesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkServicesClientListBySubscriptionResponse]{ + More: func(page PrivateLinkServicesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkServicesClientListBySubscriptionResponse) (PrivateLinkServicesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkServicesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PrivateLinkServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *PrivateLinkServicesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PrivateLinkServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (PrivateLinkServicesClientListBySubscriptionResponse, error) { + result := PrivateLinkServicesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServiceListResult); err != nil { + return PrivateLinkServicesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// NewListPrivateEndpointConnectionsPager - Gets all private end point connections for a specific private link service. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// options - PrivateLinkServicesClientListPrivateEndpointConnectionsOptions contains the optional parameters for the PrivateLinkServicesClient.ListPrivateEndpointConnections +// method. +func (client *PrivateLinkServicesClient) NewListPrivateEndpointConnectionsPager(resourceGroupName string, serviceName string, options *PrivateLinkServicesClientListPrivateEndpointConnectionsOptions) *runtime.Pager[PrivateLinkServicesClientListPrivateEndpointConnectionsResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkServicesClientListPrivateEndpointConnectionsResponse]{ + More: func(page PrivateLinkServicesClientListPrivateEndpointConnectionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkServicesClientListPrivateEndpointConnectionsResponse) (PrivateLinkServicesClientListPrivateEndpointConnectionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listPrivateEndpointConnectionsCreateRequest(ctx, resourceGroupName, serviceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrivateLinkServicesClientListPrivateEndpointConnectionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientListPrivateEndpointConnectionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientListPrivateEndpointConnectionsResponse{}, runtime.NewResponseError(resp) + } + return client.listPrivateEndpointConnectionsHandleResponse(resp) + }, + }) +} + +// listPrivateEndpointConnectionsCreateRequest creates the ListPrivateEndpointConnections request. +func (client *PrivateLinkServicesClient) listPrivateEndpointConnectionsCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *PrivateLinkServicesClientListPrivateEndpointConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPrivateEndpointConnectionsHandleResponse handles the ListPrivateEndpointConnections response. +func (client *PrivateLinkServicesClient) listPrivateEndpointConnectionsHandleResponse(resp *http.Response) (PrivateLinkServicesClientListPrivateEndpointConnectionsResponse, error) { + result := PrivateLinkServicesClientListPrivateEndpointConnectionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateLinkServicesClientListPrivateEndpointConnectionsResponse{}, err + } + return result, nil +} + +// UpdatePrivateEndpointConnection - Approve or reject private end point connection for a private link service in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceName - The name of the private link service. +// peConnectionName - The name of the private end point connection. +// parameters - Parameters supplied to approve or reject the private end point connection. +// options - PrivateLinkServicesClientUpdatePrivateEndpointConnectionOptions contains the optional parameters for the PrivateLinkServicesClient.UpdatePrivateEndpointConnection +// method. +func (client *PrivateLinkServicesClient) UpdatePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection, options *PrivateLinkServicesClientUpdatePrivateEndpointConnectionOptions) (PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse, error) { + req, err := client.updatePrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, serviceName, peConnectionName, parameters, options) + if err != nil { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, runtime.NewResponseError(resp) + } + return client.updatePrivateEndpointConnectionHandleResponse(resp) +} + +// updatePrivateEndpointConnectionCreateRequest creates the UpdatePrivateEndpointConnection request. +func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection, options *PrivateLinkServicesClientUpdatePrivateEndpointConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if peConnectionName == "" { + return nil, errors.New("parameter peConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peConnectionName}", url.PathEscape(peConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updatePrivateEndpointConnectionHandleResponse handles the UpdatePrivateEndpointConnection response. +func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionHandleResponse(resp *http.Response) (PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse, error) { + result := PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/profiles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/profiles_client.go new file mode 100644 index 000000000..f1e57178e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/profiles_client.go @@ -0,0 +1,415 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProfilesClient contains the methods for the NetworkProfiles group. +// Don't use this type directly, use NewProfilesClient() instead. +type ProfilesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProfilesClient creates a new instance of ProfilesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProfilesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProfilesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a network profile. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkProfileName - The name of the network profile. +// parameters - Parameters supplied to the create or update network profile operation. +// options - ProfilesClientCreateOrUpdateOptions contains the optional parameters for the ProfilesClient.CreateOrUpdate method. +func (client *ProfilesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkProfileName string, parameters Profile, options *ProfilesClientCreateOrUpdateOptions) (ProfilesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkProfileName, parameters, options) + if err != nil { + return ProfilesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProfilesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProfilesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProfilesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkProfileName string, parameters Profile, options *ProfilesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkProfileName == "" { + return nil, errors.New("parameter networkProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkProfileName}", url.PathEscape(networkProfileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (ProfilesClientCreateOrUpdateResponse, error) { + result := ProfilesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Profile); err != nil { + return ProfilesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified network profile. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkProfileName - The name of the NetworkProfile. +// options - ProfilesClientBeginDeleteOptions contains the optional parameters for the ProfilesClient.BeginDelete method. +func (client *ProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientBeginDeleteOptions) (*runtime.Poller[ProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkProfileName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ProfilesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ProfilesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified network profile. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkProfileName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkProfileName == "" { + return nil, errors.New("parameter networkProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkProfileName}", url.PathEscape(networkProfileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified network profile in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkProfileName - The name of the public IP prefix. +// options - ProfilesClientGetOptions contains the optional parameters for the ProfilesClient.Get method. +func (client *ProfilesClient) Get(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientGetOptions) (ProfilesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkProfileName, options) + if err != nil { + return ProfilesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProfilesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkProfileName string, options *ProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkProfileName == "" { + return nil, errors.New("parameter networkProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkProfileName}", url.PathEscape(networkProfileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProfilesClient) getHandleResponse(resp *http.Response) (ProfilesClientGetResponse, error) { + result := ProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Profile); err != nil { + return ProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all network profiles in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ProfilesClientListOptions contains the optional parameters for the ProfilesClient.List method. +func (client *ProfilesClient) NewListPager(resourceGroupName string, options *ProfilesClientListOptions) *runtime.Pager[ProfilesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProfilesClientListResponse]{ + More: func(page ProfilesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProfilesClientListResponse) (ProfilesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProfilesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProfilesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProfilesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ProfilesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ProfilesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProfilesClient) listHandleResponse(resp *http.Response) (ProfilesClientListResponse, error) { + result := ProfilesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProfileListResult); err != nil { + return ProfilesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the network profiles in a subscription. +// Generated from API version 2022-05-01 +// options - ProfilesClientListAllOptions contains the optional parameters for the ProfilesClient.ListAll method. +func (client *ProfilesClient) NewListAllPager(options *ProfilesClientListAllOptions) *runtime.Pager[ProfilesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[ProfilesClientListAllResponse]{ + More: func(page ProfilesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProfilesClientListAllResponse) (ProfilesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProfilesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProfilesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProfilesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *ProfilesClient) listAllCreateRequest(ctx context.Context, options *ProfilesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *ProfilesClient) listAllHandleResponse(resp *http.Response) (ProfilesClientListAllResponse, error) { + result := ProfilesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProfileListResult); err != nil { + return ProfilesClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates network profile tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkProfileName - The name of the network profile. +// parameters - Parameters supplied to update network profile tags. +// options - ProfilesClientUpdateTagsOptions contains the optional parameters for the ProfilesClient.UpdateTags method. +func (client *ProfilesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkProfileName string, parameters TagsObject, options *ProfilesClientUpdateTagsOptions) (ProfilesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkProfileName, parameters, options) + if err != nil { + return ProfilesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProfilesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProfilesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ProfilesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkProfileName string, parameters TagsObject, options *ProfilesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkProfileName == "" { + return nil, errors.New("parameter networkProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkProfileName}", url.PathEscape(networkProfileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ProfilesClient) updateTagsHandleResponse(resp *http.Response) (ProfilesClientUpdateTagsResponse, error) { + result := ProfilesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Profile); err != nil { + return ProfilesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipaddresses_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipaddresses_client.go new file mode 100644 index 000000000..d2a847f4b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipaddresses_client.go @@ -0,0 +1,961 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PublicIPAddressesClient contains the methods for the PublicIPAddresses group. +// Don't use this type directly, use NewPublicIPAddressesClient() instead. +type PublicIPAddressesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPublicIPAddressesClient creates a new instance of PublicIPAddressesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPublicIPAddressesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublicIPAddressesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PublicIPAddressesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a static or dynamic public IP address. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPAddressName - The name of the public IP address. +// parameters - Parameters supplied to the create or update public IP address operation. +// options - PublicIPAddressesClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicIPAddressesClient.BeginCreateOrUpdate +// method. +func (client *PublicIPAddressesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, options *PublicIPAddressesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicIPAddressesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, publicIPAddressName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PublicIPAddressesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a static or dynamic public IP address. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PublicIPAddressesClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, options *PublicIPAddressesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicIPAddressName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PublicIPAddressesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, options *PublicIPAddressesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDdosProtectionStatus - Gets the Ddos Protection Status of a Public IP Address +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPAddressName - The name of the public IP address. +// options - PublicIPAddressesClientBeginDdosProtectionStatusOptions contains the optional parameters for the PublicIPAddressesClient.BeginDdosProtectionStatus +// method. +func (client *PublicIPAddressesClient) BeginDdosProtectionStatus(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDdosProtectionStatusOptions) (*runtime.Poller[PublicIPAddressesClientDdosProtectionStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.ddosProtectionStatus(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PublicIPAddressesClientDdosProtectionStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientDdosProtectionStatusResponse](options.ResumeToken, client.pl, nil) + } +} + +// DdosProtectionStatus - Gets the Ddos Protection Status of a Public IP Address +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PublicIPAddressesClient) ddosProtectionStatus(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDdosProtectionStatusOptions) (*http.Response, error) { + req, err := client.ddosProtectionStatusCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// ddosProtectionStatusCreateRequest creates the DdosProtectionStatus request. +func (client *PublicIPAddressesClient) ddosProtectionStatusCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDdosProtectionStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/ddosProtectionStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Deletes the specified public IP address. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPAddressName - The name of the public IP address. +// options - PublicIPAddressesClientBeginDeleteOptions contains the optional parameters for the PublicIPAddressesClient.BeginDelete +// method. +func (client *PublicIPAddressesClient) BeginDelete(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDeleteOptions) (*runtime.Poller[PublicIPAddressesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PublicIPAddressesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PublicIPAddressesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified public IP address. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PublicIPAddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PublicIPAddressesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified public IP address in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPAddressName - The name of the public IP address. +// options - PublicIPAddressesClientGetOptions contains the optional parameters for the PublicIPAddressesClient.Get method. +func (client *PublicIPAddressesClient) Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientGetOptions) (PublicIPAddressesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PublicIPAddressesClient) getCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, options *PublicIPAddressesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublicIPAddressesClient) getHandleResponse(resp *http.Response) (PublicIPAddressesClientGetResponse, error) { + result := PublicIPAddressesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { + return PublicIPAddressesClientGetResponse{}, err + } + return result, nil +} + +// GetCloudServicePublicIPAddress - Get the specified public IP address in a cloud service. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// roleInstanceName - The role instance name. +// networkInterfaceName - The name of the network interface. +// ipConfigurationName - The name of the IP configuration. +// publicIPAddressName - The name of the public IP Address. +// options - PublicIPAddressesClientGetCloudServicePublicIPAddressOptions contains the optional parameters for the PublicIPAddressesClient.GetCloudServicePublicIPAddress +// method. +func (client *PublicIPAddressesClient) GetCloudServicePublicIPAddress(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *PublicIPAddressesClientGetCloudServicePublicIPAddressOptions) (PublicIPAddressesClientGetCloudServicePublicIPAddressResponse, error) { + req, err := client.getCloudServicePublicIPAddressCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, runtime.NewResponseError(resp) + } + return client.getCloudServicePublicIPAddressHandleResponse(resp) +} + +// getCloudServicePublicIPAddressCreateRequest creates the GetCloudServicePublicIPAddress request. +func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *PublicIPAddressesClientGetCloudServicePublicIPAddressOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCloudServicePublicIPAddressHandleResponse handles the GetCloudServicePublicIPAddress response. +func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressHandleResponse(resp *http.Response) (PublicIPAddressesClientGetCloudServicePublicIPAddressResponse, error) { + result := PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { + return PublicIPAddressesClientGetCloudServicePublicIPAddressResponse{}, err + } + return result, nil +} + +// GetVirtualMachineScaleSetPublicIPAddress - Get the specified public IP address in a virtual machine scale set. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// networkInterfaceName - The name of the network interface. +// ipConfigurationName - The name of the IP configuration. +// publicIPAddressName - The name of the public IP Address. +// options - PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions contains the optional parameters for the +// PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress method. +func (client *PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions) (PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse, error) { + req, err := client.getVirtualMachineScaleSetPublicIPAddressCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIPAddressName, options) + if err != nil { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, runtime.NewResponseError(resp) + } + return client.getVirtualMachineScaleSetPublicIPAddressHandleResponse(resp) +} + +// getVirtualMachineScaleSetPublicIPAddressCreateRequest creates the GetVirtualMachineScaleSetPublicIPAddress request. +func (client *PublicIPAddressesClient) getVirtualMachineScaleSetPublicIPAddressCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string, options *PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVirtualMachineScaleSetPublicIPAddressHandleResponse handles the GetVirtualMachineScaleSetPublicIPAddress response. +func (client *PublicIPAddressesClient) getVirtualMachineScaleSetPublicIPAddressHandleResponse(resp *http.Response) (PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse, error) { + result := PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { + return PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all public IP addresses in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - PublicIPAddressesClientListOptions contains the optional parameters for the PublicIPAddressesClient.List method. +func (client *PublicIPAddressesClient) NewListPager(resourceGroupName string, options *PublicIPAddressesClientListOptions) *runtime.Pager[PublicIPAddressesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListResponse]{ + More: func(page PublicIPAddressesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListResponse) (PublicIPAddressesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PublicIPAddressesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PublicIPAddressesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PublicIPAddressesClient) listHandleResponse(resp *http.Response) (PublicIPAddressesClientListResponse, error) { + result := PublicIPAddressesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the public IP addresses in a subscription. +// Generated from API version 2022-05-01 +// options - PublicIPAddressesClientListAllOptions contains the optional parameters for the PublicIPAddressesClient.ListAll +// method. +func (client *PublicIPAddressesClient) NewListAllPager(options *PublicIPAddressesClientListAllOptions) *runtime.Pager[PublicIPAddressesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListAllResponse]{ + More: func(page PublicIPAddressesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListAllResponse) (PublicIPAddressesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *PublicIPAddressesClient) listAllCreateRequest(ctx context.Context, options *PublicIPAddressesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *PublicIPAddressesClient) listAllHandleResponse(resp *http.Response) (PublicIPAddressesClientListAllResponse, error) { + result := PublicIPAddressesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListAllResponse{}, err + } + return result, nil +} + +// NewListCloudServicePublicIPAddressesPager - Gets information about all public IP addresses on a cloud service level. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// options - PublicIPAddressesClientListCloudServicePublicIPAddressesOptions contains the optional parameters for the PublicIPAddressesClient.ListCloudServicePublicIPAddresses +// method. +func (client *PublicIPAddressesClient) NewListCloudServicePublicIPAddressesPager(resourceGroupName string, cloudServiceName string, options *PublicIPAddressesClientListCloudServicePublicIPAddressesOptions) *runtime.Pager[PublicIPAddressesClientListCloudServicePublicIPAddressesResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListCloudServicePublicIPAddressesResponse]{ + More: func(page PublicIPAddressesClientListCloudServicePublicIPAddressesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListCloudServicePublicIPAddressesResponse) (PublicIPAddressesClientListCloudServicePublicIPAddressesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCloudServicePublicIPAddressesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListCloudServicePublicIPAddressesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListCloudServicePublicIPAddressesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListCloudServicePublicIPAddressesResponse{}, runtime.NewResponseError(resp) + } + return client.listCloudServicePublicIPAddressesHandleResponse(resp) + }, + }) +} + +// listCloudServicePublicIPAddressesCreateRequest creates the ListCloudServicePublicIPAddresses request. +func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *PublicIPAddressesClientListCloudServicePublicIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCloudServicePublicIPAddressesHandleResponse handles the ListCloudServicePublicIPAddresses response. +func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesClientListCloudServicePublicIPAddressesResponse, error) { + result := PublicIPAddressesClientListCloudServicePublicIPAddressesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListCloudServicePublicIPAddressesResponse{}, err + } + return result, nil +} + +// NewListCloudServiceRoleInstancePublicIPAddressesPager - Gets information about all public IP addresses in a role instance +// IP configuration in a cloud service. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// cloudServiceName - The name of the cloud service. +// roleInstanceName - The name of role instance. +// networkInterfaceName - The network interface name. +// ipConfigurationName - The IP configuration name. +// options - PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions contains the optional parameters +// for the PublicIPAddressesClient.ListCloudServiceRoleInstancePublicIPAddresses method. +func (client *PublicIPAddressesClient) NewListCloudServiceRoleInstancePublicIPAddressesPager(resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, options *PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions) *runtime.Pager[PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse]{ + More: func(page PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse) (PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCloudServiceRoleInstancePublicIPAddressesCreateRequest(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse{}, runtime.NewResponseError(resp) + } + return client.listCloudServiceRoleInstancePublicIPAddressesHandleResponse(resp) + }, + }) +} + +// listCloudServiceRoleInstancePublicIPAddressesCreateRequest creates the ListCloudServiceRoleInstancePublicIPAddresses request. +func (client *PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, options *PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if cloudServiceName == "" { + return nil, errors.New("parameter cloudServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cloudServiceName}", url.PathEscape(cloudServiceName)) + if roleInstanceName == "" { + return nil, errors.New("parameter roleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleInstanceName}", url.PathEscape(roleInstanceName)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCloudServiceRoleInstancePublicIPAddressesHandleResponse handles the ListCloudServiceRoleInstancePublicIPAddresses response. +func (client *PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse, error) { + result := PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse{}, err + } + return result, nil +} + +// NewListVirtualMachineScaleSetPublicIPAddressesPager - Gets information about all public IP addresses on a virtual machine +// scale set level. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// options - PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions contains the optional parameters for +// the PublicIPAddressesClient.ListVirtualMachineScaleSetPublicIPAddresses method. +func (client *PublicIPAddressesClient) NewListVirtualMachineScaleSetPublicIPAddressesPager(resourceGroupName string, virtualMachineScaleSetName string, options *PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions) *runtime.Pager[PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse]{ + More: func(page PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse) (PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVirtualMachineScaleSetPublicIPAddressesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse{}, runtime.NewResponseError(resp) + } + return client.listVirtualMachineScaleSetPublicIPAddressesHandleResponse(resp) + }, + }) +} + +// listVirtualMachineScaleSetPublicIPAddressesCreateRequest creates the ListVirtualMachineScaleSetPublicIPAddresses request. +func (client *PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVirtualMachineScaleSetPublicIPAddressesHandleResponse handles the ListVirtualMachineScaleSetPublicIPAddresses response. +func (client *PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse, error) { + result := PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse{}, err + } + return result, nil +} + +// NewListVirtualMachineScaleSetVMPublicIPAddressesPager - Gets information about all public IP addresses in a virtual machine +// IP configuration in a virtual machine scale set. +// Generated from API version 2018-10-01 +// resourceGroupName - The name of the resource group. +// virtualMachineScaleSetName - The name of the virtual machine scale set. +// virtualmachineIndex - The virtual machine index. +// networkInterfaceName - The network interface name. +// ipConfigurationName - The IP configuration name. +// options - PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions contains the optional parameters +// for the PublicIPAddressesClient.ListVirtualMachineScaleSetVMPublicIPAddresses method. +func (client *PublicIPAddressesClient) NewListVirtualMachineScaleSetVMPublicIPAddressesPager(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions) *runtime.Pager[PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse]{ + More: func(page PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse) (PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listVirtualMachineScaleSetVMPublicIPAddressesCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, runtime.NewResponseError(resp) + } + return client.listVirtualMachineScaleSetVMPublicIPAddressesHandleResponse(resp) + }, + }) +} + +// listVirtualMachineScaleSetVMPublicIPAddressesCreateRequest creates the ListVirtualMachineScaleSetVMPublicIPAddresses request. +func (client *PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, ipConfigurationName string, options *PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualMachineScaleSetName == "" { + return nil, errors.New("parameter virtualMachineScaleSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualMachineScaleSetName}", url.PathEscape(virtualMachineScaleSetName)) + if virtualmachineIndex == "" { + return nil, errors.New("parameter virtualmachineIndex cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualmachineIndex}", url.PathEscape(virtualmachineIndex)) + if networkInterfaceName == "" { + return nil, errors.New("parameter networkInterfaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkInterfaceName}", url.PathEscape(networkInterfaceName)) + if ipConfigurationName == "" { + return nil, errors.New("parameter ipConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigurationName}", url.PathEscape(ipConfigurationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2018-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listVirtualMachineScaleSetVMPublicIPAddressesHandleResponse handles the ListVirtualMachineScaleSetVMPublicIPAddresses response. +func (client *PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse, error) { + result := PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { + return PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates public IP address tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPAddressName - The name of the public IP address. +// parameters - Parameters supplied to update public IP address tags. +// options - PublicIPAddressesClientUpdateTagsOptions contains the optional parameters for the PublicIPAddressesClient.UpdateTags +// method. +func (client *PublicIPAddressesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject, options *PublicIPAddressesClientUpdateTagsOptions) (PublicIPAddressesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, publicIPAddressName, parameters, options) + if err != nil { + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPAddressesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *PublicIPAddressesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject, options *PublicIPAddressesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPAddressName == "" { + return nil, errors.New("parameter publicIPAddressName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpAddressName}", url.PathEscape(publicIPAddressName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *PublicIPAddressesClient) updateTagsHandleResponse(resp *http.Response) (PublicIPAddressesClientUpdateTagsResponse, error) { + result := PublicIPAddressesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { + return PublicIPAddressesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipprefixes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipprefixes_client.go new file mode 100644 index 000000000..b6ad8faff --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/publicipprefixes_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PublicIPPrefixesClient contains the methods for the PublicIPPrefixes group. +// Don't use this type directly, use NewPublicIPPrefixesClient() instead. +type PublicIPPrefixesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPublicIPPrefixesClient creates a new instance of PublicIPPrefixesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPublicIPPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublicIPPrefixesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PublicIPPrefixesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a static or dynamic public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPPrefixName - The name of the public IP prefix. +// parameters - Parameters supplied to the create or update public IP prefix operation. +// options - PublicIPPrefixesClientBeginCreateOrUpdateOptions contains the optional parameters for the PublicIPPrefixesClient.BeginCreateOrUpdate +// method. +func (client *PublicIPPrefixesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix, options *PublicIPPrefixesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicIPPrefixesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, publicIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PublicIPPrefixesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PublicIPPrefixesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a static or dynamic public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PublicIPPrefixesClient) createOrUpdate(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix, options *PublicIPPrefixesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, publicIPPrefixName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PublicIPPrefixesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix, options *PublicIPPrefixesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPPrefixName == "" { + return nil, errors.New("parameter publicIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpPrefixName}", url.PathEscape(publicIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPPrefixName - The name of the PublicIpPrefix. +// options - PublicIPPrefixesClientBeginDeleteOptions contains the optional parameters for the PublicIPPrefixesClient.BeginDelete +// method. +func (client *PublicIPPrefixesClient) BeginDelete(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientBeginDeleteOptions) (*runtime.Poller[PublicIPPrefixesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, publicIPPrefixName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PublicIPPrefixesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PublicIPPrefixesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified public IP prefix. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *PublicIPPrefixesClient) deleteOperation(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, publicIPPrefixName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PublicIPPrefixesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPPrefixName == "" { + return nil, errors.New("parameter publicIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpPrefixName}", url.PathEscape(publicIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified public IP prefix in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPPrefixName - The name of the public IP prefix. +// options - PublicIPPrefixesClientGetOptions contains the optional parameters for the PublicIPPrefixesClient.Get method. +func (client *PublicIPPrefixesClient) Get(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientGetOptions) (PublicIPPrefixesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, publicIPPrefixName, options) + if err != nil { + return PublicIPPrefixesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPPrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPPrefixesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PublicIPPrefixesClient) getCreateRequest(ctx context.Context, resourceGroupName string, publicIPPrefixName string, options *PublicIPPrefixesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPPrefixName == "" { + return nil, errors.New("parameter publicIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpPrefixName}", url.PathEscape(publicIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublicIPPrefixesClient) getHandleResponse(resp *http.Response) (PublicIPPrefixesClientGetResponse, error) { + result := PublicIPPrefixesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefix); err != nil { + return PublicIPPrefixesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all public IP prefixes in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - PublicIPPrefixesClientListOptions contains the optional parameters for the PublicIPPrefixesClient.List method. +func (client *PublicIPPrefixesClient) NewListPager(resourceGroupName string, options *PublicIPPrefixesClientListOptions) *runtime.Pager[PublicIPPrefixesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPPrefixesClientListResponse]{ + More: func(page PublicIPPrefixesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPPrefixesClientListResponse) (PublicIPPrefixesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPPrefixesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPPrefixesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPPrefixesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PublicIPPrefixesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PublicIPPrefixesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PublicIPPrefixesClient) listHandleResponse(resp *http.Response) (PublicIPPrefixesClientListResponse, error) { + result := PublicIPPrefixesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefixListResult); err != nil { + return PublicIPPrefixesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the public IP prefixes in a subscription. +// Generated from API version 2022-05-01 +// options - PublicIPPrefixesClientListAllOptions contains the optional parameters for the PublicIPPrefixesClient.ListAll +// method. +func (client *PublicIPPrefixesClient) NewListAllPager(options *PublicIPPrefixesClientListAllOptions) *runtime.Pager[PublicIPPrefixesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[PublicIPPrefixesClientListAllResponse]{ + More: func(page PublicIPPrefixesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublicIPPrefixesClientListAllResponse) (PublicIPPrefixesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PublicIPPrefixesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPPrefixesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPPrefixesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *PublicIPPrefixesClient) listAllCreateRequest(ctx context.Context, options *PublicIPPrefixesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *PublicIPPrefixesClient) listAllHandleResponse(resp *http.Response) (PublicIPPrefixesClientListAllResponse, error) { + result := PublicIPPrefixesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefixListResult); err != nil { + return PublicIPPrefixesClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates public IP prefix tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// publicIPPrefixName - The name of the public IP prefix. +// parameters - Parameters supplied to update public IP prefix tags. +// options - PublicIPPrefixesClientUpdateTagsOptions contains the optional parameters for the PublicIPPrefixesClient.UpdateTags +// method. +func (client *PublicIPPrefixesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters TagsObject, options *PublicIPPrefixesClientUpdateTagsOptions) (PublicIPPrefixesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, publicIPPrefixName, parameters, options) + if err != nil { + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PublicIPPrefixesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *PublicIPPrefixesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters TagsObject, options *PublicIPPrefixesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if publicIPPrefixName == "" { + return nil, errors.New("parameter publicIPPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicIpPrefixName}", url.PathEscape(publicIPPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *PublicIPPrefixesClient) updateTagsHandleResponse(resp *http.Response) (PublicIPPrefixesClientUpdateTagsResponse, error) { + result := PublicIPPrefixesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefix); err != nil { + return PublicIPPrefixesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/resourcenavigationlinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/resourcenavigationlinks_client.go new file mode 100644 index 000000000..292862b97 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/resourcenavigationlinks_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceNavigationLinksClient contains the methods for the ResourceNavigationLinks group. +// Don't use this type directly, use NewResourceNavigationLinksClient() instead. +type ResourceNavigationLinksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewResourceNavigationLinksClient creates a new instance of ResourceNavigationLinksClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewResourceNavigationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceNavigationLinksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ResourceNavigationLinksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Gets a list of resource navigation links for a subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// options - ResourceNavigationLinksClientListOptions contains the optional parameters for the ResourceNavigationLinksClient.List +// method. +func (client *ResourceNavigationLinksClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *ResourceNavigationLinksClientListOptions) (ResourceNavigationLinksClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return ResourceNavigationLinksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceNavigationLinksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceNavigationLinksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ResourceNavigationLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *ResourceNavigationLinksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ResourceNavigationLinksClient) listHandleResponse(resp *http.Response) (ResourceNavigationLinksClientListResponse, error) { + result := ResourceNavigationLinksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceNavigationLinksListResult); err != nil { + return ResourceNavigationLinksClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/response_types.go new file mode 100644 index 000000000..8c6cf694c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/response_types.go @@ -0,0 +1,3167 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import "encoding/json" + +// AdminRuleCollectionsClientCreateOrUpdateResponse contains the response from method AdminRuleCollectionsClient.CreateOrUpdate. +type AdminRuleCollectionsClientCreateOrUpdateResponse struct { + AdminRuleCollection +} + +// AdminRuleCollectionsClientDeleteResponse contains the response from method AdminRuleCollectionsClient.Delete. +type AdminRuleCollectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// AdminRuleCollectionsClientGetResponse contains the response from method AdminRuleCollectionsClient.Get. +type AdminRuleCollectionsClientGetResponse struct { + AdminRuleCollection +} + +// AdminRuleCollectionsClientListResponse contains the response from method AdminRuleCollectionsClient.List. +type AdminRuleCollectionsClientListResponse struct { + AdminRuleCollectionListResult +} + +// AdminRulesClientCreateOrUpdateResponse contains the response from method AdminRulesClient.CreateOrUpdate. +type AdminRulesClientCreateOrUpdateResponse struct { + BaseAdminRuleClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRulesClientCreateOrUpdateResponse. +func (a *AdminRulesClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalBaseAdminRuleClassification(data) + if err != nil { + return err + } + a.BaseAdminRuleClassification = res + return nil +} + +// AdminRulesClientDeleteResponse contains the response from method AdminRulesClient.Delete. +type AdminRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// AdminRulesClientGetResponse contains the response from method AdminRulesClient.Get. +type AdminRulesClientGetResponse struct { + BaseAdminRuleClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminRulesClientGetResponse. +func (a *AdminRulesClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalBaseAdminRuleClassification(data) + if err != nil { + return err + } + a.BaseAdminRuleClassification = res + return nil +} + +// AdminRulesClientListResponse contains the response from method AdminRulesClient.List. +type AdminRulesClientListResponse struct { + AdminRuleListResult +} + +// ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.Delete. +type ApplicationGatewayPrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationGatewayPrivateEndpointConnectionsClientGetResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.Get. +type ApplicationGatewayPrivateEndpointConnectionsClientGetResponse struct { + ApplicationGatewayPrivateEndpointConnection +} + +// ApplicationGatewayPrivateEndpointConnectionsClientListResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.List. +type ApplicationGatewayPrivateEndpointConnectionsClientListResponse struct { + ApplicationGatewayPrivateEndpointConnectionListResult +} + +// ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse contains the response from method ApplicationGatewayPrivateEndpointConnectionsClient.Update. +type ApplicationGatewayPrivateEndpointConnectionsClientUpdateResponse struct { + ApplicationGatewayPrivateEndpointConnection +} + +// ApplicationGatewayPrivateLinkResourcesClientListResponse contains the response from method ApplicationGatewayPrivateLinkResourcesClient.List. +type ApplicationGatewayPrivateLinkResourcesClientListResponse struct { + ApplicationGatewayPrivateLinkResourceListResult +} + +// ApplicationGatewayWafDynamicManifestsClientGetResponse contains the response from method ApplicationGatewayWafDynamicManifestsClient.Get. +type ApplicationGatewayWafDynamicManifestsClientGetResponse struct { + ApplicationGatewayWafDynamicManifestResultList +} + +// ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse contains the response from method ApplicationGatewayWafDynamicManifestsDefaultClient.Get. +type ApplicationGatewayWafDynamicManifestsDefaultClientGetResponse struct { + ApplicationGatewayWafDynamicManifestResult +} + +// ApplicationGatewaysClientBackendHealthOnDemandResponse contains the response from method ApplicationGatewaysClient.BackendHealthOnDemand. +type ApplicationGatewaysClientBackendHealthOnDemandResponse struct { + ApplicationGatewayBackendHealthOnDemand +} + +// ApplicationGatewaysClientBackendHealthResponse contains the response from method ApplicationGatewaysClient.BackendHealth. +type ApplicationGatewaysClientBackendHealthResponse struct { + ApplicationGatewayBackendHealth +} + +// ApplicationGatewaysClientCreateOrUpdateResponse contains the response from method ApplicationGatewaysClient.CreateOrUpdate. +type ApplicationGatewaysClientCreateOrUpdateResponse struct { + ApplicationGateway +} + +// ApplicationGatewaysClientDeleteResponse contains the response from method ApplicationGatewaysClient.Delete. +type ApplicationGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientGetResponse contains the response from method ApplicationGatewaysClient.Get. +type ApplicationGatewaysClientGetResponse struct { + ApplicationGateway +} + +// ApplicationGatewaysClientGetSSLPredefinedPolicyResponse contains the response from method ApplicationGatewaysClient.GetSSLPredefinedPolicy. +type ApplicationGatewaysClientGetSSLPredefinedPolicyResponse struct { + ApplicationGatewaySSLPredefinedPolicy +} + +// ApplicationGatewaysClientListAllResponse contains the response from method ApplicationGatewaysClient.ListAll. +type ApplicationGatewaysClientListAllResponse struct { + ApplicationGatewayListResult +} + +// ApplicationGatewaysClientListAvailableRequestHeadersResponse contains the response from method ApplicationGatewaysClient.ListAvailableRequestHeaders. +type ApplicationGatewaysClientListAvailableRequestHeadersResponse struct { + // Response for ApplicationGatewayAvailableRequestHeaders API service call. + StringArray []*string +} + +// ApplicationGatewaysClientListAvailableResponseHeadersResponse contains the response from method ApplicationGatewaysClient.ListAvailableResponseHeaders. +type ApplicationGatewaysClientListAvailableResponseHeadersResponse struct { + // Response for ApplicationGatewayAvailableResponseHeaders API service call. + StringArray []*string +} + +// ApplicationGatewaysClientListAvailableSSLOptionsResponse contains the response from method ApplicationGatewaysClient.ListAvailableSSLOptions. +type ApplicationGatewaysClientListAvailableSSLOptionsResponse struct { + ApplicationGatewayAvailableSSLOptions +} + +// ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse contains the response from method ApplicationGatewaysClient.ListAvailableSSLPredefinedPolicies. +type ApplicationGatewaysClientListAvailableSSLPredefinedPoliciesResponse struct { + ApplicationGatewayAvailableSSLPredefinedPolicies +} + +// ApplicationGatewaysClientListAvailableServerVariablesResponse contains the response from method ApplicationGatewaysClient.ListAvailableServerVariables. +type ApplicationGatewaysClientListAvailableServerVariablesResponse struct { + // Response for ApplicationGatewayAvailableServerVariables API service call. + StringArray []*string +} + +// ApplicationGatewaysClientListAvailableWafRuleSetsResponse contains the response from method ApplicationGatewaysClient.ListAvailableWafRuleSets. +type ApplicationGatewaysClientListAvailableWafRuleSetsResponse struct { + ApplicationGatewayAvailableWafRuleSetsResult +} + +// ApplicationGatewaysClientListResponse contains the response from method ApplicationGatewaysClient.List. +type ApplicationGatewaysClientListResponse struct { + ApplicationGatewayListResult +} + +// ApplicationGatewaysClientStartResponse contains the response from method ApplicationGatewaysClient.Start. +type ApplicationGatewaysClientStartResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientStopResponse contains the response from method ApplicationGatewaysClient.Stop. +type ApplicationGatewaysClientStopResponse struct { + // placeholder for future response values +} + +// ApplicationGatewaysClientUpdateTagsResponse contains the response from method ApplicationGatewaysClient.UpdateTags. +type ApplicationGatewaysClientUpdateTagsResponse struct { + ApplicationGateway +} + +// ApplicationSecurityGroupsClientCreateOrUpdateResponse contains the response from method ApplicationSecurityGroupsClient.CreateOrUpdate. +type ApplicationSecurityGroupsClientCreateOrUpdateResponse struct { + ApplicationSecurityGroup +} + +// ApplicationSecurityGroupsClientDeleteResponse contains the response from method ApplicationSecurityGroupsClient.Delete. +type ApplicationSecurityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationSecurityGroupsClientGetResponse contains the response from method ApplicationSecurityGroupsClient.Get. +type ApplicationSecurityGroupsClientGetResponse struct { + ApplicationSecurityGroup +} + +// ApplicationSecurityGroupsClientListAllResponse contains the response from method ApplicationSecurityGroupsClient.ListAll. +type ApplicationSecurityGroupsClientListAllResponse struct { + ApplicationSecurityGroupListResult +} + +// ApplicationSecurityGroupsClientListResponse contains the response from method ApplicationSecurityGroupsClient.List. +type ApplicationSecurityGroupsClientListResponse struct { + ApplicationSecurityGroupListResult +} + +// ApplicationSecurityGroupsClientUpdateTagsResponse contains the response from method ApplicationSecurityGroupsClient.UpdateTags. +type ApplicationSecurityGroupsClientUpdateTagsResponse struct { + ApplicationSecurityGroup +} + +// AvailableDelegationsClientListResponse contains the response from method AvailableDelegationsClient.List. +type AvailableDelegationsClientListResponse struct { + AvailableDelegationsResult +} + +// AvailableEndpointServicesClientListResponse contains the response from method AvailableEndpointServicesClient.List. +type AvailableEndpointServicesClientListResponse struct { + EndpointServicesListResult +} + +// AvailablePrivateEndpointTypesClientListByResourceGroupResponse contains the response from method AvailablePrivateEndpointTypesClient.ListByResourceGroup. +type AvailablePrivateEndpointTypesClientListByResourceGroupResponse struct { + AvailablePrivateEndpointTypesResult +} + +// AvailablePrivateEndpointTypesClientListResponse contains the response from method AvailablePrivateEndpointTypesClient.List. +type AvailablePrivateEndpointTypesClientListResponse struct { + AvailablePrivateEndpointTypesResult +} + +// AvailableResourceGroupDelegationsClientListResponse contains the response from method AvailableResourceGroupDelegationsClient.List. +type AvailableResourceGroupDelegationsClientListResponse struct { + AvailableDelegationsResult +} + +// AvailableServiceAliasesClientListByResourceGroupResponse contains the response from method AvailableServiceAliasesClient.ListByResourceGroup. +type AvailableServiceAliasesClientListByResourceGroupResponse struct { + AvailableServiceAliasesResult +} + +// AvailableServiceAliasesClientListResponse contains the response from method AvailableServiceAliasesClient.List. +type AvailableServiceAliasesClientListResponse struct { + AvailableServiceAliasesResult +} + +// AzureFirewallFqdnTagsClientListAllResponse contains the response from method AzureFirewallFqdnTagsClient.ListAll. +type AzureFirewallFqdnTagsClientListAllResponse struct { + AzureFirewallFqdnTagListResult +} + +// AzureFirewallsClientCreateOrUpdateResponse contains the response from method AzureFirewallsClient.CreateOrUpdate. +type AzureFirewallsClientCreateOrUpdateResponse struct { + AzureFirewall +} + +// AzureFirewallsClientDeleteResponse contains the response from method AzureFirewallsClient.Delete. +type AzureFirewallsClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureFirewallsClientGetResponse contains the response from method AzureFirewallsClient.Get. +type AzureFirewallsClientGetResponse struct { + AzureFirewall +} + +// AzureFirewallsClientListAllResponse contains the response from method AzureFirewallsClient.ListAll. +type AzureFirewallsClientListAllResponse struct { + AzureFirewallListResult +} + +// AzureFirewallsClientListLearnedPrefixesResponse contains the response from method AzureFirewallsClient.ListLearnedPrefixes. +type AzureFirewallsClientListLearnedPrefixesResponse struct { + IPPrefixesList +} + +// AzureFirewallsClientListResponse contains the response from method AzureFirewallsClient.List. +type AzureFirewallsClientListResponse struct { + AzureFirewallListResult +} + +// AzureFirewallsClientUpdateTagsResponse contains the response from method AzureFirewallsClient.UpdateTags. +type AzureFirewallsClientUpdateTagsResponse struct { + AzureFirewall +} + +// BastionHostsClientCreateOrUpdateResponse contains the response from method BastionHostsClient.CreateOrUpdate. +type BastionHostsClientCreateOrUpdateResponse struct { + BastionHost +} + +// BastionHostsClientDeleteResponse contains the response from method BastionHostsClient.Delete. +type BastionHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// BastionHostsClientGetResponse contains the response from method BastionHostsClient.Get. +type BastionHostsClientGetResponse struct { + BastionHost +} + +// BastionHostsClientListByResourceGroupResponse contains the response from method BastionHostsClient.ListByResourceGroup. +type BastionHostsClientListByResourceGroupResponse struct { + BastionHostListResult +} + +// BastionHostsClientListResponse contains the response from method BastionHostsClient.List. +type BastionHostsClientListResponse struct { + BastionHostListResult +} + +// BastionHostsClientUpdateTagsResponse contains the response from method BastionHostsClient.UpdateTags. +type BastionHostsClientUpdateTagsResponse struct { + BastionHost +} + +// BgpServiceCommunitiesClientListResponse contains the response from method BgpServiceCommunitiesClient.List. +type BgpServiceCommunitiesClientListResponse struct { + BgpServiceCommunityListResult +} + +// ConfigurationPolicyGroupsClientCreateOrUpdateResponse contains the response from method ConfigurationPolicyGroupsClient.CreateOrUpdate. +type ConfigurationPolicyGroupsClientCreateOrUpdateResponse struct { + VPNServerConfigurationPolicyGroup +} + +// ConfigurationPolicyGroupsClientDeleteResponse contains the response from method ConfigurationPolicyGroupsClient.Delete. +type ConfigurationPolicyGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConfigurationPolicyGroupsClientGetResponse contains the response from method ConfigurationPolicyGroupsClient.Get. +type ConfigurationPolicyGroupsClientGetResponse struct { + VPNServerConfigurationPolicyGroup +} + +// ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse contains the response from method ConfigurationPolicyGroupsClient.ListByVPNServerConfiguration. +type ConfigurationPolicyGroupsClientListByVPNServerConfigurationResponse struct { + ListVPNServerConfigurationPolicyGroupsResult +} + +// ConnectionMonitorsClientCreateOrUpdateResponse contains the response from method ConnectionMonitorsClient.CreateOrUpdate. +type ConnectionMonitorsClientCreateOrUpdateResponse struct { + ConnectionMonitorResult +} + +// ConnectionMonitorsClientDeleteResponse contains the response from method ConnectionMonitorsClient.Delete. +type ConnectionMonitorsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientGetResponse contains the response from method ConnectionMonitorsClient.Get. +type ConnectionMonitorsClientGetResponse struct { + ConnectionMonitorResult +} + +// ConnectionMonitorsClientListResponse contains the response from method ConnectionMonitorsClient.List. +type ConnectionMonitorsClientListResponse struct { + ConnectionMonitorListResult +} + +// ConnectionMonitorsClientQueryResponse contains the response from method ConnectionMonitorsClient.Query. +type ConnectionMonitorsClientQueryResponse struct { + ConnectionMonitorQueryResult +} + +// ConnectionMonitorsClientStartResponse contains the response from method ConnectionMonitorsClient.Start. +type ConnectionMonitorsClientStartResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientStopResponse contains the response from method ConnectionMonitorsClient.Stop. +type ConnectionMonitorsClientStopResponse struct { + // placeholder for future response values +} + +// ConnectionMonitorsClientUpdateTagsResponse contains the response from method ConnectionMonitorsClient.UpdateTags. +type ConnectionMonitorsClientUpdateTagsResponse struct { + ConnectionMonitorResult +} + +// ConnectivityConfigurationsClientCreateOrUpdateResponse contains the response from method ConnectivityConfigurationsClient.CreateOrUpdate. +type ConnectivityConfigurationsClientCreateOrUpdateResponse struct { + ConnectivityConfiguration +} + +// ConnectivityConfigurationsClientDeleteResponse contains the response from method ConnectivityConfigurationsClient.Delete. +type ConnectivityConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectivityConfigurationsClientGetResponse contains the response from method ConnectivityConfigurationsClient.Get. +type ConnectivityConfigurationsClientGetResponse struct { + ConnectivityConfiguration +} + +// ConnectivityConfigurationsClientListResponse contains the response from method ConnectivityConfigurationsClient.List. +type ConnectivityConfigurationsClientListResponse struct { + ConnectivityConfigurationListResult +} + +// CustomIPPrefixesClientCreateOrUpdateResponse contains the response from method CustomIPPrefixesClient.CreateOrUpdate. +type CustomIPPrefixesClientCreateOrUpdateResponse struct { + CustomIPPrefix +} + +// CustomIPPrefixesClientDeleteResponse contains the response from method CustomIPPrefixesClient.Delete. +type CustomIPPrefixesClientDeleteResponse struct { + // placeholder for future response values +} + +// CustomIPPrefixesClientGetResponse contains the response from method CustomIPPrefixesClient.Get. +type CustomIPPrefixesClientGetResponse struct { + CustomIPPrefix +} + +// CustomIPPrefixesClientListAllResponse contains the response from method CustomIPPrefixesClient.ListAll. +type CustomIPPrefixesClientListAllResponse struct { + CustomIPPrefixListResult +} + +// CustomIPPrefixesClientListResponse contains the response from method CustomIPPrefixesClient.List. +type CustomIPPrefixesClientListResponse struct { + CustomIPPrefixListResult +} + +// CustomIPPrefixesClientUpdateTagsResponse contains the response from method CustomIPPrefixesClient.UpdateTags. +type CustomIPPrefixesClientUpdateTagsResponse struct { + CustomIPPrefix +} + +// DdosCustomPoliciesClientCreateOrUpdateResponse contains the response from method DdosCustomPoliciesClient.CreateOrUpdate. +type DdosCustomPoliciesClientCreateOrUpdateResponse struct { + DdosCustomPolicy +} + +// DdosCustomPoliciesClientDeleteResponse contains the response from method DdosCustomPoliciesClient.Delete. +type DdosCustomPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// DdosCustomPoliciesClientGetResponse contains the response from method DdosCustomPoliciesClient.Get. +type DdosCustomPoliciesClientGetResponse struct { + DdosCustomPolicy +} + +// DdosCustomPoliciesClientUpdateTagsResponse contains the response from method DdosCustomPoliciesClient.UpdateTags. +type DdosCustomPoliciesClientUpdateTagsResponse struct { + DdosCustomPolicy +} + +// DdosProtectionPlansClientCreateOrUpdateResponse contains the response from method DdosProtectionPlansClient.CreateOrUpdate. +type DdosProtectionPlansClientCreateOrUpdateResponse struct { + DdosProtectionPlan +} + +// DdosProtectionPlansClientDeleteResponse contains the response from method DdosProtectionPlansClient.Delete. +type DdosProtectionPlansClientDeleteResponse struct { + // placeholder for future response values +} + +// DdosProtectionPlansClientGetResponse contains the response from method DdosProtectionPlansClient.Get. +type DdosProtectionPlansClientGetResponse struct { + DdosProtectionPlan +} + +// DdosProtectionPlansClientListByResourceGroupResponse contains the response from method DdosProtectionPlansClient.ListByResourceGroup. +type DdosProtectionPlansClientListByResourceGroupResponse struct { + DdosProtectionPlanListResult +} + +// DdosProtectionPlansClientListResponse contains the response from method DdosProtectionPlansClient.List. +type DdosProtectionPlansClientListResponse struct { + DdosProtectionPlanListResult +} + +// DdosProtectionPlansClientUpdateTagsResponse contains the response from method DdosProtectionPlansClient.UpdateTags. +type DdosProtectionPlansClientUpdateTagsResponse struct { + DdosProtectionPlan +} + +// DefaultSecurityRulesClientGetResponse contains the response from method DefaultSecurityRulesClient.Get. +type DefaultSecurityRulesClientGetResponse struct { + SecurityRule +} + +// DefaultSecurityRulesClientListResponse contains the response from method DefaultSecurityRulesClient.List. +type DefaultSecurityRulesClientListResponse struct { + SecurityRuleListResult +} + +// DscpConfigurationClientCreateOrUpdateResponse contains the response from method DscpConfigurationClient.CreateOrUpdate. +type DscpConfigurationClientCreateOrUpdateResponse struct { + DscpConfiguration +} + +// DscpConfigurationClientDeleteResponse contains the response from method DscpConfigurationClient.Delete. +type DscpConfigurationClientDeleteResponse struct { + // placeholder for future response values +} + +// DscpConfigurationClientGetResponse contains the response from method DscpConfigurationClient.Get. +type DscpConfigurationClientGetResponse struct { + DscpConfiguration +} + +// DscpConfigurationClientListAllResponse contains the response from method DscpConfigurationClient.ListAll. +type DscpConfigurationClientListAllResponse struct { + DscpConfigurationListResult +} + +// DscpConfigurationClientListResponse contains the response from method DscpConfigurationClient.List. +type DscpConfigurationClientListResponse struct { + DscpConfigurationListResult +} + +// ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.CreateOrUpdate. +type ExpressRouteCircuitAuthorizationsClientCreateOrUpdateResponse struct { + ExpressRouteCircuitAuthorization +} + +// ExpressRouteCircuitAuthorizationsClientDeleteResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.Delete. +type ExpressRouteCircuitAuthorizationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitAuthorizationsClientGetResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.Get. +type ExpressRouteCircuitAuthorizationsClientGetResponse struct { + ExpressRouteCircuitAuthorization +} + +// ExpressRouteCircuitAuthorizationsClientListResponse contains the response from method ExpressRouteCircuitAuthorizationsClient.List. +type ExpressRouteCircuitAuthorizationsClientListResponse struct { + AuthorizationListResult +} + +// ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitConnectionsClient.CreateOrUpdate. +type ExpressRouteCircuitConnectionsClientCreateOrUpdateResponse struct { + ExpressRouteCircuitConnection +} + +// ExpressRouteCircuitConnectionsClientDeleteResponse contains the response from method ExpressRouteCircuitConnectionsClient.Delete. +type ExpressRouteCircuitConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitConnectionsClientGetResponse contains the response from method ExpressRouteCircuitConnectionsClient.Get. +type ExpressRouteCircuitConnectionsClientGetResponse struct { + ExpressRouteCircuitConnection +} + +// ExpressRouteCircuitConnectionsClientListResponse contains the response from method ExpressRouteCircuitConnectionsClient.List. +type ExpressRouteCircuitConnectionsClientListResponse struct { + ExpressRouteCircuitConnectionListResult +} + +// ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitPeeringsClient.CreateOrUpdate. +type ExpressRouteCircuitPeeringsClientCreateOrUpdateResponse struct { + ExpressRouteCircuitPeering +} + +// ExpressRouteCircuitPeeringsClientDeleteResponse contains the response from method ExpressRouteCircuitPeeringsClient.Delete. +type ExpressRouteCircuitPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitPeeringsClientGetResponse contains the response from method ExpressRouteCircuitPeeringsClient.Get. +type ExpressRouteCircuitPeeringsClientGetResponse struct { + ExpressRouteCircuitPeering +} + +// ExpressRouteCircuitPeeringsClientListResponse contains the response from method ExpressRouteCircuitPeeringsClient.List. +type ExpressRouteCircuitPeeringsClientListResponse struct { + ExpressRouteCircuitPeeringListResult +} + +// ExpressRouteCircuitsClientCreateOrUpdateResponse contains the response from method ExpressRouteCircuitsClient.CreateOrUpdate. +type ExpressRouteCircuitsClientCreateOrUpdateResponse struct { + ExpressRouteCircuit +} + +// ExpressRouteCircuitsClientDeleteResponse contains the response from method ExpressRouteCircuitsClient.Delete. +type ExpressRouteCircuitsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCircuitsClientGetPeeringStatsResponse contains the response from method ExpressRouteCircuitsClient.GetPeeringStats. +type ExpressRouteCircuitsClientGetPeeringStatsResponse struct { + ExpressRouteCircuitStats +} + +// ExpressRouteCircuitsClientGetResponse contains the response from method ExpressRouteCircuitsClient.Get. +type ExpressRouteCircuitsClientGetResponse struct { + ExpressRouteCircuit +} + +// ExpressRouteCircuitsClientGetStatsResponse contains the response from method ExpressRouteCircuitsClient.GetStats. +type ExpressRouteCircuitsClientGetStatsResponse struct { + ExpressRouteCircuitStats +} + +// ExpressRouteCircuitsClientListAllResponse contains the response from method ExpressRouteCircuitsClient.ListAll. +type ExpressRouteCircuitsClientListAllResponse struct { + ExpressRouteCircuitListResult +} + +// ExpressRouteCircuitsClientListArpTableResponse contains the response from method ExpressRouteCircuitsClient.ListArpTable. +type ExpressRouteCircuitsClientListArpTableResponse struct { + ExpressRouteCircuitsArpTableListResult +} + +// ExpressRouteCircuitsClientListResponse contains the response from method ExpressRouteCircuitsClient.List. +type ExpressRouteCircuitsClientListResponse struct { + ExpressRouteCircuitListResult +} + +// ExpressRouteCircuitsClientListRoutesTableResponse contains the response from method ExpressRouteCircuitsClient.ListRoutesTable. +type ExpressRouteCircuitsClientListRoutesTableResponse struct { + ExpressRouteCircuitsRoutesTableListResult +} + +// ExpressRouteCircuitsClientListRoutesTableSummaryResponse contains the response from method ExpressRouteCircuitsClient.ListRoutesTableSummary. +type ExpressRouteCircuitsClientListRoutesTableSummaryResponse struct { + ExpressRouteCircuitsRoutesTableSummaryListResult +} + +// ExpressRouteCircuitsClientUpdateTagsResponse contains the response from method ExpressRouteCircuitsClient.UpdateTags. +type ExpressRouteCircuitsClientUpdateTagsResponse struct { + ExpressRouteCircuit +} + +// ExpressRouteConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteConnectionsClient.CreateOrUpdate. +type ExpressRouteConnectionsClientCreateOrUpdateResponse struct { + ExpressRouteConnection +} + +// ExpressRouteConnectionsClientDeleteResponse contains the response from method ExpressRouteConnectionsClient.Delete. +type ExpressRouteConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteConnectionsClientGetResponse contains the response from method ExpressRouteConnectionsClient.Get. +type ExpressRouteConnectionsClientGetResponse struct { + ExpressRouteConnection +} + +// ExpressRouteConnectionsClientListResponse contains the response from method ExpressRouteConnectionsClient.List. +type ExpressRouteConnectionsClientListResponse struct { + ExpressRouteConnectionList +} + +// ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.CreateOrUpdate. +type ExpressRouteCrossConnectionPeeringsClientCreateOrUpdateResponse struct { + ExpressRouteCrossConnectionPeering +} + +// ExpressRouteCrossConnectionPeeringsClientDeleteResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.Delete. +type ExpressRouteCrossConnectionPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteCrossConnectionPeeringsClientGetResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.Get. +type ExpressRouteCrossConnectionPeeringsClientGetResponse struct { + ExpressRouteCrossConnectionPeering +} + +// ExpressRouteCrossConnectionPeeringsClientListResponse contains the response from method ExpressRouteCrossConnectionPeeringsClient.List. +type ExpressRouteCrossConnectionPeeringsClientListResponse struct { + ExpressRouteCrossConnectionPeeringList +} + +// ExpressRouteCrossConnectionsClientCreateOrUpdateResponse contains the response from method ExpressRouteCrossConnectionsClient.CreateOrUpdate. +type ExpressRouteCrossConnectionsClientCreateOrUpdateResponse struct { + ExpressRouteCrossConnection +} + +// ExpressRouteCrossConnectionsClientGetResponse contains the response from method ExpressRouteCrossConnectionsClient.Get. +type ExpressRouteCrossConnectionsClientGetResponse struct { + ExpressRouteCrossConnection +} + +// ExpressRouteCrossConnectionsClientListArpTableResponse contains the response from method ExpressRouteCrossConnectionsClient.ListArpTable. +type ExpressRouteCrossConnectionsClientListArpTableResponse struct { + ExpressRouteCircuitsArpTableListResult +} + +// ExpressRouteCrossConnectionsClientListByResourceGroupResponse contains the response from method ExpressRouteCrossConnectionsClient.ListByResourceGroup. +type ExpressRouteCrossConnectionsClientListByResourceGroupResponse struct { + ExpressRouteCrossConnectionListResult +} + +// ExpressRouteCrossConnectionsClientListResponse contains the response from method ExpressRouteCrossConnectionsClient.List. +type ExpressRouteCrossConnectionsClientListResponse struct { + ExpressRouteCrossConnectionListResult +} + +// ExpressRouteCrossConnectionsClientListRoutesTableResponse contains the response from method ExpressRouteCrossConnectionsClient.ListRoutesTable. +type ExpressRouteCrossConnectionsClientListRoutesTableResponse struct { + ExpressRouteCircuitsRoutesTableListResult +} + +// ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse contains the response from method ExpressRouteCrossConnectionsClient.ListRoutesTableSummary. +type ExpressRouteCrossConnectionsClientListRoutesTableSummaryResponse struct { + ExpressRouteCrossConnectionsRoutesTableSummaryListResult +} + +// ExpressRouteCrossConnectionsClientUpdateTagsResponse contains the response from method ExpressRouteCrossConnectionsClient.UpdateTags. +type ExpressRouteCrossConnectionsClientUpdateTagsResponse struct { + ExpressRouteCrossConnection +} + +// ExpressRouteGatewaysClientCreateOrUpdateResponse contains the response from method ExpressRouteGatewaysClient.CreateOrUpdate. +type ExpressRouteGatewaysClientCreateOrUpdateResponse struct { + ExpressRouteGateway +} + +// ExpressRouteGatewaysClientDeleteResponse contains the response from method ExpressRouteGatewaysClient.Delete. +type ExpressRouteGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRouteGatewaysClientGetResponse contains the response from method ExpressRouteGatewaysClient.Get. +type ExpressRouteGatewaysClientGetResponse struct { + ExpressRouteGateway +} + +// ExpressRouteGatewaysClientListByResourceGroupResponse contains the response from method ExpressRouteGatewaysClient.ListByResourceGroup. +type ExpressRouteGatewaysClientListByResourceGroupResponse struct { + ExpressRouteGatewayList +} + +// ExpressRouteGatewaysClientListBySubscriptionResponse contains the response from method ExpressRouteGatewaysClient.ListBySubscription. +type ExpressRouteGatewaysClientListBySubscriptionResponse struct { + ExpressRouteGatewayList +} + +// ExpressRouteGatewaysClientUpdateTagsResponse contains the response from method ExpressRouteGatewaysClient.UpdateTags. +type ExpressRouteGatewaysClientUpdateTagsResponse struct { + ExpressRouteGateway +} + +// ExpressRouteLinksClientGetResponse contains the response from method ExpressRouteLinksClient.Get. +type ExpressRouteLinksClientGetResponse struct { + ExpressRouteLink +} + +// ExpressRouteLinksClientListResponse contains the response from method ExpressRouteLinksClient.List. +type ExpressRouteLinksClientListResponse struct { + ExpressRouteLinkListResult +} + +// ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse contains the response from method ExpressRoutePortAuthorizationsClient.CreateOrUpdate. +type ExpressRoutePortAuthorizationsClientCreateOrUpdateResponse struct { + ExpressRoutePortAuthorization +} + +// ExpressRoutePortAuthorizationsClientDeleteResponse contains the response from method ExpressRoutePortAuthorizationsClient.Delete. +type ExpressRoutePortAuthorizationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRoutePortAuthorizationsClientGetResponse contains the response from method ExpressRoutePortAuthorizationsClient.Get. +type ExpressRoutePortAuthorizationsClientGetResponse struct { + ExpressRoutePortAuthorization +} + +// ExpressRoutePortAuthorizationsClientListResponse contains the response from method ExpressRoutePortAuthorizationsClient.List. +type ExpressRoutePortAuthorizationsClientListResponse struct { + ExpressRoutePortAuthorizationListResult +} + +// ExpressRoutePortsClientCreateOrUpdateResponse contains the response from method ExpressRoutePortsClient.CreateOrUpdate. +type ExpressRoutePortsClientCreateOrUpdateResponse struct { + ExpressRoutePort +} + +// ExpressRoutePortsClientDeleteResponse contains the response from method ExpressRoutePortsClient.Delete. +type ExpressRoutePortsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExpressRoutePortsClientGenerateLOAResponse contains the response from method ExpressRoutePortsClient.GenerateLOA. +type ExpressRoutePortsClientGenerateLOAResponse struct { + GenerateExpressRoutePortsLOAResult +} + +// ExpressRoutePortsClientGetResponse contains the response from method ExpressRoutePortsClient.Get. +type ExpressRoutePortsClientGetResponse struct { + ExpressRoutePort +} + +// ExpressRoutePortsClientListByResourceGroupResponse contains the response from method ExpressRoutePortsClient.ListByResourceGroup. +type ExpressRoutePortsClientListByResourceGroupResponse struct { + ExpressRoutePortListResult +} + +// ExpressRoutePortsClientListResponse contains the response from method ExpressRoutePortsClient.List. +type ExpressRoutePortsClientListResponse struct { + ExpressRoutePortListResult +} + +// ExpressRoutePortsClientUpdateTagsResponse contains the response from method ExpressRoutePortsClient.UpdateTags. +type ExpressRoutePortsClientUpdateTagsResponse struct { + ExpressRoutePort +} + +// ExpressRoutePortsLocationsClientGetResponse contains the response from method ExpressRoutePortsLocationsClient.Get. +type ExpressRoutePortsLocationsClientGetResponse struct { + ExpressRoutePortsLocation +} + +// ExpressRoutePortsLocationsClientListResponse contains the response from method ExpressRoutePortsLocationsClient.List. +type ExpressRoutePortsLocationsClientListResponse struct { + ExpressRoutePortsLocationListResult +} + +// ExpressRouteProviderPortsLocationClientListResponse contains the response from method ExpressRouteProviderPortsLocationClient.List. +type ExpressRouteProviderPortsLocationClientListResponse struct { + ExpressRouteProviderPortListResult +} + +// ExpressRouteServiceProvidersClientListResponse contains the response from method ExpressRouteServiceProvidersClient.List. +type ExpressRouteServiceProvidersClientListResponse struct { + ExpressRouteServiceProviderListResult +} + +// FirewallPoliciesClientCreateOrUpdateResponse contains the response from method FirewallPoliciesClient.CreateOrUpdate. +type FirewallPoliciesClientCreateOrUpdateResponse struct { + FirewallPolicy +} + +// FirewallPoliciesClientDeleteResponse contains the response from method FirewallPoliciesClient.Delete. +type FirewallPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallPoliciesClientGetResponse contains the response from method FirewallPoliciesClient.Get. +type FirewallPoliciesClientGetResponse struct { + FirewallPolicy +} + +// FirewallPoliciesClientListAllResponse contains the response from method FirewallPoliciesClient.ListAll. +type FirewallPoliciesClientListAllResponse struct { + FirewallPolicyListResult +} + +// FirewallPoliciesClientListResponse contains the response from method FirewallPoliciesClient.List. +type FirewallPoliciesClientListResponse struct { + FirewallPolicyListResult +} + +// FirewallPoliciesClientUpdateTagsResponse contains the response from method FirewallPoliciesClient.UpdateTags. +type FirewallPoliciesClientUpdateTagsResponse struct { + FirewallPolicy +} + +// FirewallPolicyIdpsSignaturesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesClient.List. +type FirewallPolicyIdpsSignaturesClientListResponse struct { + QueryResults +} + +// FirewallPolicyIdpsSignaturesFilterValuesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesFilterValuesClient.List. +type FirewallPolicyIdpsSignaturesFilterValuesClientListResponse struct { + SignatureOverridesFilterValuesResponse +} + +// FirewallPolicyIdpsSignaturesOverridesClientGetResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Get. +type FirewallPolicyIdpsSignaturesOverridesClientGetResponse struct { + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesClientListResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.List. +type FirewallPolicyIdpsSignaturesOverridesClientListResponse struct { + SignaturesOverridesList +} + +// FirewallPolicyIdpsSignaturesOverridesClientPatchResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Patch. +type FirewallPolicyIdpsSignaturesOverridesClientPatchResponse struct { + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesClientPutResponse contains the response from method FirewallPolicyIdpsSignaturesOverridesClient.Put. +type FirewallPolicyIdpsSignaturesOverridesClientPutResponse struct { + SignaturesOverrides +} + +// FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.CreateOrUpdate. +type FirewallPolicyRuleCollectionGroupsClientCreateOrUpdateResponse struct { + FirewallPolicyRuleCollectionGroup +} + +// FirewallPolicyRuleCollectionGroupsClientDeleteResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.Delete. +type FirewallPolicyRuleCollectionGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallPolicyRuleCollectionGroupsClientGetResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.Get. +type FirewallPolicyRuleCollectionGroupsClientGetResponse struct { + FirewallPolicyRuleCollectionGroup +} + +// FirewallPolicyRuleCollectionGroupsClientListResponse contains the response from method FirewallPolicyRuleCollectionGroupsClient.List. +type FirewallPolicyRuleCollectionGroupsClientListResponse struct { + FirewallPolicyRuleCollectionGroupListResult +} + +// FlowLogsClientCreateOrUpdateResponse contains the response from method FlowLogsClient.CreateOrUpdate. +type FlowLogsClientCreateOrUpdateResponse struct { + FlowLog +} + +// FlowLogsClientDeleteResponse contains the response from method FlowLogsClient.Delete. +type FlowLogsClientDeleteResponse struct { + // placeholder for future response values +} + +// FlowLogsClientGetResponse contains the response from method FlowLogsClient.Get. +type FlowLogsClientGetResponse struct { + FlowLog +} + +// FlowLogsClientListResponse contains the response from method FlowLogsClient.List. +type FlowLogsClientListResponse struct { + FlowLogListResult +} + +// FlowLogsClientUpdateTagsResponse contains the response from method FlowLogsClient.UpdateTags. +type FlowLogsClientUpdateTagsResponse struct { + FlowLog +} + +// GroupsClientCreateOrUpdateResponse contains the response from method GroupsClient.CreateOrUpdate. +type GroupsClientCreateOrUpdateResponse struct { + Group + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// GroupsClientDeleteResponse contains the response from method GroupsClient.Delete. +type GroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// GroupsClientGetResponse contains the response from method GroupsClient.Get. +type GroupsClientGetResponse struct { + Group +} + +// GroupsClientListResponse contains the response from method GroupsClient.List. +type GroupsClientListResponse struct { + GroupListResult +} + +// HubRouteTablesClientCreateOrUpdateResponse contains the response from method HubRouteTablesClient.CreateOrUpdate. +type HubRouteTablesClientCreateOrUpdateResponse struct { + HubRouteTable +} + +// HubRouteTablesClientDeleteResponse contains the response from method HubRouteTablesClient.Delete. +type HubRouteTablesClientDeleteResponse struct { + // placeholder for future response values +} + +// HubRouteTablesClientGetResponse contains the response from method HubRouteTablesClient.Get. +type HubRouteTablesClientGetResponse struct { + HubRouteTable +} + +// HubRouteTablesClientListResponse contains the response from method HubRouteTablesClient.List. +type HubRouteTablesClientListResponse struct { + ListHubRouteTablesResult +} + +// HubVirtualNetworkConnectionsClientCreateOrUpdateResponse contains the response from method HubVirtualNetworkConnectionsClient.CreateOrUpdate. +type HubVirtualNetworkConnectionsClientCreateOrUpdateResponse struct { + HubVirtualNetworkConnection +} + +// HubVirtualNetworkConnectionsClientDeleteResponse contains the response from method HubVirtualNetworkConnectionsClient.Delete. +type HubVirtualNetworkConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// HubVirtualNetworkConnectionsClientGetResponse contains the response from method HubVirtualNetworkConnectionsClient.Get. +type HubVirtualNetworkConnectionsClientGetResponse struct { + HubVirtualNetworkConnection +} + +// HubVirtualNetworkConnectionsClientListResponse contains the response from method HubVirtualNetworkConnectionsClient.List. +type HubVirtualNetworkConnectionsClientListResponse struct { + ListHubVirtualNetworkConnectionsResult +} + +// IPAllocationsClientCreateOrUpdateResponse contains the response from method IPAllocationsClient.CreateOrUpdate. +type IPAllocationsClientCreateOrUpdateResponse struct { + IPAllocation +} + +// IPAllocationsClientDeleteResponse contains the response from method IPAllocationsClient.Delete. +type IPAllocationsClientDeleteResponse struct { + // placeholder for future response values +} + +// IPAllocationsClientGetResponse contains the response from method IPAllocationsClient.Get. +type IPAllocationsClientGetResponse struct { + IPAllocation +} + +// IPAllocationsClientListByResourceGroupResponse contains the response from method IPAllocationsClient.ListByResourceGroup. +type IPAllocationsClientListByResourceGroupResponse struct { + IPAllocationListResult +} + +// IPAllocationsClientListResponse contains the response from method IPAllocationsClient.List. +type IPAllocationsClientListResponse struct { + IPAllocationListResult +} + +// IPAllocationsClientUpdateTagsResponse contains the response from method IPAllocationsClient.UpdateTags. +type IPAllocationsClientUpdateTagsResponse struct { + IPAllocation +} + +// IPGroupsClientCreateOrUpdateResponse contains the response from method IPGroupsClient.CreateOrUpdate. +type IPGroupsClientCreateOrUpdateResponse struct { + IPGroup +} + +// IPGroupsClientDeleteResponse contains the response from method IPGroupsClient.Delete. +type IPGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// IPGroupsClientGetResponse contains the response from method IPGroupsClient.Get. +type IPGroupsClientGetResponse struct { + IPGroup +} + +// IPGroupsClientListByResourceGroupResponse contains the response from method IPGroupsClient.ListByResourceGroup. +type IPGroupsClientListByResourceGroupResponse struct { + IPGroupListResult +} + +// IPGroupsClientListResponse contains the response from method IPGroupsClient.List. +type IPGroupsClientListResponse struct { + IPGroupListResult +} + +// IPGroupsClientUpdateGroupsResponse contains the response from method IPGroupsClient.UpdateGroups. +type IPGroupsClientUpdateGroupsResponse struct { + IPGroup +} + +// InboundNatRulesClientCreateOrUpdateResponse contains the response from method InboundNatRulesClient.CreateOrUpdate. +type InboundNatRulesClientCreateOrUpdateResponse struct { + InboundNatRule +} + +// InboundNatRulesClientDeleteResponse contains the response from method InboundNatRulesClient.Delete. +type InboundNatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// InboundNatRulesClientGetResponse contains the response from method InboundNatRulesClient.Get. +type InboundNatRulesClientGetResponse struct { + InboundNatRule +} + +// InboundNatRulesClientListResponse contains the response from method InboundNatRulesClient.List. +type InboundNatRulesClientListResponse struct { + InboundNatRuleListResult +} + +// InboundSecurityRuleClientCreateOrUpdateResponse contains the response from method InboundSecurityRuleClient.CreateOrUpdate. +type InboundSecurityRuleClientCreateOrUpdateResponse struct { + InboundSecurityRule +} + +// InterfaceIPConfigurationsClientGetResponse contains the response from method InterfaceIPConfigurationsClient.Get. +type InterfaceIPConfigurationsClientGetResponse struct { + InterfaceIPConfiguration +} + +// InterfaceIPConfigurationsClientListResponse contains the response from method InterfaceIPConfigurationsClient.List. +type InterfaceIPConfigurationsClientListResponse struct { + InterfaceIPConfigurationListResult +} + +// InterfaceLoadBalancersClientListResponse contains the response from method InterfaceLoadBalancersClient.List. +type InterfaceLoadBalancersClientListResponse struct { + InterfaceLoadBalancerListResult +} + +// InterfaceTapConfigurationsClientCreateOrUpdateResponse contains the response from method InterfaceTapConfigurationsClient.CreateOrUpdate. +type InterfaceTapConfigurationsClientCreateOrUpdateResponse struct { + InterfaceTapConfiguration +} + +// InterfaceTapConfigurationsClientDeleteResponse contains the response from method InterfaceTapConfigurationsClient.Delete. +type InterfaceTapConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// InterfaceTapConfigurationsClientGetResponse contains the response from method InterfaceTapConfigurationsClient.Get. +type InterfaceTapConfigurationsClientGetResponse struct { + InterfaceTapConfiguration +} + +// InterfaceTapConfigurationsClientListResponse contains the response from method InterfaceTapConfigurationsClient.List. +type InterfaceTapConfigurationsClientListResponse struct { + InterfaceTapConfigurationListResult +} + +// InterfacesClientCreateOrUpdateResponse contains the response from method InterfacesClient.CreateOrUpdate. +type InterfacesClientCreateOrUpdateResponse struct { + Interface +} + +// InterfacesClientDeleteResponse contains the response from method InterfacesClient.Delete. +type InterfacesClientDeleteResponse struct { + // placeholder for future response values +} + +// InterfacesClientGetCloudServiceNetworkInterfaceResponse contains the response from method InterfacesClient.GetCloudServiceNetworkInterface. +type InterfacesClientGetCloudServiceNetworkInterfaceResponse struct { + Interface +} + +// InterfacesClientGetEffectiveRouteTableResponse contains the response from method InterfacesClient.GetEffectiveRouteTable. +type InterfacesClientGetEffectiveRouteTableResponse struct { + EffectiveRouteListResult +} + +// InterfacesClientGetResponse contains the response from method InterfacesClient.Get. +type InterfacesClientGetResponse struct { + Interface +} + +// InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse contains the response from method InterfacesClient.GetVirtualMachineScaleSetIPConfiguration. +type InterfacesClientGetVirtualMachineScaleSetIPConfigurationResponse struct { + InterfaceIPConfiguration +} + +// InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse contains the response from method InterfacesClient.GetVirtualMachineScaleSetNetworkInterface. +type InterfacesClientGetVirtualMachineScaleSetNetworkInterfaceResponse struct { + Interface +} + +// InterfacesClientListAllResponse contains the response from method InterfacesClient.ListAll. +type InterfacesClientListAllResponse struct { + InterfaceListResult +} + +// InterfacesClientListCloudServiceNetworkInterfacesResponse contains the response from method InterfacesClient.ListCloudServiceNetworkInterfaces. +type InterfacesClientListCloudServiceNetworkInterfacesResponse struct { + InterfaceListResult +} + +// InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse contains the response from method InterfacesClient.ListCloudServiceRoleInstanceNetworkInterfaces. +type InterfacesClientListCloudServiceRoleInstanceNetworkInterfacesResponse struct { + InterfaceListResult +} + +// InterfacesClientListEffectiveNetworkSecurityGroupsResponse contains the response from method InterfacesClient.ListEffectiveNetworkSecurityGroups. +type InterfacesClientListEffectiveNetworkSecurityGroupsResponse struct { + EffectiveNetworkSecurityGroupListResult +} + +// InterfacesClientListResponse contains the response from method InterfacesClient.List. +type InterfacesClientListResponse struct { + InterfaceListResult +} + +// InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse contains the response from method InterfacesClient.ListVirtualMachineScaleSetIPConfigurations. +type InterfacesClientListVirtualMachineScaleSetIPConfigurationsResponse struct { + InterfaceIPConfigurationListResult +} + +// InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse contains the response from method InterfacesClient.ListVirtualMachineScaleSetNetworkInterfaces. +type InterfacesClientListVirtualMachineScaleSetNetworkInterfacesResponse struct { + InterfaceListResult +} + +// InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse contains the response from method InterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfaces. +type InterfacesClientListVirtualMachineScaleSetVMNetworkInterfacesResponse struct { + InterfaceListResult +} + +// InterfacesClientUpdateTagsResponse contains the response from method InterfacesClient.UpdateTags. +type InterfacesClientUpdateTagsResponse struct { + Interface +} + +// LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse contains the response from method LoadBalancerBackendAddressPoolsClient.CreateOrUpdate. +type LoadBalancerBackendAddressPoolsClientCreateOrUpdateResponse struct { + BackendAddressPool +} + +// LoadBalancerBackendAddressPoolsClientDeleteResponse contains the response from method LoadBalancerBackendAddressPoolsClient.Delete. +type LoadBalancerBackendAddressPoolsClientDeleteResponse struct { + // placeholder for future response values +} + +// LoadBalancerBackendAddressPoolsClientGetResponse contains the response from method LoadBalancerBackendAddressPoolsClient.Get. +type LoadBalancerBackendAddressPoolsClientGetResponse struct { + BackendAddressPool +} + +// LoadBalancerBackendAddressPoolsClientListResponse contains the response from method LoadBalancerBackendAddressPoolsClient.List. +type LoadBalancerBackendAddressPoolsClientListResponse struct { + LoadBalancerBackendAddressPoolListResult +} + +// LoadBalancerFrontendIPConfigurationsClientGetResponse contains the response from method LoadBalancerFrontendIPConfigurationsClient.Get. +type LoadBalancerFrontendIPConfigurationsClientGetResponse struct { + FrontendIPConfiguration +} + +// LoadBalancerFrontendIPConfigurationsClientListResponse contains the response from method LoadBalancerFrontendIPConfigurationsClient.List. +type LoadBalancerFrontendIPConfigurationsClientListResponse struct { + LoadBalancerFrontendIPConfigurationListResult +} + +// LoadBalancerLoadBalancingRulesClientGetResponse contains the response from method LoadBalancerLoadBalancingRulesClient.Get. +type LoadBalancerLoadBalancingRulesClientGetResponse struct { + LoadBalancingRule +} + +// LoadBalancerLoadBalancingRulesClientListResponse contains the response from method LoadBalancerLoadBalancingRulesClient.List. +type LoadBalancerLoadBalancingRulesClientListResponse struct { + LoadBalancerLoadBalancingRuleListResult +} + +// LoadBalancerNetworkInterfacesClientListResponse contains the response from method LoadBalancerNetworkInterfacesClient.List. +type LoadBalancerNetworkInterfacesClientListResponse struct { + InterfaceListResult +} + +// LoadBalancerOutboundRulesClientGetResponse contains the response from method LoadBalancerOutboundRulesClient.Get. +type LoadBalancerOutboundRulesClientGetResponse struct { + OutboundRule +} + +// LoadBalancerOutboundRulesClientListResponse contains the response from method LoadBalancerOutboundRulesClient.List. +type LoadBalancerOutboundRulesClientListResponse struct { + LoadBalancerOutboundRuleListResult +} + +// LoadBalancerProbesClientGetResponse contains the response from method LoadBalancerProbesClient.Get. +type LoadBalancerProbesClientGetResponse struct { + Probe +} + +// LoadBalancerProbesClientListResponse contains the response from method LoadBalancerProbesClient.List. +type LoadBalancerProbesClientListResponse struct { + LoadBalancerProbeListResult +} + +// LoadBalancersClientCreateOrUpdateResponse contains the response from method LoadBalancersClient.CreateOrUpdate. +type LoadBalancersClientCreateOrUpdateResponse struct { + LoadBalancer +} + +// LoadBalancersClientDeleteResponse contains the response from method LoadBalancersClient.Delete. +type LoadBalancersClientDeleteResponse struct { + // placeholder for future response values +} + +// LoadBalancersClientGetResponse contains the response from method LoadBalancersClient.Get. +type LoadBalancersClientGetResponse struct { + LoadBalancer +} + +// LoadBalancersClientListAllResponse contains the response from method LoadBalancersClient.ListAll. +type LoadBalancersClientListAllResponse struct { + LoadBalancerListResult +} + +// LoadBalancersClientListInboundNatRulePortMappingsResponse contains the response from method LoadBalancersClient.ListInboundNatRulePortMappings. +type LoadBalancersClientListInboundNatRulePortMappingsResponse struct { + BackendAddressInboundNatRulePortMappings +} + +// LoadBalancersClientListResponse contains the response from method LoadBalancersClient.List. +type LoadBalancersClientListResponse struct { + LoadBalancerListResult +} + +// LoadBalancersClientSwapPublicIPAddressesResponse contains the response from method LoadBalancersClient.SwapPublicIPAddresses. +type LoadBalancersClientSwapPublicIPAddressesResponse struct { + // placeholder for future response values +} + +// LoadBalancersClientUpdateTagsResponse contains the response from method LoadBalancersClient.UpdateTags. +type LoadBalancersClientUpdateTagsResponse struct { + LoadBalancer +} + +// LocalNetworkGatewaysClientCreateOrUpdateResponse contains the response from method LocalNetworkGatewaysClient.CreateOrUpdate. +type LocalNetworkGatewaysClientCreateOrUpdateResponse struct { + LocalNetworkGateway +} + +// LocalNetworkGatewaysClientDeleteResponse contains the response from method LocalNetworkGatewaysClient.Delete. +type LocalNetworkGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// LocalNetworkGatewaysClientGetResponse contains the response from method LocalNetworkGatewaysClient.Get. +type LocalNetworkGatewaysClientGetResponse struct { + LocalNetworkGateway +} + +// LocalNetworkGatewaysClientListResponse contains the response from method LocalNetworkGatewaysClient.List. +type LocalNetworkGatewaysClientListResponse struct { + LocalNetworkGatewayListResult +} + +// LocalNetworkGatewaysClientUpdateTagsResponse contains the response from method LocalNetworkGatewaysClient.UpdateTags. +type LocalNetworkGatewaysClientUpdateTagsResponse struct { + LocalNetworkGateway +} + +// ManagementClientCheckDNSNameAvailabilityResponse contains the response from method ManagementClient.CheckDNSNameAvailability. +type ManagementClientCheckDNSNameAvailabilityResponse struct { + DNSNameAvailabilityResult +} + +// ManagementClientDeleteBastionShareableLinkResponse contains the response from method ManagementClient.DeleteBastionShareableLink. +type ManagementClientDeleteBastionShareableLinkResponse struct { + // placeholder for future response values +} + +// ManagementClientDisconnectActiveSessionsResponse contains the response from method ManagementClient.DisconnectActiveSessions. +type ManagementClientDisconnectActiveSessionsResponse struct { + BastionSessionDeleteResult +} + +// ManagementClientExpressRouteProviderPortResponse contains the response from method ManagementClient.ExpressRouteProviderPort. +type ManagementClientExpressRouteProviderPortResponse struct { + ExpressRouteProviderPort +} + +// ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse contains the response from method ManagementClient.Generatevirtualwanvpnserverconfigurationvpnprofile. +type ManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse struct { + VPNProfileResponse +} + +// ManagementClientGetActiveSessionsResponse contains the response from method ManagementClient.GetActiveSessions. +type ManagementClientGetActiveSessionsResponse struct { + BastionActiveSessionListResult +} + +// ManagementClientGetBastionShareableLinkResponse contains the response from method ManagementClient.GetBastionShareableLink. +type ManagementClientGetBastionShareableLinkResponse struct { + BastionShareableLinkListResult +} + +// ManagementClientListActiveConnectivityConfigurationsResponse contains the response from method ManagementClient.ListActiveConnectivityConfigurations. +type ManagementClientListActiveConnectivityConfigurationsResponse struct { + ActiveConnectivityConfigurationsListResult +} + +// ManagementClientListActiveSecurityAdminRulesResponse contains the response from method ManagementClient.ListActiveSecurityAdminRules. +type ManagementClientListActiveSecurityAdminRulesResponse struct { + ActiveSecurityAdminRulesListResult +} + +// ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse contains the response from method ManagementClient.ListNetworkManagerEffectiveConnectivityConfigurations. +type ManagementClientListNetworkManagerEffectiveConnectivityConfigurationsResponse struct { + ManagerEffectiveConnectivityConfigurationListResult +} + +// ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse contains the response from method ManagementClient.ListNetworkManagerEffectiveSecurityAdminRules. +type ManagementClientListNetworkManagerEffectiveSecurityAdminRulesResponse struct { + ManagerEffectiveSecurityAdminRulesListResult +} + +// ManagementClientPutBastionShareableLinkResponse contains the response from method ManagementClient.PutBastionShareableLink. +type ManagementClientPutBastionShareableLinkResponse struct { + BastionShareableLinkListResult +} + +// ManagementClientSupportedSecurityProvidersResponse contains the response from method ManagementClient.SupportedSecurityProviders. +type ManagementClientSupportedSecurityProvidersResponse struct { + VirtualWanSecurityProviders +} + +// ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.CreateOrUpdate. +type ManagementGroupNetworkManagerConnectionsClientCreateOrUpdateResponse struct { + ManagerConnection +} + +// ManagementGroupNetworkManagerConnectionsClientDeleteResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.Delete. +type ManagementGroupNetworkManagerConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagementGroupNetworkManagerConnectionsClientGetResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.Get. +type ManagementGroupNetworkManagerConnectionsClientGetResponse struct { + ManagerConnection +} + +// ManagementGroupNetworkManagerConnectionsClientListResponse contains the response from method ManagementGroupNetworkManagerConnectionsClient.List. +type ManagementGroupNetworkManagerConnectionsClientListResponse struct { + ManagerConnectionListResult +} + +// ManagerCommitsClientPostResponse contains the response from method ManagerCommitsClient.Post. +type ManagerCommitsClientPostResponse struct { + ManagerCommit +} + +// ManagerDeploymentStatusClientListResponse contains the response from method ManagerDeploymentStatusClient.List. +type ManagerDeploymentStatusClientListResponse struct { + ManagerDeploymentStatusListResult +} + +// ManagersClientCreateOrUpdateResponse contains the response from method ManagersClient.CreateOrUpdate. +type ManagersClientCreateOrUpdateResponse struct { + Manager +} + +// ManagersClientDeleteResponse contains the response from method ManagersClient.Delete. +type ManagersClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagersClientGetResponse contains the response from method ManagersClient.Get. +type ManagersClientGetResponse struct { + Manager +} + +// ManagersClientListBySubscriptionResponse contains the response from method ManagersClient.ListBySubscription. +type ManagersClientListBySubscriptionResponse struct { + ManagerListResult +} + +// ManagersClientListResponse contains the response from method ManagersClient.List. +type ManagersClientListResponse struct { + ManagerListResult +} + +// ManagersClientPatchResponse contains the response from method ManagersClient.Patch. +type ManagersClientPatchResponse struct { + Manager +} + +// NatGatewaysClientCreateOrUpdateResponse contains the response from method NatGatewaysClient.CreateOrUpdate. +type NatGatewaysClientCreateOrUpdateResponse struct { + NatGateway +} + +// NatGatewaysClientDeleteResponse contains the response from method NatGatewaysClient.Delete. +type NatGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// NatGatewaysClientGetResponse contains the response from method NatGatewaysClient.Get. +type NatGatewaysClientGetResponse struct { + NatGateway +} + +// NatGatewaysClientListAllResponse contains the response from method NatGatewaysClient.ListAll. +type NatGatewaysClientListAllResponse struct { + NatGatewayListResult +} + +// NatGatewaysClientListResponse contains the response from method NatGatewaysClient.List. +type NatGatewaysClientListResponse struct { + NatGatewayListResult +} + +// NatGatewaysClientUpdateTagsResponse contains the response from method NatGatewaysClient.UpdateTags. +type NatGatewaysClientUpdateTagsResponse struct { + NatGateway +} + +// NatRulesClientCreateOrUpdateResponse contains the response from method NatRulesClient.CreateOrUpdate. +type NatRulesClientCreateOrUpdateResponse struct { + VPNGatewayNatRule +} + +// NatRulesClientDeleteResponse contains the response from method NatRulesClient.Delete. +type NatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// NatRulesClientGetResponse contains the response from method NatRulesClient.Get. +type NatRulesClientGetResponse struct { + VPNGatewayNatRule +} + +// NatRulesClientListByVPNGatewayResponse contains the response from method NatRulesClient.ListByVPNGateway. +type NatRulesClientListByVPNGatewayResponse struct { + ListVPNGatewayNatRulesResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} + +// P2SVPNGatewaysClientCreateOrUpdateResponse contains the response from method P2SVPNGatewaysClient.CreateOrUpdate. +type P2SVPNGatewaysClientCreateOrUpdateResponse struct { + P2SVPNGateway +} + +// P2SVPNGatewaysClientDeleteResponse contains the response from method P2SVPNGatewaysClient.Delete. +type P2SVPNGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse contains the response from method P2SVPNGatewaysClient.DisconnectP2SVPNConnections. +type P2SVPNGatewaysClientDisconnectP2SVPNConnectionsResponse struct { + // placeholder for future response values +} + +// P2SVPNGatewaysClientGenerateVPNProfileResponse contains the response from method P2SVPNGatewaysClient.GenerateVPNProfile. +type P2SVPNGatewaysClientGenerateVPNProfileResponse struct { + VPNProfileResponse +} + +// P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse contains the response from method P2SVPNGatewaysClient.GetP2SVPNConnectionHealthDetailed. +type P2SVPNGatewaysClientGetP2SVPNConnectionHealthDetailedResponse struct { + P2SVPNConnectionHealth +} + +// P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse contains the response from method P2SVPNGatewaysClient.GetP2SVPNConnectionHealth. +type P2SVPNGatewaysClientGetP2SVPNConnectionHealthResponse struct { + P2SVPNGateway +} + +// P2SVPNGatewaysClientGetResponse contains the response from method P2SVPNGatewaysClient.Get. +type P2SVPNGatewaysClientGetResponse struct { + P2SVPNGateway +} + +// P2SVPNGatewaysClientListByResourceGroupResponse contains the response from method P2SVPNGatewaysClient.ListByResourceGroup. +type P2SVPNGatewaysClientListByResourceGroupResponse struct { + ListP2SVPNGatewaysResult +} + +// P2SVPNGatewaysClientListResponse contains the response from method P2SVPNGatewaysClient.List. +type P2SVPNGatewaysClientListResponse struct { + ListP2SVPNGatewaysResult +} + +// P2SVPNGatewaysClientResetResponse contains the response from method P2SVPNGatewaysClient.Reset. +type P2SVPNGatewaysClientResetResponse struct { + P2SVPNGateway +} + +// P2SVPNGatewaysClientUpdateTagsResponse contains the response from method P2SVPNGatewaysClient.UpdateTags. +type P2SVPNGatewaysClientUpdateTagsResponse struct { + P2SVPNGateway +} + +// PacketCapturesClientCreateResponse contains the response from method PacketCapturesClient.Create. +type PacketCapturesClientCreateResponse struct { + PacketCaptureResult +} + +// PacketCapturesClientDeleteResponse contains the response from method PacketCapturesClient.Delete. +type PacketCapturesClientDeleteResponse struct { + // placeholder for future response values +} + +// PacketCapturesClientGetResponse contains the response from method PacketCapturesClient.Get. +type PacketCapturesClientGetResponse struct { + PacketCaptureResult +} + +// PacketCapturesClientGetStatusResponse contains the response from method PacketCapturesClient.GetStatus. +type PacketCapturesClientGetStatusResponse struct { + PacketCaptureQueryStatusResult +} + +// PacketCapturesClientListResponse contains the response from method PacketCapturesClient.List. +type PacketCapturesClientListResponse struct { + PacketCaptureListResult +} + +// PacketCapturesClientStopResponse contains the response from method PacketCapturesClient.Stop. +type PacketCapturesClientStopResponse struct { + // placeholder for future response values +} + +// PeerExpressRouteCircuitConnectionsClientGetResponse contains the response from method PeerExpressRouteCircuitConnectionsClient.Get. +type PeerExpressRouteCircuitConnectionsClientGetResponse struct { + PeerExpressRouteCircuitConnection +} + +// PeerExpressRouteCircuitConnectionsClientListResponse contains the response from method PeerExpressRouteCircuitConnectionsClient.List. +type PeerExpressRouteCircuitConnectionsClientListResponse struct { + PeerExpressRouteCircuitConnectionListResult +} + +// PrivateDNSZoneGroupsClientCreateOrUpdateResponse contains the response from method PrivateDNSZoneGroupsClient.CreateOrUpdate. +type PrivateDNSZoneGroupsClientCreateOrUpdateResponse struct { + PrivateDNSZoneGroup +} + +// PrivateDNSZoneGroupsClientDeleteResponse contains the response from method PrivateDNSZoneGroupsClient.Delete. +type PrivateDNSZoneGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateDNSZoneGroupsClientGetResponse contains the response from method PrivateDNSZoneGroupsClient.Get. +type PrivateDNSZoneGroupsClientGetResponse struct { + PrivateDNSZoneGroup +} + +// PrivateDNSZoneGroupsClientListResponse contains the response from method PrivateDNSZoneGroupsClient.List. +type PrivateDNSZoneGroupsClientListResponse struct { + PrivateDNSZoneGroupListResult +} + +// PrivateEndpointsClientCreateOrUpdateResponse contains the response from method PrivateEndpointsClient.CreateOrUpdate. +type PrivateEndpointsClientCreateOrUpdateResponse struct { + PrivateEndpoint +} + +// PrivateEndpointsClientDeleteResponse contains the response from method PrivateEndpointsClient.Delete. +type PrivateEndpointsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointsClientGetResponse contains the response from method PrivateEndpointsClient.Get. +type PrivateEndpointsClientGetResponse struct { + PrivateEndpoint +} + +// PrivateEndpointsClientListBySubscriptionResponse contains the response from method PrivateEndpointsClient.ListBySubscription. +type PrivateEndpointsClientListBySubscriptionResponse struct { + PrivateEndpointListResult +} + +// PrivateEndpointsClientListResponse contains the response from method PrivateEndpointsClient.List. +type PrivateEndpointsClientListResponse struct { + PrivateEndpointListResult +} + +// PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse contains the response from method PrivateLinkServicesClient.CheckPrivateLinkServiceVisibilityByResourceGroup. +type PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityByResourceGroupResponse struct { + PrivateLinkServiceVisibility +} + +// PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse contains the response from method PrivateLinkServicesClient.CheckPrivateLinkServiceVisibility. +type PrivateLinkServicesClientCheckPrivateLinkServiceVisibilityResponse struct { + PrivateLinkServiceVisibility +} + +// PrivateLinkServicesClientCreateOrUpdateResponse contains the response from method PrivateLinkServicesClient.CreateOrUpdate. +type PrivateLinkServicesClientCreateOrUpdateResponse struct { + PrivateLinkService +} + +// PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.DeletePrivateEndpointConnection. +type PrivateLinkServicesClientDeletePrivateEndpointConnectionResponse struct { + // placeholder for future response values +} + +// PrivateLinkServicesClientDeleteResponse contains the response from method PrivateLinkServicesClient.Delete. +type PrivateLinkServicesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateLinkServicesClientGetPrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.GetPrivateEndpointConnection. +type PrivateLinkServicesClientGetPrivateEndpointConnectionResponse struct { + PrivateEndpointConnection +} + +// PrivateLinkServicesClientGetResponse contains the response from method PrivateLinkServicesClient.Get. +type PrivateLinkServicesClientGetResponse struct { + PrivateLinkService +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse contains the response from method PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesByResourceGroupResponse struct { + AutoApprovedPrivateLinkServicesResult +} + +// PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse contains the response from method PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices. +type PrivateLinkServicesClientListAutoApprovedPrivateLinkServicesResponse struct { + AutoApprovedPrivateLinkServicesResult +} + +// PrivateLinkServicesClientListBySubscriptionResponse contains the response from method PrivateLinkServicesClient.ListBySubscription. +type PrivateLinkServicesClientListBySubscriptionResponse struct { + PrivateLinkServiceListResult +} + +// PrivateLinkServicesClientListPrivateEndpointConnectionsResponse contains the response from method PrivateLinkServicesClient.ListPrivateEndpointConnections. +type PrivateLinkServicesClientListPrivateEndpointConnectionsResponse struct { + PrivateEndpointConnectionListResult +} + +// PrivateLinkServicesClientListResponse contains the response from method PrivateLinkServicesClient.List. +type PrivateLinkServicesClientListResponse struct { + PrivateLinkServiceListResult +} + +// PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse contains the response from method PrivateLinkServicesClient.UpdatePrivateEndpointConnection. +type PrivateLinkServicesClientUpdatePrivateEndpointConnectionResponse struct { + PrivateEndpointConnection +} + +// ProfilesClientCreateOrUpdateResponse contains the response from method ProfilesClient.CreateOrUpdate. +type ProfilesClientCreateOrUpdateResponse struct { + Profile +} + +// ProfilesClientDeleteResponse contains the response from method ProfilesClient.Delete. +type ProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// ProfilesClientGetResponse contains the response from method ProfilesClient.Get. +type ProfilesClientGetResponse struct { + Profile +} + +// ProfilesClientListAllResponse contains the response from method ProfilesClient.ListAll. +type ProfilesClientListAllResponse struct { + ProfileListResult +} + +// ProfilesClientListResponse contains the response from method ProfilesClient.List. +type ProfilesClientListResponse struct { + ProfileListResult +} + +// ProfilesClientUpdateTagsResponse contains the response from method ProfilesClient.UpdateTags. +type ProfilesClientUpdateTagsResponse struct { + Profile +} + +// PublicIPAddressesClientCreateOrUpdateResponse contains the response from method PublicIPAddressesClient.CreateOrUpdate. +type PublicIPAddressesClientCreateOrUpdateResponse struct { + PublicIPAddress +} + +// PublicIPAddressesClientDdosProtectionStatusResponse contains the response from method PublicIPAddressesClient.DdosProtectionStatus. +type PublicIPAddressesClientDdosProtectionStatusResponse struct { + PublicIPDdosProtectionStatusResult +} + +// PublicIPAddressesClientDeleteResponse contains the response from method PublicIPAddressesClient.Delete. +type PublicIPAddressesClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicIPAddressesClientGetCloudServicePublicIPAddressResponse contains the response from method PublicIPAddressesClient.GetCloudServicePublicIPAddress. +type PublicIPAddressesClientGetCloudServicePublicIPAddressResponse struct { + PublicIPAddress +} + +// PublicIPAddressesClientGetResponse contains the response from method PublicIPAddressesClient.Get. +type PublicIPAddressesClientGetResponse struct { + PublicIPAddress +} + +// PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse contains the response from method PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress. +type PublicIPAddressesClientGetVirtualMachineScaleSetPublicIPAddressResponse struct { + PublicIPAddress +} + +// PublicIPAddressesClientListAllResponse contains the response from method PublicIPAddressesClient.ListAll. +type PublicIPAddressesClientListAllResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientListCloudServicePublicIPAddressesResponse contains the response from method PublicIPAddressesClient.ListCloudServicePublicIPAddresses. +type PublicIPAddressesClientListCloudServicePublicIPAddressesResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse contains the response from method PublicIPAddressesClient.ListCloudServiceRoleInstancePublicIPAddresses. +type PublicIPAddressesClientListCloudServiceRoleInstancePublicIPAddressesResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientListResponse contains the response from method PublicIPAddressesClient.List. +type PublicIPAddressesClientListResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse contains the response from method PublicIPAddressesClient.ListVirtualMachineScaleSetPublicIPAddresses. +type PublicIPAddressesClientListVirtualMachineScaleSetPublicIPAddressesResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse contains the response from method PublicIPAddressesClient.ListVirtualMachineScaleSetVMPublicIPAddresses. +type PublicIPAddressesClientListVirtualMachineScaleSetVMPublicIPAddressesResponse struct { + PublicIPAddressListResult +} + +// PublicIPAddressesClientUpdateTagsResponse contains the response from method PublicIPAddressesClient.UpdateTags. +type PublicIPAddressesClientUpdateTagsResponse struct { + PublicIPAddress +} + +// PublicIPPrefixesClientCreateOrUpdateResponse contains the response from method PublicIPPrefixesClient.CreateOrUpdate. +type PublicIPPrefixesClientCreateOrUpdateResponse struct { + PublicIPPrefix +} + +// PublicIPPrefixesClientDeleteResponse contains the response from method PublicIPPrefixesClient.Delete. +type PublicIPPrefixesClientDeleteResponse struct { + // placeholder for future response values +} + +// PublicIPPrefixesClientGetResponse contains the response from method PublicIPPrefixesClient.Get. +type PublicIPPrefixesClientGetResponse struct { + PublicIPPrefix +} + +// PublicIPPrefixesClientListAllResponse contains the response from method PublicIPPrefixesClient.ListAll. +type PublicIPPrefixesClientListAllResponse struct { + PublicIPPrefixListResult +} + +// PublicIPPrefixesClientListResponse contains the response from method PublicIPPrefixesClient.List. +type PublicIPPrefixesClientListResponse struct { + PublicIPPrefixListResult +} + +// PublicIPPrefixesClientUpdateTagsResponse contains the response from method PublicIPPrefixesClient.UpdateTags. +type PublicIPPrefixesClientUpdateTagsResponse struct { + PublicIPPrefix +} + +// ResourceNavigationLinksClientListResponse contains the response from method ResourceNavigationLinksClient.List. +type ResourceNavigationLinksClientListResponse struct { + ResourceNavigationLinksListResult +} + +// RouteFilterRulesClientCreateOrUpdateResponse contains the response from method RouteFilterRulesClient.CreateOrUpdate. +type RouteFilterRulesClientCreateOrUpdateResponse struct { + RouteFilterRule +} + +// RouteFilterRulesClientDeleteResponse contains the response from method RouteFilterRulesClient.Delete. +type RouteFilterRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteFilterRulesClientGetResponse contains the response from method RouteFilterRulesClient.Get. +type RouteFilterRulesClientGetResponse struct { + RouteFilterRule +} + +// RouteFilterRulesClientListByRouteFilterResponse contains the response from method RouteFilterRulesClient.ListByRouteFilter. +type RouteFilterRulesClientListByRouteFilterResponse struct { + RouteFilterRuleListResult +} + +// RouteFiltersClientCreateOrUpdateResponse contains the response from method RouteFiltersClient.CreateOrUpdate. +type RouteFiltersClientCreateOrUpdateResponse struct { + RouteFilter +} + +// RouteFiltersClientDeleteResponse contains the response from method RouteFiltersClient.Delete. +type RouteFiltersClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteFiltersClientGetResponse contains the response from method RouteFiltersClient.Get. +type RouteFiltersClientGetResponse struct { + RouteFilter +} + +// RouteFiltersClientListByResourceGroupResponse contains the response from method RouteFiltersClient.ListByResourceGroup. +type RouteFiltersClientListByResourceGroupResponse struct { + RouteFilterListResult +} + +// RouteFiltersClientListResponse contains the response from method RouteFiltersClient.List. +type RouteFiltersClientListResponse struct { + RouteFilterListResult +} + +// RouteFiltersClientUpdateTagsResponse contains the response from method RouteFiltersClient.UpdateTags. +type RouteFiltersClientUpdateTagsResponse struct { + RouteFilter +} + +// RouteMapsClientCreateOrUpdateResponse contains the response from method RouteMapsClient.CreateOrUpdate. +type RouteMapsClientCreateOrUpdateResponse struct { + RouteMap +} + +// RouteMapsClientDeleteResponse contains the response from method RouteMapsClient.Delete. +type RouteMapsClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteMapsClientGetResponse contains the response from method RouteMapsClient.Get. +type RouteMapsClientGetResponse struct { + RouteMap +} + +// RouteMapsClientListResponse contains the response from method RouteMapsClient.List. +type RouteMapsClientListResponse struct { + ListRouteMapsResult +} + +// RouteTablesClientCreateOrUpdateResponse contains the response from method RouteTablesClient.CreateOrUpdate. +type RouteTablesClientCreateOrUpdateResponse struct { + RouteTable +} + +// RouteTablesClientDeleteResponse contains the response from method RouteTablesClient.Delete. +type RouteTablesClientDeleteResponse struct { + // placeholder for future response values +} + +// RouteTablesClientGetResponse contains the response from method RouteTablesClient.Get. +type RouteTablesClientGetResponse struct { + RouteTable +} + +// RouteTablesClientListAllResponse contains the response from method RouteTablesClient.ListAll. +type RouteTablesClientListAllResponse struct { + RouteTableListResult +} + +// RouteTablesClientListResponse contains the response from method RouteTablesClient.List. +type RouteTablesClientListResponse struct { + RouteTableListResult +} + +// RouteTablesClientUpdateTagsResponse contains the response from method RouteTablesClient.UpdateTags. +type RouteTablesClientUpdateTagsResponse struct { + RouteTable +} + +// RoutesClientCreateOrUpdateResponse contains the response from method RoutesClient.CreateOrUpdate. +type RoutesClientCreateOrUpdateResponse struct { + Route +} + +// RoutesClientDeleteResponse contains the response from method RoutesClient.Delete. +type RoutesClientDeleteResponse struct { + // placeholder for future response values +} + +// RoutesClientGetResponse contains the response from method RoutesClient.Get. +type RoutesClientGetResponse struct { + Route +} + +// RoutesClientListResponse contains the response from method RoutesClient.List. +type RoutesClientListResponse struct { + RouteListResult +} + +// RoutingIntentClientCreateOrUpdateResponse contains the response from method RoutingIntentClient.CreateOrUpdate. +type RoutingIntentClientCreateOrUpdateResponse struct { + RoutingIntent +} + +// RoutingIntentClientDeleteResponse contains the response from method RoutingIntentClient.Delete. +type RoutingIntentClientDeleteResponse struct { + // placeholder for future response values +} + +// RoutingIntentClientGetResponse contains the response from method RoutingIntentClient.Get. +type RoutingIntentClientGetResponse struct { + RoutingIntent +} + +// RoutingIntentClientListResponse contains the response from method RoutingIntentClient.List. +type RoutingIntentClientListResponse struct { + ListRoutingIntentResult +} + +// ScopeConnectionsClientCreateOrUpdateResponse contains the response from method ScopeConnectionsClient.CreateOrUpdate. +type ScopeConnectionsClientCreateOrUpdateResponse struct { + ScopeConnection +} + +// ScopeConnectionsClientDeleteResponse contains the response from method ScopeConnectionsClient.Delete. +type ScopeConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ScopeConnectionsClientGetResponse contains the response from method ScopeConnectionsClient.Get. +type ScopeConnectionsClientGetResponse struct { + ScopeConnection +} + +// ScopeConnectionsClientListResponse contains the response from method ScopeConnectionsClient.List. +type ScopeConnectionsClientListResponse struct { + ScopeConnectionListResult +} + +// SecurityAdminConfigurationsClientCreateOrUpdateResponse contains the response from method SecurityAdminConfigurationsClient.CreateOrUpdate. +type SecurityAdminConfigurationsClientCreateOrUpdateResponse struct { + SecurityAdminConfiguration +} + +// SecurityAdminConfigurationsClientDeleteResponse contains the response from method SecurityAdminConfigurationsClient.Delete. +type SecurityAdminConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityAdminConfigurationsClientGetResponse contains the response from method SecurityAdminConfigurationsClient.Get. +type SecurityAdminConfigurationsClientGetResponse struct { + SecurityAdminConfiguration +} + +// SecurityAdminConfigurationsClientListResponse contains the response from method SecurityAdminConfigurationsClient.List. +type SecurityAdminConfigurationsClientListResponse struct { + SecurityAdminConfigurationListResult +} + +// SecurityGroupsClientCreateOrUpdateResponse contains the response from method SecurityGroupsClient.CreateOrUpdate. +type SecurityGroupsClientCreateOrUpdateResponse struct { + SecurityGroup +} + +// SecurityGroupsClientDeleteResponse contains the response from method SecurityGroupsClient.Delete. +type SecurityGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityGroupsClientGetResponse contains the response from method SecurityGroupsClient.Get. +type SecurityGroupsClientGetResponse struct { + SecurityGroup +} + +// SecurityGroupsClientListAllResponse contains the response from method SecurityGroupsClient.ListAll. +type SecurityGroupsClientListAllResponse struct { + SecurityGroupListResult +} + +// SecurityGroupsClientListResponse contains the response from method SecurityGroupsClient.List. +type SecurityGroupsClientListResponse struct { + SecurityGroupListResult +} + +// SecurityGroupsClientUpdateTagsResponse contains the response from method SecurityGroupsClient.UpdateTags. +type SecurityGroupsClientUpdateTagsResponse struct { + SecurityGroup +} + +// SecurityPartnerProvidersClientCreateOrUpdateResponse contains the response from method SecurityPartnerProvidersClient.CreateOrUpdate. +type SecurityPartnerProvidersClientCreateOrUpdateResponse struct { + SecurityPartnerProvider +} + +// SecurityPartnerProvidersClientDeleteResponse contains the response from method SecurityPartnerProvidersClient.Delete. +type SecurityPartnerProvidersClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityPartnerProvidersClientGetResponse contains the response from method SecurityPartnerProvidersClient.Get. +type SecurityPartnerProvidersClientGetResponse struct { + SecurityPartnerProvider +} + +// SecurityPartnerProvidersClientListByResourceGroupResponse contains the response from method SecurityPartnerProvidersClient.ListByResourceGroup. +type SecurityPartnerProvidersClientListByResourceGroupResponse struct { + SecurityPartnerProviderListResult +} + +// SecurityPartnerProvidersClientListResponse contains the response from method SecurityPartnerProvidersClient.List. +type SecurityPartnerProvidersClientListResponse struct { + SecurityPartnerProviderListResult +} + +// SecurityPartnerProvidersClientUpdateTagsResponse contains the response from method SecurityPartnerProvidersClient.UpdateTags. +type SecurityPartnerProvidersClientUpdateTagsResponse struct { + SecurityPartnerProvider +} + +// SecurityRulesClientCreateOrUpdateResponse contains the response from method SecurityRulesClient.CreateOrUpdate. +type SecurityRulesClientCreateOrUpdateResponse struct { + SecurityRule +} + +// SecurityRulesClientDeleteResponse contains the response from method SecurityRulesClient.Delete. +type SecurityRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityRulesClientGetResponse contains the response from method SecurityRulesClient.Get. +type SecurityRulesClientGetResponse struct { + SecurityRule +} + +// SecurityRulesClientListResponse contains the response from method SecurityRulesClient.List. +type SecurityRulesClientListResponse struct { + SecurityRuleListResult +} + +// ServiceAssociationLinksClientListResponse contains the response from method ServiceAssociationLinksClient.List. +type ServiceAssociationLinksClientListResponse struct { + ServiceAssociationLinksListResult +} + +// ServiceEndpointPoliciesClientCreateOrUpdateResponse contains the response from method ServiceEndpointPoliciesClient.CreateOrUpdate. +type ServiceEndpointPoliciesClientCreateOrUpdateResponse struct { + ServiceEndpointPolicy +} + +// ServiceEndpointPoliciesClientDeleteResponse contains the response from method ServiceEndpointPoliciesClient.Delete. +type ServiceEndpointPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// ServiceEndpointPoliciesClientGetResponse contains the response from method ServiceEndpointPoliciesClient.Get. +type ServiceEndpointPoliciesClientGetResponse struct { + ServiceEndpointPolicy +} + +// ServiceEndpointPoliciesClientListByResourceGroupResponse contains the response from method ServiceEndpointPoliciesClient.ListByResourceGroup. +type ServiceEndpointPoliciesClientListByResourceGroupResponse struct { + ServiceEndpointPolicyListResult +} + +// ServiceEndpointPoliciesClientListResponse contains the response from method ServiceEndpointPoliciesClient.List. +type ServiceEndpointPoliciesClientListResponse struct { + ServiceEndpointPolicyListResult +} + +// ServiceEndpointPoliciesClientUpdateTagsResponse contains the response from method ServiceEndpointPoliciesClient.UpdateTags. +type ServiceEndpointPoliciesClientUpdateTagsResponse struct { + ServiceEndpointPolicy +} + +// ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.CreateOrUpdate. +type ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse struct { + ServiceEndpointPolicyDefinition +} + +// ServiceEndpointPolicyDefinitionsClientDeleteResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.Delete. +type ServiceEndpointPolicyDefinitionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ServiceEndpointPolicyDefinitionsClientGetResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.Get. +type ServiceEndpointPolicyDefinitionsClientGetResponse struct { + ServiceEndpointPolicyDefinition +} + +// ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse contains the response from method ServiceEndpointPolicyDefinitionsClient.ListByResourceGroup. +type ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse struct { + ServiceEndpointPolicyDefinitionListResult +} + +// ServiceTagInformationClientListResponse contains the response from method ServiceTagInformationClient.List. +type ServiceTagInformationClientListResponse struct { + ServiceTagInformationListResult +} + +// ServiceTagsClientListResponse contains the response from method ServiceTagsClient.List. +type ServiceTagsClientListResponse struct { + ServiceTagsListResult +} + +// StaticMembersClientCreateOrUpdateResponse contains the response from method StaticMembersClient.CreateOrUpdate. +type StaticMembersClientCreateOrUpdateResponse struct { + StaticMember +} + +// StaticMembersClientDeleteResponse contains the response from method StaticMembersClient.Delete. +type StaticMembersClientDeleteResponse struct { + // placeholder for future response values +} + +// StaticMembersClientGetResponse contains the response from method StaticMembersClient.Get. +type StaticMembersClientGetResponse struct { + StaticMember +} + +// StaticMembersClientListResponse contains the response from method StaticMembersClient.List. +type StaticMembersClientListResponse struct { + StaticMemberListResult +} + +// SubnetsClientCreateOrUpdateResponse contains the response from method SubnetsClient.CreateOrUpdate. +type SubnetsClientCreateOrUpdateResponse struct { + Subnet +} + +// SubnetsClientDeleteResponse contains the response from method SubnetsClient.Delete. +type SubnetsClientDeleteResponse struct { + // placeholder for future response values +} + +// SubnetsClientGetResponse contains the response from method SubnetsClient.Get. +type SubnetsClientGetResponse struct { + Subnet +} + +// SubnetsClientListResponse contains the response from method SubnetsClient.List. +type SubnetsClientListResponse struct { + SubnetListResult +} + +// SubnetsClientPrepareNetworkPoliciesResponse contains the response from method SubnetsClient.PrepareNetworkPolicies. +type SubnetsClientPrepareNetworkPoliciesResponse struct { + // placeholder for future response values +} + +// SubnetsClientUnprepareNetworkPoliciesResponse contains the response from method SubnetsClient.UnprepareNetworkPolicies. +type SubnetsClientUnprepareNetworkPoliciesResponse struct { + // placeholder for future response values +} + +// SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.CreateOrUpdate. +type SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse struct { + ManagerConnection +} + +// SubscriptionNetworkManagerConnectionsClientDeleteResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.Delete. +type SubscriptionNetworkManagerConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// SubscriptionNetworkManagerConnectionsClientGetResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.Get. +type SubscriptionNetworkManagerConnectionsClientGetResponse struct { + ManagerConnection +} + +// SubscriptionNetworkManagerConnectionsClientListResponse contains the response from method SubscriptionNetworkManagerConnectionsClient.List. +type SubscriptionNetworkManagerConnectionsClientListResponse struct { + ManagerConnectionListResult +} + +// UsagesClientListResponse contains the response from method UsagesClient.List. +type UsagesClientListResponse struct { + UsagesListResult +} + +// VPNConnectionsClientCreateOrUpdateResponse contains the response from method VPNConnectionsClient.CreateOrUpdate. +type VPNConnectionsClientCreateOrUpdateResponse struct { + VPNConnection +} + +// VPNConnectionsClientDeleteResponse contains the response from method VPNConnectionsClient.Delete. +type VPNConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNConnectionsClientGetResponse contains the response from method VPNConnectionsClient.Get. +type VPNConnectionsClientGetResponse struct { + VPNConnection +} + +// VPNConnectionsClientListByVPNGatewayResponse contains the response from method VPNConnectionsClient.ListByVPNGateway. +type VPNConnectionsClientListByVPNGatewayResponse struct { + ListVPNConnectionsResult +} + +// VPNConnectionsClientStartPacketCaptureResponse contains the response from method VPNConnectionsClient.StartPacketCapture. +type VPNConnectionsClientStartPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnectionsClientStartPacketCaptureResponse. +func (v *VPNConnectionsClientStartPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VPNConnectionsClientStopPacketCaptureResponse contains the response from method VPNConnectionsClient.StopPacketCapture. +type VPNConnectionsClientStopPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNConnectionsClientStopPacketCaptureResponse. +func (v *VPNConnectionsClientStopPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VPNGatewaysClientCreateOrUpdateResponse contains the response from method VPNGatewaysClient.CreateOrUpdate. +type VPNGatewaysClientCreateOrUpdateResponse struct { + VPNGateway +} + +// VPNGatewaysClientDeleteResponse contains the response from method VPNGatewaysClient.Delete. +type VPNGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNGatewaysClientGetResponse contains the response from method VPNGatewaysClient.Get. +type VPNGatewaysClientGetResponse struct { + VPNGateway +} + +// VPNGatewaysClientListByResourceGroupResponse contains the response from method VPNGatewaysClient.ListByResourceGroup. +type VPNGatewaysClientListByResourceGroupResponse struct { + ListVPNGatewaysResult +} + +// VPNGatewaysClientListResponse contains the response from method VPNGatewaysClient.List. +type VPNGatewaysClientListResponse struct { + ListVPNGatewaysResult +} + +// VPNGatewaysClientResetResponse contains the response from method VPNGatewaysClient.Reset. +type VPNGatewaysClientResetResponse struct { + VPNGateway +} + +// VPNGatewaysClientStartPacketCaptureResponse contains the response from method VPNGatewaysClient.StartPacketCapture. +type VPNGatewaysClientStartPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewaysClientStartPacketCaptureResponse. +func (v *VPNGatewaysClientStartPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VPNGatewaysClientStopPacketCaptureResponse contains the response from method VPNGatewaysClient.StopPacketCapture. +type VPNGatewaysClientStopPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNGatewaysClientStopPacketCaptureResponse. +func (v *VPNGatewaysClientStopPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VPNGatewaysClientUpdateTagsResponse contains the response from method VPNGatewaysClient.UpdateTags. +type VPNGatewaysClientUpdateTagsResponse struct { + VPNGateway +} + +// VPNLinkConnectionsClientGetIkeSasResponse contains the response from method VPNLinkConnectionsClient.GetIkeSas. +type VPNLinkConnectionsClientGetIkeSasResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VPNLinkConnectionsClientGetIkeSasResponse. +func (v *VPNLinkConnectionsClientGetIkeSasResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VPNLinkConnectionsClientListByVPNConnectionResponse contains the response from method VPNLinkConnectionsClient.ListByVPNConnection. +type VPNLinkConnectionsClientListByVPNConnectionResponse struct { + ListVPNSiteLinkConnectionsResult +} + +// VPNLinkConnectionsClientResetConnectionResponse contains the response from method VPNLinkConnectionsClient.ResetConnection. +type VPNLinkConnectionsClientResetConnectionResponse struct { + // placeholder for future response values +} + +// VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse contains the response from method VPNServerConfigurationsAssociatedWithVirtualWanClient.List. +type VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse struct { + VPNServerConfigurationsResponse +} + +// VPNServerConfigurationsClientCreateOrUpdateResponse contains the response from method VPNServerConfigurationsClient.CreateOrUpdate. +type VPNServerConfigurationsClientCreateOrUpdateResponse struct { + VPNServerConfiguration +} + +// VPNServerConfigurationsClientDeleteResponse contains the response from method VPNServerConfigurationsClient.Delete. +type VPNServerConfigurationsClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNServerConfigurationsClientGetResponse contains the response from method VPNServerConfigurationsClient.Get. +type VPNServerConfigurationsClientGetResponse struct { + VPNServerConfiguration +} + +// VPNServerConfigurationsClientListByResourceGroupResponse contains the response from method VPNServerConfigurationsClient.ListByResourceGroup. +type VPNServerConfigurationsClientListByResourceGroupResponse struct { + ListVPNServerConfigurationsResult +} + +// VPNServerConfigurationsClientListResponse contains the response from method VPNServerConfigurationsClient.List. +type VPNServerConfigurationsClientListResponse struct { + ListVPNServerConfigurationsResult +} + +// VPNServerConfigurationsClientUpdateTagsResponse contains the response from method VPNServerConfigurationsClient.UpdateTags. +type VPNServerConfigurationsClientUpdateTagsResponse struct { + VPNServerConfiguration +} + +// VPNSiteLinkConnectionsClientGetResponse contains the response from method VPNSiteLinkConnectionsClient.Get. +type VPNSiteLinkConnectionsClientGetResponse struct { + VPNSiteLinkConnection +} + +// VPNSiteLinksClientGetResponse contains the response from method VPNSiteLinksClient.Get. +type VPNSiteLinksClientGetResponse struct { + VPNSiteLink +} + +// VPNSiteLinksClientListByVPNSiteResponse contains the response from method VPNSiteLinksClient.ListByVPNSite. +type VPNSiteLinksClientListByVPNSiteResponse struct { + ListVPNSiteLinksResult +} + +// VPNSitesClientCreateOrUpdateResponse contains the response from method VPNSitesClient.CreateOrUpdate. +type VPNSitesClientCreateOrUpdateResponse struct { + VPNSite +} + +// VPNSitesClientDeleteResponse contains the response from method VPNSitesClient.Delete. +type VPNSitesClientDeleteResponse struct { + // placeholder for future response values +} + +// VPNSitesClientGetResponse contains the response from method VPNSitesClient.Get. +type VPNSitesClientGetResponse struct { + VPNSite +} + +// VPNSitesClientListByResourceGroupResponse contains the response from method VPNSitesClient.ListByResourceGroup. +type VPNSitesClientListByResourceGroupResponse struct { + ListVPNSitesResult +} + +// VPNSitesClientListResponse contains the response from method VPNSitesClient.List. +type VPNSitesClientListResponse struct { + ListVPNSitesResult +} + +// VPNSitesClientUpdateTagsResponse contains the response from method VPNSitesClient.UpdateTags. +type VPNSitesClientUpdateTagsResponse struct { + VPNSite +} + +// VPNSitesConfigurationClientDownloadResponse contains the response from method VPNSitesConfigurationClient.Download. +type VPNSitesConfigurationClientDownloadResponse struct { + // placeholder for future response values +} + +// VipSwapClientCreateResponse contains the response from method VipSwapClient.Create. +type VipSwapClientCreateResponse struct { + // placeholder for future response values +} + +// VipSwapClientGetResponse contains the response from method VipSwapClient.Get. +type VipSwapClientGetResponse struct { + SwapResource +} + +// VipSwapClientListResponse contains the response from method VipSwapClient.List. +type VipSwapClientListResponse struct { + SwapResourceListResult +} + +// VirtualApplianceSKUsClientGetResponse contains the response from method VirtualApplianceSKUsClient.Get. +type VirtualApplianceSKUsClientGetResponse struct { + VirtualApplianceSKU +} + +// VirtualApplianceSKUsClientListResponse contains the response from method VirtualApplianceSKUsClient.List. +type VirtualApplianceSKUsClientListResponse struct { + VirtualApplianceSKUListResult +} + +// VirtualApplianceSitesClientCreateOrUpdateResponse contains the response from method VirtualApplianceSitesClient.CreateOrUpdate. +type VirtualApplianceSitesClientCreateOrUpdateResponse struct { + VirtualApplianceSite +} + +// VirtualApplianceSitesClientDeleteResponse contains the response from method VirtualApplianceSitesClient.Delete. +type VirtualApplianceSitesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualApplianceSitesClientGetResponse contains the response from method VirtualApplianceSitesClient.Get. +type VirtualApplianceSitesClientGetResponse struct { + VirtualApplianceSite +} + +// VirtualApplianceSitesClientListResponse contains the response from method VirtualApplianceSitesClient.List. +type VirtualApplianceSitesClientListResponse struct { + VirtualApplianceSiteListResult +} + +// VirtualAppliancesClientCreateOrUpdateResponse contains the response from method VirtualAppliancesClient.CreateOrUpdate. +type VirtualAppliancesClientCreateOrUpdateResponse struct { + VirtualAppliance +} + +// VirtualAppliancesClientDeleteResponse contains the response from method VirtualAppliancesClient.Delete. +type VirtualAppliancesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualAppliancesClientGetResponse contains the response from method VirtualAppliancesClient.Get. +type VirtualAppliancesClientGetResponse struct { + VirtualAppliance +} + +// VirtualAppliancesClientListByResourceGroupResponse contains the response from method VirtualAppliancesClient.ListByResourceGroup. +type VirtualAppliancesClientListByResourceGroupResponse struct { + VirtualApplianceListResult +} + +// VirtualAppliancesClientListResponse contains the response from method VirtualAppliancesClient.List. +type VirtualAppliancesClientListResponse struct { + VirtualApplianceListResult +} + +// VirtualAppliancesClientUpdateTagsResponse contains the response from method VirtualAppliancesClient.UpdateTags. +type VirtualAppliancesClientUpdateTagsResponse struct { + VirtualAppliance +} + +// VirtualHubBgpConnectionClientCreateOrUpdateResponse contains the response from method VirtualHubBgpConnectionClient.CreateOrUpdate. +type VirtualHubBgpConnectionClientCreateOrUpdateResponse struct { + BgpConnection +} + +// VirtualHubBgpConnectionClientDeleteResponse contains the response from method VirtualHubBgpConnectionClient.Delete. +type VirtualHubBgpConnectionClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubBgpConnectionClientGetResponse contains the response from method VirtualHubBgpConnectionClient.Get. +type VirtualHubBgpConnectionClientGetResponse struct { + BgpConnection +} + +// VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse contains the response from method VirtualHubBgpConnectionsClient.ListAdvertisedRoutes. +type VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse struct { + PeerRouteList +} + +// VirtualHubBgpConnectionsClientListLearnedRoutesResponse contains the response from method VirtualHubBgpConnectionsClient.ListLearnedRoutes. +type VirtualHubBgpConnectionsClientListLearnedRoutesResponse struct { + PeerRouteList +} + +// VirtualHubBgpConnectionsClientListResponse contains the response from method VirtualHubBgpConnectionsClient.List. +type VirtualHubBgpConnectionsClientListResponse struct { + ListVirtualHubBgpConnectionResults +} + +// VirtualHubIPConfigurationClientCreateOrUpdateResponse contains the response from method VirtualHubIPConfigurationClient.CreateOrUpdate. +type VirtualHubIPConfigurationClientCreateOrUpdateResponse struct { + HubIPConfiguration +} + +// VirtualHubIPConfigurationClientDeleteResponse contains the response from method VirtualHubIPConfigurationClient.Delete. +type VirtualHubIPConfigurationClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubIPConfigurationClientGetResponse contains the response from method VirtualHubIPConfigurationClient.Get. +type VirtualHubIPConfigurationClientGetResponse struct { + HubIPConfiguration +} + +// VirtualHubIPConfigurationClientListResponse contains the response from method VirtualHubIPConfigurationClient.List. +type VirtualHubIPConfigurationClientListResponse struct { + ListVirtualHubIPConfigurationResults +} + +// VirtualHubRouteTableV2SClientCreateOrUpdateResponse contains the response from method VirtualHubRouteTableV2SClient.CreateOrUpdate. +type VirtualHubRouteTableV2SClientCreateOrUpdateResponse struct { + VirtualHubRouteTableV2 +} + +// VirtualHubRouteTableV2SClientDeleteResponse contains the response from method VirtualHubRouteTableV2SClient.Delete. +type VirtualHubRouteTableV2SClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubRouteTableV2SClientGetResponse contains the response from method VirtualHubRouteTableV2SClient.Get. +type VirtualHubRouteTableV2SClientGetResponse struct { + VirtualHubRouteTableV2 +} + +// VirtualHubRouteTableV2SClientListResponse contains the response from method VirtualHubRouteTableV2SClient.List. +type VirtualHubRouteTableV2SClientListResponse struct { + ListVirtualHubRouteTableV2SResult +} + +// VirtualHubsClientCreateOrUpdateResponse contains the response from method VirtualHubsClient.CreateOrUpdate. +type VirtualHubsClientCreateOrUpdateResponse struct { + VirtualHub +} + +// VirtualHubsClientDeleteResponse contains the response from method VirtualHubsClient.Delete. +type VirtualHubsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualHubsClientGetEffectiveVirtualHubRoutesResponse contains the response from method VirtualHubsClient.GetEffectiveVirtualHubRoutes. +type VirtualHubsClientGetEffectiveVirtualHubRoutesResponse struct { + // placeholder for future response values +} + +// VirtualHubsClientGetInboundRoutesResponse contains the response from method VirtualHubsClient.GetInboundRoutes. +type VirtualHubsClientGetInboundRoutesResponse struct { + // placeholder for future response values +} + +// VirtualHubsClientGetOutboundRoutesResponse contains the response from method VirtualHubsClient.GetOutboundRoutes. +type VirtualHubsClientGetOutboundRoutesResponse struct { + // placeholder for future response values +} + +// VirtualHubsClientGetResponse contains the response from method VirtualHubsClient.Get. +type VirtualHubsClientGetResponse struct { + VirtualHub +} + +// VirtualHubsClientListByResourceGroupResponse contains the response from method VirtualHubsClient.ListByResourceGroup. +type VirtualHubsClientListByResourceGroupResponse struct { + ListVirtualHubsResult +} + +// VirtualHubsClientListResponse contains the response from method VirtualHubsClient.List. +type VirtualHubsClientListResponse struct { + ListVirtualHubsResult +} + +// VirtualHubsClientUpdateTagsResponse contains the response from method VirtualHubsClient.UpdateTags. +type VirtualHubsClientUpdateTagsResponse struct { + VirtualHub +} + +// VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewayConnectionsClient.CreateOrUpdate. +type VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse struct { + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayConnectionsClientDeleteResponse contains the response from method VirtualNetworkGatewayConnectionsClient.Delete. +type VirtualNetworkGatewayConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayConnectionsClientGetIkeSasResponse contains the response from method VirtualNetworkGatewayConnectionsClient.GetIkeSas. +type VirtualNetworkGatewayConnectionsClientGetIkeSasResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionsClientGetIkeSasResponse. +func (v *VirtualNetworkGatewayConnectionsClientGetIkeSasResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewayConnectionsClientGetResponse contains the response from method VirtualNetworkGatewayConnectionsClient.Get. +type VirtualNetworkGatewayConnectionsClientGetResponse struct { + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.GetSharedKey. +type VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse struct { + ConnectionSharedKey +} + +// VirtualNetworkGatewayConnectionsClientListResponse contains the response from method VirtualNetworkGatewayConnectionsClient.List. +type VirtualNetworkGatewayConnectionsClientListResponse struct { + VirtualNetworkGatewayConnectionListResult +} + +// VirtualNetworkGatewayConnectionsClientResetConnectionResponse contains the response from method VirtualNetworkGatewayConnectionsClient.ResetConnection. +type VirtualNetworkGatewayConnectionsClientResetConnectionResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.ResetSharedKey. +type VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse struct { + ConnectionResetSharedKey +} + +// VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse contains the response from method VirtualNetworkGatewayConnectionsClient.SetSharedKey. +type VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse struct { + ConnectionSharedKey +} + +// VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse contains the response from method VirtualNetworkGatewayConnectionsClient.StartPacketCapture. +type VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse. +func (v *VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse contains the response from method VirtualNetworkGatewayConnectionsClient.StopPacketCapture. +type VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse. +func (v *VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewayConnectionsClientUpdateTagsResponse contains the response from method VirtualNetworkGatewayConnectionsClient.UpdateTags. +type VirtualNetworkGatewayConnectionsClientUpdateTagsResponse struct { + VirtualNetworkGatewayConnection +} + +// VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewayNatRulesClient.CreateOrUpdate. +type VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse struct { + VirtualNetworkGatewayNatRule +} + +// VirtualNetworkGatewayNatRulesClientDeleteResponse contains the response from method VirtualNetworkGatewayNatRulesClient.Delete. +type VirtualNetworkGatewayNatRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewayNatRulesClientGetResponse contains the response from method VirtualNetworkGatewayNatRulesClient.Get. +type VirtualNetworkGatewayNatRulesClientGetResponse struct { + VirtualNetworkGatewayNatRule +} + +// VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse contains the response from method VirtualNetworkGatewayNatRulesClient.ListByVirtualNetworkGateway. +type VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse struct { + ListVirtualNetworkGatewayNatRulesResult +} + +// VirtualNetworkGatewaysClientCreateOrUpdateResponse contains the response from method VirtualNetworkGatewaysClient.CreateOrUpdate. +type VirtualNetworkGatewaysClientCreateOrUpdateResponse struct { + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientDeleteResponse contains the response from method VirtualNetworkGatewaysClient.Delete. +type VirtualNetworkGatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse contains the response from method VirtualNetworkGatewaysClient.DisconnectVirtualNetworkGatewayVPNConnections. +type VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientGenerateVPNProfileResponse contains the response from method VirtualNetworkGatewaysClient.GenerateVPNProfile. +type VirtualNetworkGatewaysClientGenerateVPNProfileResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaysClientGenerateVPNProfileResponse. +func (v *VirtualNetworkGatewaysClientGenerateVPNProfileResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse contains the response from method VirtualNetworkGatewaysClient.Generatevpnclientpackage. +type VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse. +func (v *VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse contains the response from method VirtualNetworkGatewaysClient.GetAdvertisedRoutes. +type VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse struct { + GatewayRouteListResult +} + +// VirtualNetworkGatewaysClientGetBgpPeerStatusResponse contains the response from method VirtualNetworkGatewaysClient.GetBgpPeerStatus. +type VirtualNetworkGatewaysClientGetBgpPeerStatusResponse struct { + BgpPeerStatusListResult +} + +// VirtualNetworkGatewaysClientGetLearnedRoutesResponse contains the response from method VirtualNetworkGatewaysClient.GetLearnedRoutes. +type VirtualNetworkGatewaysClientGetLearnedRoutesResponse struct { + GatewayRouteListResult +} + +// VirtualNetworkGatewaysClientGetResponse contains the response from method VirtualNetworkGatewaysClient.Get. +type VirtualNetworkGatewaysClientGetResponse struct { + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse contains the response from method VirtualNetworkGatewaysClient.GetVPNProfilePackageURL. +type VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse. +func (v *VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse contains the response from method VirtualNetworkGatewaysClient.GetVpnclientConnectionHealth. +type VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse struct { + VPNClientConnectionHealthDetailListResult +} + +// VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse contains the response from method VirtualNetworkGatewaysClient.GetVpnclientIPSecParameters. +type VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse struct { + VPNClientIPsecParameters +} + +// VirtualNetworkGatewaysClientListConnectionsResponse contains the response from method VirtualNetworkGatewaysClient.ListConnections. +type VirtualNetworkGatewaysClientListConnectionsResponse struct { + VirtualNetworkGatewayListConnectionsResult +} + +// VirtualNetworkGatewaysClientListResponse contains the response from method VirtualNetworkGatewaysClient.List. +type VirtualNetworkGatewaysClientListResponse struct { + VirtualNetworkGatewayListResult +} + +// VirtualNetworkGatewaysClientResetResponse contains the response from method VirtualNetworkGatewaysClient.Reset. +type VirtualNetworkGatewaysClientResetResponse struct { + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse contains the response from method VirtualNetworkGatewaysClient.ResetVPNClientSharedKey. +type VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse struct { + // placeholder for future response values +} + +// VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse contains the response from method VirtualNetworkGatewaysClient.SetVpnclientIPSecParameters. +type VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse struct { + VPNClientIPsecParameters +} + +// VirtualNetworkGatewaysClientStartPacketCaptureResponse contains the response from method VirtualNetworkGatewaysClient.StartPacketCapture. +type VirtualNetworkGatewaysClientStartPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaysClientStartPacketCaptureResponse. +func (v *VirtualNetworkGatewaysClientStartPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewaysClientStopPacketCaptureResponse contains the response from method VirtualNetworkGatewaysClient.StopPacketCapture. +type VirtualNetworkGatewaysClientStopPacketCaptureResponse struct { + Value *string +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkGatewaysClientStopPacketCaptureResponse. +func (v *VirtualNetworkGatewaysClientStopPacketCaptureResponse) UnmarshalJSON(data []byte) error { + return json.Unmarshal(data, &v.Value) +} + +// VirtualNetworkGatewaysClientSupportedVPNDevicesResponse contains the response from method VirtualNetworkGatewaysClient.SupportedVPNDevices. +type VirtualNetworkGatewaysClientSupportedVPNDevicesResponse struct { + Value *string +} + +// VirtualNetworkGatewaysClientUpdateTagsResponse contains the response from method VirtualNetworkGatewaysClient.UpdateTags. +type VirtualNetworkGatewaysClientUpdateTagsResponse struct { + VirtualNetworkGateway +} + +// VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse contains the response from method VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript. +type VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse struct { + Value *string +} + +// VirtualNetworkPeeringsClientCreateOrUpdateResponse contains the response from method VirtualNetworkPeeringsClient.CreateOrUpdate. +type VirtualNetworkPeeringsClientCreateOrUpdateResponse struct { + VirtualNetworkPeering +} + +// VirtualNetworkPeeringsClientDeleteResponse contains the response from method VirtualNetworkPeeringsClient.Delete. +type VirtualNetworkPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkPeeringsClientGetResponse contains the response from method VirtualNetworkPeeringsClient.Get. +type VirtualNetworkPeeringsClientGetResponse struct { + VirtualNetworkPeering +} + +// VirtualNetworkPeeringsClientListResponse contains the response from method VirtualNetworkPeeringsClient.List. +type VirtualNetworkPeeringsClientListResponse struct { + VirtualNetworkPeeringListResult +} + +// VirtualNetworkTapsClientCreateOrUpdateResponse contains the response from method VirtualNetworkTapsClient.CreateOrUpdate. +type VirtualNetworkTapsClientCreateOrUpdateResponse struct { + VirtualNetworkTap +} + +// VirtualNetworkTapsClientDeleteResponse contains the response from method VirtualNetworkTapsClient.Delete. +type VirtualNetworkTapsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworkTapsClientGetResponse contains the response from method VirtualNetworkTapsClient.Get. +type VirtualNetworkTapsClientGetResponse struct { + VirtualNetworkTap +} + +// VirtualNetworkTapsClientListAllResponse contains the response from method VirtualNetworkTapsClient.ListAll. +type VirtualNetworkTapsClientListAllResponse struct { + VirtualNetworkTapListResult +} + +// VirtualNetworkTapsClientListByResourceGroupResponse contains the response from method VirtualNetworkTapsClient.ListByResourceGroup. +type VirtualNetworkTapsClientListByResourceGroupResponse struct { + VirtualNetworkTapListResult +} + +// VirtualNetworkTapsClientUpdateTagsResponse contains the response from method VirtualNetworkTapsClient.UpdateTags. +type VirtualNetworkTapsClientUpdateTagsResponse struct { + VirtualNetworkTap +} + +// VirtualNetworksClientCheckIPAddressAvailabilityResponse contains the response from method VirtualNetworksClient.CheckIPAddressAvailability. +type VirtualNetworksClientCheckIPAddressAvailabilityResponse struct { + IPAddressAvailabilityResult +} + +// VirtualNetworksClientCreateOrUpdateResponse contains the response from method VirtualNetworksClient.CreateOrUpdate. +type VirtualNetworksClientCreateOrUpdateResponse struct { + VirtualNetwork +} + +// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.Delete. +type VirtualNetworksClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworksClientGetResponse contains the response from method VirtualNetworksClient.Get. +type VirtualNetworksClientGetResponse struct { + VirtualNetwork +} + +// VirtualNetworksClientListAllResponse contains the response from method VirtualNetworksClient.ListAll. +type VirtualNetworksClientListAllResponse struct { + VirtualNetworkListResult +} + +// VirtualNetworksClientListDdosProtectionStatusResponse contains the response from method VirtualNetworksClient.ListDdosProtectionStatus. +type VirtualNetworksClientListDdosProtectionStatusResponse struct { + VirtualNetworkDdosProtectionStatusResult +} + +// VirtualNetworksClientListResponse contains the response from method VirtualNetworksClient.List. +type VirtualNetworksClientListResponse struct { + VirtualNetworkListResult +} + +// VirtualNetworksClientListUsageResponse contains the response from method VirtualNetworksClient.ListUsage. +type VirtualNetworksClientListUsageResponse struct { + VirtualNetworkListUsageResult +} + +// VirtualNetworksClientUpdateTagsResponse contains the response from method VirtualNetworksClient.UpdateTags. +type VirtualNetworksClientUpdateTagsResponse struct { + VirtualNetwork +} + +// VirtualRouterPeeringsClientCreateOrUpdateResponse contains the response from method VirtualRouterPeeringsClient.CreateOrUpdate. +type VirtualRouterPeeringsClientCreateOrUpdateResponse struct { + VirtualRouterPeering +} + +// VirtualRouterPeeringsClientDeleteResponse contains the response from method VirtualRouterPeeringsClient.Delete. +type VirtualRouterPeeringsClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualRouterPeeringsClientGetResponse contains the response from method VirtualRouterPeeringsClient.Get. +type VirtualRouterPeeringsClientGetResponse struct { + VirtualRouterPeering +} + +// VirtualRouterPeeringsClientListResponse contains the response from method VirtualRouterPeeringsClient.List. +type VirtualRouterPeeringsClientListResponse struct { + VirtualRouterPeeringListResult +} + +// VirtualRoutersClientCreateOrUpdateResponse contains the response from method VirtualRoutersClient.CreateOrUpdate. +type VirtualRoutersClientCreateOrUpdateResponse struct { + VirtualRouter +} + +// VirtualRoutersClientDeleteResponse contains the response from method VirtualRoutersClient.Delete. +type VirtualRoutersClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualRoutersClientGetResponse contains the response from method VirtualRoutersClient.Get. +type VirtualRoutersClientGetResponse struct { + VirtualRouter +} + +// VirtualRoutersClientListByResourceGroupResponse contains the response from method VirtualRoutersClient.ListByResourceGroup. +type VirtualRoutersClientListByResourceGroupResponse struct { + VirtualRouterListResult +} + +// VirtualRoutersClientListResponse contains the response from method VirtualRoutersClient.List. +type VirtualRoutersClientListResponse struct { + VirtualRouterListResult +} + +// VirtualWansClientCreateOrUpdateResponse contains the response from method VirtualWansClient.CreateOrUpdate. +type VirtualWansClientCreateOrUpdateResponse struct { + VirtualWAN +} + +// VirtualWansClientDeleteResponse contains the response from method VirtualWansClient.Delete. +type VirtualWansClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualWansClientGetResponse contains the response from method VirtualWansClient.Get. +type VirtualWansClientGetResponse struct { + VirtualWAN +} + +// VirtualWansClientListByResourceGroupResponse contains the response from method VirtualWansClient.ListByResourceGroup. +type VirtualWansClientListByResourceGroupResponse struct { + ListVirtualWANsResult +} + +// VirtualWansClientListResponse contains the response from method VirtualWansClient.List. +type VirtualWansClientListResponse struct { + ListVirtualWANsResult +} + +// VirtualWansClientUpdateTagsResponse contains the response from method VirtualWansClient.UpdateTags. +type VirtualWansClientUpdateTagsResponse struct { + VirtualWAN +} + +// WatchersClientCheckConnectivityResponse contains the response from method WatchersClient.CheckConnectivity. +type WatchersClientCheckConnectivityResponse struct { + ConnectivityInformation +} + +// WatchersClientCreateOrUpdateResponse contains the response from method WatchersClient.CreateOrUpdate. +type WatchersClientCreateOrUpdateResponse struct { + Watcher +} + +// WatchersClientDeleteResponse contains the response from method WatchersClient.Delete. +type WatchersClientDeleteResponse struct { + // placeholder for future response values +} + +// WatchersClientGetAzureReachabilityReportResponse contains the response from method WatchersClient.GetAzureReachabilityReport. +type WatchersClientGetAzureReachabilityReportResponse struct { + AzureReachabilityReport +} + +// WatchersClientGetFlowLogStatusResponse contains the response from method WatchersClient.GetFlowLogStatus. +type WatchersClientGetFlowLogStatusResponse struct { + FlowLogInformation +} + +// WatchersClientGetNetworkConfigurationDiagnosticResponse contains the response from method WatchersClient.GetNetworkConfigurationDiagnostic. +type WatchersClientGetNetworkConfigurationDiagnosticResponse struct { + ConfigurationDiagnosticResponse +} + +// WatchersClientGetNextHopResponse contains the response from method WatchersClient.GetNextHop. +type WatchersClientGetNextHopResponse struct { + NextHopResult +} + +// WatchersClientGetResponse contains the response from method WatchersClient.Get. +type WatchersClientGetResponse struct { + Watcher +} + +// WatchersClientGetTopologyResponse contains the response from method WatchersClient.GetTopology. +type WatchersClientGetTopologyResponse struct { + Topology +} + +// WatchersClientGetTroubleshootingResponse contains the response from method WatchersClient.GetTroubleshooting. +type WatchersClientGetTroubleshootingResponse struct { + TroubleshootingResult +} + +// WatchersClientGetTroubleshootingResultResponse contains the response from method WatchersClient.GetTroubleshootingResult. +type WatchersClientGetTroubleshootingResultResponse struct { + TroubleshootingResult +} + +// WatchersClientGetVMSecurityRulesResponse contains the response from method WatchersClient.GetVMSecurityRules. +type WatchersClientGetVMSecurityRulesResponse struct { + SecurityGroupViewResult +} + +// WatchersClientListAllResponse contains the response from method WatchersClient.ListAll. +type WatchersClientListAllResponse struct { + WatcherListResult +} + +// WatchersClientListAvailableProvidersResponse contains the response from method WatchersClient.ListAvailableProviders. +type WatchersClientListAvailableProvidersResponse struct { + AvailableProvidersList +} + +// WatchersClientListResponse contains the response from method WatchersClient.List. +type WatchersClientListResponse struct { + WatcherListResult +} + +// WatchersClientSetFlowLogConfigurationResponse contains the response from method WatchersClient.SetFlowLogConfiguration. +type WatchersClientSetFlowLogConfigurationResponse struct { + FlowLogInformation +} + +// WatchersClientUpdateTagsResponse contains the response from method WatchersClient.UpdateTags. +type WatchersClientUpdateTagsResponse struct { + Watcher +} + +// WatchersClientVerifyIPFlowResponse contains the response from method WatchersClient.VerifyIPFlow. +type WatchersClientVerifyIPFlowResponse struct { + VerificationIPFlowResult +} + +// WebApplicationFirewallPoliciesClientCreateOrUpdateResponse contains the response from method WebApplicationFirewallPoliciesClient.CreateOrUpdate. +type WebApplicationFirewallPoliciesClientCreateOrUpdateResponse struct { + WebApplicationFirewallPolicy +} + +// WebApplicationFirewallPoliciesClientDeleteResponse contains the response from method WebApplicationFirewallPoliciesClient.Delete. +type WebApplicationFirewallPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// WebApplicationFirewallPoliciesClientGetResponse contains the response from method WebApplicationFirewallPoliciesClient.Get. +type WebApplicationFirewallPoliciesClientGetResponse struct { + WebApplicationFirewallPolicy +} + +// WebApplicationFirewallPoliciesClientListAllResponse contains the response from method WebApplicationFirewallPoliciesClient.ListAll. +type WebApplicationFirewallPoliciesClientListAllResponse struct { + WebApplicationFirewallPolicyListResult +} + +// WebApplicationFirewallPoliciesClientListResponse contains the response from method WebApplicationFirewallPoliciesClient.List. +type WebApplicationFirewallPoliciesClientListResponse struct { + WebApplicationFirewallPolicyListResult +} + +// WebCategoriesClientGetResponse contains the response from method WebCategoriesClient.Get. +type WebCategoriesClientGetResponse struct { + AzureWebCategory +} + +// WebCategoriesClientListBySubscriptionResponse contains the response from method WebCategoriesClient.ListBySubscription. +type WebCategoriesClientListBySubscriptionResponse struct { + AzureWebCategoryListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilterrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilterrules_client.go new file mode 100644 index 000000000..91b03f89e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilterrules_client.go @@ -0,0 +1,328 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RouteFilterRulesClient contains the methods for the RouteFilterRules group. +// Don't use this type directly, use NewRouteFilterRulesClient() instead. +type RouteFilterRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRouteFilterRulesClient creates a new instance of RouteFilterRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRouteFilterRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RouteFilterRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RouteFilterRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a route in the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// ruleName - The name of the route filter rule. +// routeFilterRuleParameters - Parameters supplied to the create or update route filter rule operation. +// options - RouteFilterRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteFilterRulesClient.BeginCreateOrUpdate +// method. +func (client *RouteFilterRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, options *RouteFilterRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[RouteFilterRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteFilterRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteFilterRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a route in the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteFilterRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, options *RouteFilterRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RouteFilterRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, options *RouteFilterRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routeFilterRuleParameters) +} + +// BeginDelete - Deletes the specified rule from a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// ruleName - The name of the rule. +// options - RouteFilterRulesClientBeginDeleteOptions contains the optional parameters for the RouteFilterRulesClient.BeginDelete +// method. +func (client *RouteFilterRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientBeginDeleteOptions) (*runtime.Poller[RouteFilterRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, routeFilterName, ruleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteFilterRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteFilterRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified rule from a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteFilterRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RouteFilterRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified rule from a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// ruleName - The name of the rule. +// options - RouteFilterRulesClientGetOptions contains the optional parameters for the RouteFilterRulesClient.Get method. +func (client *RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientGetOptions) (RouteFilterRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, routeFilterName, ruleName, options) + if err != nil { + return RouteFilterRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFilterRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFilterRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RouteFilterRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, options *RouteFilterRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if ruleName == "" { + return nil, errors.New("parameter ruleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RouteFilterRulesClient) getHandleResponse(resp *http.Response) (RouteFilterRulesClientGetResponse, error) { + result := RouteFilterRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterRule); err != nil { + return RouteFilterRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByRouteFilterPager - Gets all RouteFilterRules in a route filter. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// options - RouteFilterRulesClientListByRouteFilterOptions contains the optional parameters for the RouteFilterRulesClient.ListByRouteFilter +// method. +func (client *RouteFilterRulesClient) NewListByRouteFilterPager(resourceGroupName string, routeFilterName string, options *RouteFilterRulesClientListByRouteFilterOptions) *runtime.Pager[RouteFilterRulesClientListByRouteFilterResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteFilterRulesClientListByRouteFilterResponse]{ + More: func(page RouteFilterRulesClientListByRouteFilterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteFilterRulesClientListByRouteFilterResponse) (RouteFilterRulesClientListByRouteFilterResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByRouteFilterCreateRequest(ctx, resourceGroupName, routeFilterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteFilterRulesClientListByRouteFilterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFilterRulesClientListByRouteFilterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFilterRulesClientListByRouteFilterResponse{}, runtime.NewResponseError(resp) + } + return client.listByRouteFilterHandleResponse(resp) + }, + }) +} + +// listByRouteFilterCreateRequest creates the ListByRouteFilter request. +func (client *RouteFilterRulesClient) listByRouteFilterCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFilterRulesClientListByRouteFilterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByRouteFilterHandleResponse handles the ListByRouteFilter response. +func (client *RouteFilterRulesClient) listByRouteFilterHandleResponse(resp *http.Response) (RouteFilterRulesClientListByRouteFilterResponse, error) { + result := RouteFilterRulesClientListByRouteFilterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterRuleListResult); err != nil { + return RouteFilterRulesClientListByRouteFilterResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilters_client.go new file mode 100644 index 000000000..28b08b8e0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routefilters_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RouteFiltersClient contains the methods for the RouteFilters group. +// Don't use this type directly, use NewRouteFiltersClient() instead. +type RouteFiltersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRouteFiltersClient creates a new instance of RouteFiltersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRouteFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RouteFiltersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RouteFiltersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a route filter in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// routeFilterParameters - Parameters supplied to the create or update route filter operation. +// options - RouteFiltersClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteFiltersClient.BeginCreateOrUpdate +// method. +func (client *RouteFiltersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, options *RouteFiltersClientBeginCreateOrUpdateOptions) (*runtime.Poller[RouteFiltersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, routeFilterName, routeFilterParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteFiltersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteFiltersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a route filter in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteFiltersClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, options *RouteFiltersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeFilterName, routeFilterParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RouteFiltersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, options *RouteFiltersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routeFilterParameters) +} + +// BeginDelete - Deletes the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// options - RouteFiltersClientBeginDeleteOptions contains the optional parameters for the RouteFiltersClient.BeginDelete +// method. +func (client *RouteFiltersClient) BeginDelete(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientBeginDeleteOptions) (*runtime.Poller[RouteFiltersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, routeFilterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteFiltersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteFiltersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteFiltersClient) deleteOperation(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeFilterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RouteFiltersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// options - RouteFiltersClientGetOptions contains the optional parameters for the RouteFiltersClient.Get method. +func (client *RouteFiltersClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientGetOptions) (RouteFiltersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, routeFilterName, options) + if err != nil { + return RouteFiltersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFiltersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFiltersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RouteFiltersClient) getCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, options *RouteFiltersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RouteFiltersClient) getHandleResponse(resp *http.Response) (RouteFiltersClientGetResponse, error) { + result := RouteFiltersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilter); err != nil { + return RouteFiltersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all route filters in a subscription. +// Generated from API version 2022-05-01 +// options - RouteFiltersClientListOptions contains the optional parameters for the RouteFiltersClient.List method. +func (client *RouteFiltersClient) NewListPager(options *RouteFiltersClientListOptions) *runtime.Pager[RouteFiltersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteFiltersClientListResponse]{ + More: func(page RouteFiltersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteFiltersClientListResponse) (RouteFiltersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteFiltersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFiltersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RouteFiltersClient) listCreateRequest(ctx context.Context, options *RouteFiltersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RouteFiltersClient) listHandleResponse(resp *http.Response) (RouteFiltersClientListResponse, error) { + result := RouteFiltersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterListResult); err != nil { + return RouteFiltersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all route filters in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - RouteFiltersClientListByResourceGroupOptions contains the optional parameters for the RouteFiltersClient.ListByResourceGroup +// method. +func (client *RouteFiltersClient) NewListByResourceGroupPager(resourceGroupName string, options *RouteFiltersClientListByResourceGroupOptions) *runtime.Pager[RouteFiltersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteFiltersClientListByResourceGroupResponse]{ + More: func(page RouteFiltersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteFiltersClientListByResourceGroupResponse) (RouteFiltersClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteFiltersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFiltersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFiltersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *RouteFiltersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RouteFiltersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *RouteFiltersClient) listByResourceGroupHandleResponse(resp *http.Response) (RouteFiltersClientListByResourceGroupResponse, error) { + result := RouteFiltersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterListResult); err != nil { + return RouteFiltersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags of a route filter. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeFilterName - The name of the route filter. +// parameters - Parameters supplied to update route filter tags. +// options - RouteFiltersClientUpdateTagsOptions contains the optional parameters for the RouteFiltersClient.UpdateTags method. +func (client *RouteFiltersClient) UpdateTags(ctx context.Context, resourceGroupName string, routeFilterName string, parameters TagsObject, options *RouteFiltersClientUpdateTagsOptions) (RouteFiltersClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, routeFilterName, parameters, options) + if err != nil { + return RouteFiltersClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteFiltersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteFiltersClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *RouteFiltersClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, routeFilterName string, parameters TagsObject, options *RouteFiltersClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeFilterName == "" { + return nil, errors.New("parameter routeFilterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeFilterName}", url.PathEscape(routeFilterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *RouteFiltersClient) updateTagsHandleResponse(resp *http.Response) (RouteFiltersClientUpdateTagsResponse, error) { + result := RouteFiltersClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilter); err != nil { + return RouteFiltersClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routemaps_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routemaps_client.go new file mode 100644 index 000000000..767ea8e83 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routemaps_client.go @@ -0,0 +1,326 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RouteMapsClient contains the methods for the RouteMaps group. +// Don't use this type directly, use NewRouteMapsClient() instead. +type RouteMapsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRouteMapsClient creates a new instance of RouteMapsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRouteMapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RouteMapsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RouteMapsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a RouteMap if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RouteMap's resource group. +// virtualHubName - The name of the VirtualHub containing the RouteMap. +// routeMapName - The name of the RouteMap. +// routeMapParameters - Parameters supplied to create or update a RouteMap. +// options - RouteMapsClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteMapsClient.BeginCreateOrUpdate +// method. +func (client *RouteMapsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, routeMapParameters RouteMap, options *RouteMapsClientBeginCreateOrUpdateOptions) (*runtime.Poller[RouteMapsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, routeMapName, routeMapParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteMapsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteMapsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a RouteMap if it doesn't exist else updates the existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteMapsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, routeMapParameters RouteMap, options *RouteMapsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, routeMapParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RouteMapsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, routeMapParameters RouteMap, options *RouteMapsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeMapName == "" { + return nil, errors.New("parameter routeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeMapName}", url.PathEscape(routeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routeMapParameters) +} + +// BeginDelete - Deletes a RouteMap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RouteMap's resource group. +// virtualHubName - The name of the VirtualHub containing the RouteMap. +// routeMapName - The name of the RouteMap. +// options - RouteMapsClientBeginDeleteOptions contains the optional parameters for the RouteMapsClient.BeginDelete method. +func (client *RouteMapsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientBeginDeleteOptions) (*runtime.Poller[RouteMapsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, routeMapName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteMapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteMapsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a RouteMap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RouteMapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeMapName == "" { + return nil, errors.New("parameter routeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeMapName}", url.PathEscape(routeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a RouteMap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RouteMap's resource group. +// virtualHubName - The name of the VirtualHub containing the RouteMap. +// routeMapName - The name of the RouteMap. +// options - RouteMapsClientGetOptions contains the optional parameters for the RouteMapsClient.Get method. +func (client *RouteMapsClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientGetOptions) (RouteMapsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeMapName, options) + if err != nil { + return RouteMapsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteMapsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteMapsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RouteMapsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeMapName string, options *RouteMapsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeMapName == "" { + return nil, errors.New("parameter routeMapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeMapName}", url.PathEscape(routeMapName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RouteMapsClient) getHandleResponse(resp *http.Response) (RouteMapsClientGetResponse, error) { + result := RouteMapsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteMap); err != nil { + return RouteMapsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all RouteMaps. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RouteMap's resource group'. +// virtualHubName - The name of the VirtualHub containing the RouteMap. +// options - RouteMapsClientListOptions contains the optional parameters for the RouteMapsClient.List method. +func (client *RouteMapsClient) NewListPager(resourceGroupName string, virtualHubName string, options *RouteMapsClientListOptions) *runtime.Pager[RouteMapsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteMapsClientListResponse]{ + More: func(page RouteMapsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteMapsClientListResponse) (RouteMapsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteMapsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteMapsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteMapsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RouteMapsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *RouteMapsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RouteMapsClient) listHandleResponse(resp *http.Response) (RouteMapsClientListResponse, error) { + result := RouteMapsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListRouteMapsResult); err != nil { + return RouteMapsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routes_client.go new file mode 100644 index 000000000..8bf3e15f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routes_client.go @@ -0,0 +1,326 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoutesClient contains the methods for the Routes group. +// Don't use this type directly, use NewRoutesClient() instead. +type RoutesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRoutesClient creates a new instance of RoutesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRoutesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RoutesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RoutesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a route in the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// routeName - The name of the route. +// routeParameters - Parameters supplied to the create or update route operation. +// options - RoutesClientBeginCreateOrUpdateOptions contains the optional parameters for the RoutesClient.BeginCreateOrUpdate +// method. +func (client *RoutesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route, options *RoutesClientBeginCreateOrUpdateOptions) (*runtime.Poller[RoutesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, routeTableName, routeName, routeParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RoutesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RoutesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a route in the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RoutesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route, options *RoutesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeTableName, routeName, routeParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RoutesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route, options *RoutesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if routeName == "" { + return nil, errors.New("parameter routeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeName}", url.PathEscape(routeName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routeParameters) +} + +// BeginDelete - Deletes the specified route from a route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// routeName - The name of the route. +// options - RoutesClientBeginDeleteOptions contains the optional parameters for the RoutesClient.BeginDelete method. +func (client *RoutesClient) BeginDelete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientBeginDeleteOptions) (*runtime.Poller[RoutesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, routeTableName, routeName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RoutesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RoutesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified route from a route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RoutesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeTableName, routeName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RoutesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if routeName == "" { + return nil, errors.New("parameter routeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeName}", url.PathEscape(routeName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified route from a route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// routeName - The name of the route. +// options - RoutesClientGetOptions contains the optional parameters for the RoutesClient.Get method. +func (client *RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientGetOptions) (RoutesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, routeTableName, routeName, options) + if err != nil { + return RoutesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoutesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoutesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RoutesClient) getCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, options *RoutesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if routeName == "" { + return nil, errors.New("parameter routeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeName}", url.PathEscape(routeName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoutesClient) getHandleResponse(resp *http.Response) (RoutesClientGetResponse, error) { + result := RoutesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Route); err != nil { + return RoutesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all routes in a route table. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// options - RoutesClientListOptions contains the optional parameters for the RoutesClient.List method. +func (client *RoutesClient) NewListPager(resourceGroupName string, routeTableName string, options *RoutesClientListOptions) *runtime.Pager[RoutesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RoutesClientListResponse]{ + More: func(page RoutesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoutesClientListResponse) (RoutesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, routeTableName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RoutesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoutesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoutesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RoutesClient) listCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, options *RoutesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RoutesClient) listHandleResponse(resp *http.Response) (RoutesClientListResponse, error) { + result := RoutesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteListResult); err != nil { + return RoutesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routetables_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routetables_client.go new file mode 100644 index 000000000..97833623e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routetables_client.go @@ -0,0 +1,424 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RouteTablesClient contains the methods for the RouteTables group. +// Don't use this type directly, use NewRouteTablesClient() instead. +type RouteTablesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRouteTablesClient creates a new instance of RouteTablesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRouteTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RouteTablesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RouteTablesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or updates a route table in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// parameters - Parameters supplied to the create or update route table operation. +// options - RouteTablesClientBeginCreateOrUpdateOptions contains the optional parameters for the RouteTablesClient.BeginCreateOrUpdate +// method. +func (client *RouteTablesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable, options *RouteTablesClientBeginCreateOrUpdateOptions) (*runtime.Poller[RouteTablesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, routeTableName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteTablesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteTablesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or updates a route table in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteTablesClient) createOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable, options *RouteTablesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, routeTableName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RouteTablesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable, options *RouteTablesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// options - RouteTablesClientBeginDeleteOptions contains the optional parameters for the RouteTablesClient.BeginDelete method. +func (client *RouteTablesClient) BeginDelete(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientBeginDeleteOptions) (*runtime.Poller[RouteTablesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, routeTableName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RouteTablesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RouteTablesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RouteTablesClient) deleteOperation(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, routeTableName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RouteTablesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified route table. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// options - RouteTablesClientGetOptions contains the optional parameters for the RouteTablesClient.Get method. +func (client *RouteTablesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientGetOptions) (RouteTablesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, routeTableName, options) + if err != nil { + return RouteTablesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteTablesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteTablesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RouteTablesClient) getCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, options *RouteTablesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RouteTablesClient) getHandleResponse(resp *http.Response) (RouteTablesClientGetResponse, error) { + result := RouteTablesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteTable); err != nil { + return RouteTablesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all route tables in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - RouteTablesClientListOptions contains the optional parameters for the RouteTablesClient.List method. +func (client *RouteTablesClient) NewListPager(resourceGroupName string, options *RouteTablesClientListOptions) *runtime.Pager[RouteTablesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteTablesClientListResponse]{ + More: func(page RouteTablesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteTablesClientListResponse) (RouteTablesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteTablesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteTablesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteTablesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RouteTablesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *RouteTablesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RouteTablesClient) listHandleResponse(resp *http.Response) (RouteTablesClientListResponse, error) { + result := RouteTablesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteTableListResult); err != nil { + return RouteTablesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all route tables in a subscription. +// Generated from API version 2022-05-01 +// options - RouteTablesClientListAllOptions contains the optional parameters for the RouteTablesClient.ListAll method. +func (client *RouteTablesClient) NewListAllPager(options *RouteTablesClientListAllOptions) *runtime.Pager[RouteTablesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[RouteTablesClientListAllResponse]{ + More: func(page RouteTablesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RouteTablesClientListAllResponse) (RouteTablesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RouteTablesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteTablesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteTablesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *RouteTablesClient) listAllCreateRequest(ctx context.Context, options *RouteTablesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *RouteTablesClient) listAllHandleResponse(resp *http.Response) (RouteTablesClientListAllResponse, error) { + result := RouteTablesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteTableListResult); err != nil { + return RouteTablesClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a route table tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// routeTableName - The name of the route table. +// parameters - Parameters supplied to update route table tags. +// options - RouteTablesClientUpdateTagsOptions contains the optional parameters for the RouteTablesClient.UpdateTags method. +func (client *RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject, options *RouteTablesClientUpdateTagsOptions) (RouteTablesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, routeTableName, parameters, options) + if err != nil { + return RouteTablesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RouteTablesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RouteTablesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *RouteTablesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject, options *RouteTablesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *RouteTablesClient) updateTagsHandleResponse(resp *http.Response) (RouteTablesClientUpdateTagsResponse, error) { + result := RouteTablesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RouteTable); err != nil { + return RouteTablesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routingintent_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routingintent_client.go new file mode 100644 index 000000000..f5f783938 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/routingintent_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoutingIntentClient contains the methods for the RoutingIntent group. +// Don't use this type directly, use NewRoutingIntentClient() instead. +type RoutingIntentClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRoutingIntentClient creates a new instance of RoutingIntentClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRoutingIntentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RoutingIntentClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &RoutingIntentClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RoutingIntent. +// virtualHubName - The name of the VirtualHub. +// routingIntentName - The name of the per VirtualHub singleton Routing Intent resource. +// routingIntentParameters - Parameters supplied to create or update RoutingIntent. +// options - RoutingIntentClientBeginCreateOrUpdateOptions contains the optional parameters for the RoutingIntentClient.BeginCreateOrUpdate +// method. +func (client *RoutingIntentClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentClientBeginCreateOrUpdateOptions) (*runtime.Poller[RoutingIntentClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RoutingIntentClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[RoutingIntentClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RoutingIntentClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RoutingIntentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, routingIntentParameters) +} + +// BeginDelete - Deletes a RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RoutingIntent. +// virtualHubName - The name of the VirtualHub. +// routingIntentName - The name of the RoutingIntent. +// options - RoutingIntentClientBeginDeleteOptions contains the optional parameters for the RoutingIntentClient.BeginDelete +// method. +func (client *RoutingIntentClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientBeginDeleteOptions) (*runtime.Poller[RoutingIntentClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RoutingIntentClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[RoutingIntentClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *RoutingIntentClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RoutingIntentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a RoutingIntent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the RoutingIntent. +// virtualHubName - The name of the VirtualHub. +// routingIntentName - The name of the RoutingIntent. +// options - RoutingIntentClientGetOptions contains the optional parameters for the RoutingIntentClient.Get method. +func (client *RoutingIntentClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientGetOptions) (RoutingIntentClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return RoutingIntentClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoutingIntentClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoutingIntentClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RoutingIntentClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoutingIntentClient) getHandleResponse(resp *http.Response) (RoutingIntentClientGetResponse, error) { + result := RoutingIntentClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoutingIntent); err != nil { + return RoutingIntentClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all RoutingIntent child resources of the VirtualHub. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - RoutingIntentClientListOptions contains the optional parameters for the RoutingIntentClient.List method. +func (client *RoutingIntentClient) NewListPager(resourceGroupName string, virtualHubName string, options *RoutingIntentClientListOptions) *runtime.Pager[RoutingIntentClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RoutingIntentClientListResponse]{ + More: func(page RoutingIntentClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoutingIntentClientListResponse) (RoutingIntentClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RoutingIntentClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoutingIntentClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoutingIntentClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RoutingIntentClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *RoutingIntentClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RoutingIntentClient) listHandleResponse(resp *http.Response) (RoutingIntentClientListResponse, error) { + result := RoutingIntentClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListRoutingIntentResult); err != nil { + return RoutingIntentClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/scopeconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/scopeconnections_client.go new file mode 100644 index 000000000..5b5490538 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/scopeconnections_client.go @@ -0,0 +1,308 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ScopeConnectionsClient contains the methods for the ScopeConnections group. +// Don't use this type directly, use NewScopeConnectionsClient() instead. +type ScopeConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewScopeConnectionsClient creates a new instance of ScopeConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewScopeConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates scope connection from Network Manager +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// scopeConnectionName - Name for the cross-tenant connection. +// parameters - Scope connection to be created/updated. +// options - ScopeConnectionsClientCreateOrUpdateOptions contains the optional parameters for the ScopeConnectionsClient.CreateOrUpdate +// method. +func (client *ScopeConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, parameters ScopeConnection, options *ScopeConnectionsClientCreateOrUpdateOptions) (ScopeConnectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, parameters, options) + if err != nil { + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ScopeConnectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ScopeConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, parameters ScopeConnection, options *ScopeConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if scopeConnectionName == "" { + return nil, errors.New("parameter scopeConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeConnectionName}", url.PathEscape(scopeConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ScopeConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (ScopeConnectionsClientCreateOrUpdateResponse, error) { + result := ScopeConnectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScopeConnection); err != nil { + return ScopeConnectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete the pending scope connection created by this network manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// scopeConnectionName - Name for the cross-tenant connection. +// options - ScopeConnectionsClientDeleteOptions contains the optional parameters for the ScopeConnectionsClient.Delete method. +func (client *ScopeConnectionsClient) Delete(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, options *ScopeConnectionsClientDeleteOptions) (ScopeConnectionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, options) + if err != nil { + return ScopeConnectionsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScopeConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScopeConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ScopeConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ScopeConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, options *ScopeConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if scopeConnectionName == "" { + return nil, errors.New("parameter scopeConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeConnectionName}", url.PathEscape(scopeConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get specified scope connection created by this Network Manager. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// scopeConnectionName - Name for the cross-tenant connection. +// options - ScopeConnectionsClientGetOptions contains the optional parameters for the ScopeConnectionsClient.Get method. +func (client *ScopeConnectionsClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, options *ScopeConnectionsClientGetOptions) (ScopeConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, scopeConnectionName, options) + if err != nil { + return ScopeConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScopeConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ScopeConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, scopeConnectionName string, options *ScopeConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if scopeConnectionName == "" { + return nil, errors.New("parameter scopeConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scopeConnectionName}", url.PathEscape(scopeConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ScopeConnectionsClient) getHandleResponse(resp *http.Response) (ScopeConnectionsClientGetResponse, error) { + result := ScopeConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScopeConnection); err != nil { + return ScopeConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all scope connections created by this network manager. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - ScopeConnectionsClientListOptions contains the optional parameters for the ScopeConnectionsClient.List method. +func (client *ScopeConnectionsClient) NewListPager(resourceGroupName string, networkManagerName string, options *ScopeConnectionsClientListOptions) *runtime.Pager[ScopeConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeConnectionsClientListResponse]{ + More: func(page ScopeConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeConnectionsClientListResponse) (ScopeConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ScopeConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *ScopeConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeConnectionsClient) listHandleResponse(resp *http.Response) (ScopeConnectionsClientListResponse, error) { + result := ScopeConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ScopeConnectionListResult); err != nil { + return ScopeConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityadminconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityadminconfigurations_client.go new file mode 100644 index 000000000..731edc14f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityadminconfigurations_client.go @@ -0,0 +1,331 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SecurityAdminConfigurationsClient contains the methods for the SecurityAdminConfigurations group. +// Don't use this type directly, use NewSecurityAdminConfigurationsClient() instead. +type SecurityAdminConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSecurityAdminConfigurationsClient creates a new instance of SecurityAdminConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSecurityAdminConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityAdminConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SecurityAdminConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a network manager security admin configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// securityAdminConfiguration - The security admin configuration to create or update +// options - SecurityAdminConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the SecurityAdminConfigurationsClient.CreateOrUpdate +// method. +func (client *SecurityAdminConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, securityAdminConfiguration SecurityAdminConfiguration, options *SecurityAdminConfigurationsClientCreateOrUpdateOptions) (SecurityAdminConfigurationsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, securityAdminConfiguration, options) + if err != nil { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityAdminConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, securityAdminConfiguration SecurityAdminConfiguration, options *SecurityAdminConfigurationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, securityAdminConfiguration) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SecurityAdminConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (SecurityAdminConfigurationsClientCreateOrUpdateResponse, error) { + result := SecurityAdminConfigurationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAdminConfiguration); err != nil { + return SecurityAdminConfigurationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes a network manager security admin configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// options - SecurityAdminConfigurationsClientBeginDeleteOptions contains the optional parameters for the SecurityAdminConfigurationsClient.BeginDelete +// method. +func (client *SecurityAdminConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientBeginDeleteOptions) (*runtime.Poller[SecurityAdminConfigurationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityAdminConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityAdminConfigurationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a network manager security admin configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityAdminConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityAdminConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Force != nil { + reqQP.Set("force", strconv.FormatBool(*options.Force)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves a network manager security admin configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// configurationName - The name of the network manager Security Configuration. +// options - SecurityAdminConfigurationsClientGetOptions contains the optional parameters for the SecurityAdminConfigurationsClient.Get +// method. +func (client *SecurityAdminConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientGetOptions) (SecurityAdminConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, configurationName, options) + if err != nil { + return SecurityAdminConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityAdminConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityAdminConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SecurityAdminConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, configurationName string, options *SecurityAdminConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityAdminConfigurationsClient) getHandleResponse(resp *http.Response) (SecurityAdminConfigurationsClientGetResponse, error) { + result := SecurityAdminConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAdminConfiguration); err != nil { + return SecurityAdminConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the network manager security admin configurations in a network manager, in a paginated format. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// options - SecurityAdminConfigurationsClientListOptions contains the optional parameters for the SecurityAdminConfigurationsClient.List +// method. +func (client *SecurityAdminConfigurationsClient) NewListPager(resourceGroupName string, networkManagerName string, options *SecurityAdminConfigurationsClientListOptions) *runtime.Pager[SecurityAdminConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityAdminConfigurationsClientListResponse]{ + More: func(page SecurityAdminConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityAdminConfigurationsClientListResponse) (SecurityAdminConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityAdminConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityAdminConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityAdminConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SecurityAdminConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, options *SecurityAdminConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityAdminConfigurationsClient) listHandleResponse(resp *http.Response) (SecurityAdminConfigurationsClientListResponse, error) { + result := SecurityAdminConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAdminConfigurationListResult); err != nil { + return SecurityAdminConfigurationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitygroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitygroups_client.go new file mode 100644 index 000000000..ebe93328d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitygroups_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityGroupsClient contains the methods for the NetworkSecurityGroups group. +// Don't use this type directly, use NewSecurityGroupsClient() instead. +type SecurityGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSecurityGroupsClient creates a new instance of SecurityGroupsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSecurityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SecurityGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a network security group in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// parameters - Parameters supplied to the create or update network security group operation. +// options - SecurityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityGroupsClient.BeginCreateOrUpdate +// method. +func (client *SecurityGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, options *SecurityGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecurityGroupsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityGroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a network security group in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, options *SecurityGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, options *SecurityGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// options - SecurityGroupsClientBeginDeleteOptions contains the optional parameters for the SecurityGroupsClient.BeginDelete +// method. +func (client *SecurityGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientBeginDeleteOptions) (*runtime.Poller[SecurityGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkSecurityGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityGroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// options - SecurityGroupsClientGetOptions contains the optional parameters for the SecurityGroupsClient.Get method. +func (client *SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientGetOptions) (SecurityGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + if err != nil { + return SecurityGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SecurityGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityGroupsClient) getHandleResponse(resp *http.Response) (SecurityGroupsClientGetResponse, error) { + result := SecurityGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityGroup); err != nil { + return SecurityGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all network security groups in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - SecurityGroupsClientListOptions contains the optional parameters for the SecurityGroupsClient.List method. +func (client *SecurityGroupsClient) NewListPager(resourceGroupName string, options *SecurityGroupsClientListOptions) *runtime.Pager[SecurityGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityGroupsClientListResponse]{ + More: func(page SecurityGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityGroupsClientListResponse) (SecurityGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SecurityGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *SecurityGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityGroupsClient) listHandleResponse(resp *http.Response) (SecurityGroupsClientListResponse, error) { + result := SecurityGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityGroupListResult); err != nil { + return SecurityGroupsClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all network security groups in a subscription. +// Generated from API version 2022-05-01 +// options - SecurityGroupsClientListAllOptions contains the optional parameters for the SecurityGroupsClient.ListAll method. +func (client *SecurityGroupsClient) NewListAllPager(options *SecurityGroupsClientListAllOptions) *runtime.Pager[SecurityGroupsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityGroupsClientListAllResponse]{ + More: func(page SecurityGroupsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityGroupsClientListAllResponse) (SecurityGroupsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityGroupsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityGroupsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityGroupsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *SecurityGroupsClient) listAllCreateRequest(ctx context.Context, options *SecurityGroupsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *SecurityGroupsClient) listAllHandleResponse(resp *http.Response) (SecurityGroupsClientListAllResponse, error) { + result := SecurityGroupsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityGroupListResult); err != nil { + return SecurityGroupsClientListAllResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a network security group tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// parameters - Parameters supplied to update network security group tags. +// options - SecurityGroupsClientUpdateTagsOptions contains the optional parameters for the SecurityGroupsClient.UpdateTags +// method. +func (client *SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject, options *SecurityGroupsClientUpdateTagsOptions) (SecurityGroupsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, parameters, options) + if err != nil { + return SecurityGroupsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityGroupsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityGroupsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *SecurityGroupsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject, options *SecurityGroupsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *SecurityGroupsClient) updateTagsHandleResponse(resp *http.Response) (SecurityGroupsClientUpdateTagsResponse, error) { + result := SecurityGroupsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityGroup); err != nil { + return SecurityGroupsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitypartnerproviders_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitypartnerproviders_client.go new file mode 100644 index 000000000..9c15612af --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securitypartnerproviders_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityPartnerProvidersClient contains the methods for the SecurityPartnerProviders group. +// Don't use this type directly, use NewSecurityPartnerProvidersClient() instead. +type SecurityPartnerProvidersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSecurityPartnerProvidersClient creates a new instance of SecurityPartnerProvidersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSecurityPartnerProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityPartnerProvidersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SecurityPartnerProvidersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// securityPartnerProviderName - The name of the Security Partner Provider. +// parameters - Parameters supplied to the create or update Security Partner Provider operation. +// options - SecurityPartnerProvidersClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityPartnerProvidersClient.BeginCreateOrUpdate +// method. +func (client *SecurityPartnerProvidersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider, options *SecurityPartnerProvidersClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecurityPartnerProvidersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, securityPartnerProviderName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityPartnerProvidersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityPartnerProvidersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityPartnerProvidersClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider, options *SecurityPartnerProvidersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityPartnerProvidersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider, options *SecurityPartnerProvidersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityPartnerProviderName == "" { + return nil, errors.New("parameter securityPartnerProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPartnerProviderName}", url.PathEscape(securityPartnerProviderName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// securityPartnerProviderName - The name of the Security Partner Provider. +// options - SecurityPartnerProvidersClientBeginDeleteOptions contains the optional parameters for the SecurityPartnerProvidersClient.BeginDelete +// method. +func (client *SecurityPartnerProvidersClient) BeginDelete(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientBeginDeleteOptions) (*runtime.Poller[SecurityPartnerProvidersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, securityPartnerProviderName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityPartnerProvidersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityPartnerProvidersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityPartnerProvidersClient) deleteOperation(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityPartnerProvidersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityPartnerProviderName == "" { + return nil, errors.New("parameter securityPartnerProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPartnerProviderName}", url.PathEscape(securityPartnerProviderName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Security Partner Provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// securityPartnerProviderName - The name of the Security Partner Provider. +// options - SecurityPartnerProvidersClientGetOptions contains the optional parameters for the SecurityPartnerProvidersClient.Get +// method. +func (client *SecurityPartnerProvidersClient) Get(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientGetOptions) (SecurityPartnerProvidersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, options) + if err != nil { + return SecurityPartnerProvidersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityPartnerProvidersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityPartnerProvidersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SecurityPartnerProvidersClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, options *SecurityPartnerProvidersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityPartnerProviderName == "" { + return nil, errors.New("parameter securityPartnerProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPartnerProviderName}", url.PathEscape(securityPartnerProviderName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityPartnerProvidersClient) getHandleResponse(resp *http.Response) (SecurityPartnerProvidersClientGetResponse, error) { + result := SecurityPartnerProvidersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProvider); err != nil { + return SecurityPartnerProvidersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the Security Partner Providers in a subscription. +// Generated from API version 2022-05-01 +// options - SecurityPartnerProvidersClientListOptions contains the optional parameters for the SecurityPartnerProvidersClient.List +// method. +func (client *SecurityPartnerProvidersClient) NewListPager(options *SecurityPartnerProvidersClientListOptions) *runtime.Pager[SecurityPartnerProvidersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityPartnerProvidersClientListResponse]{ + More: func(page SecurityPartnerProvidersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityPartnerProvidersClientListResponse) (SecurityPartnerProvidersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityPartnerProvidersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityPartnerProvidersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityPartnerProvidersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SecurityPartnerProvidersClient) listCreateRequest(ctx context.Context, options *SecurityPartnerProvidersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityPartnerProvidersClient) listHandleResponse(resp *http.Response) (SecurityPartnerProvidersClientListResponse, error) { + result := SecurityPartnerProvidersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProviderListResult); err != nil { + return SecurityPartnerProvidersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all Security Partner Providers in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - SecurityPartnerProvidersClientListByResourceGroupOptions contains the optional parameters for the SecurityPartnerProvidersClient.ListByResourceGroup +// method. +func (client *SecurityPartnerProvidersClient) NewListByResourceGroupPager(resourceGroupName string, options *SecurityPartnerProvidersClientListByResourceGroupOptions) *runtime.Pager[SecurityPartnerProvidersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityPartnerProvidersClientListByResourceGroupResponse]{ + More: func(page SecurityPartnerProvidersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityPartnerProvidersClientListByResourceGroupResponse) (SecurityPartnerProvidersClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityPartnerProvidersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityPartnerProvidersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityPartnerProvidersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SecurityPartnerProvidersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SecurityPartnerProvidersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SecurityPartnerProvidersClient) listByResourceGroupHandleResponse(resp *http.Response) (SecurityPartnerProvidersClientListByResourceGroupResponse, error) { + result := SecurityPartnerProvidersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProviderListResult); err != nil { + return SecurityPartnerProvidersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags of a Security Partner Provider resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// securityPartnerProviderName - The name of the Security Partner Provider. +// parameters - Parameters supplied to update Security Partner Provider tags. +// options - SecurityPartnerProvidersClientUpdateTagsOptions contains the optional parameters for the SecurityPartnerProvidersClient.UpdateTags +// method. +func (client *SecurityPartnerProvidersClient) UpdateTags(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters TagsObject, options *SecurityPartnerProvidersClientUpdateTagsOptions) (SecurityPartnerProvidersClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, securityPartnerProviderName, parameters, options) + if err != nil { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *SecurityPartnerProvidersClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters TagsObject, options *SecurityPartnerProvidersClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityPartnerProviderName == "" { + return nil, errors.New("parameter securityPartnerProviderName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityPartnerProviderName}", url.PathEscape(securityPartnerProviderName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *SecurityPartnerProvidersClient) updateTagsHandleResponse(resp *http.Response) (SecurityPartnerProvidersClientUpdateTagsResponse, error) { + result := SecurityPartnerProvidersClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProvider); err != nil { + return SecurityPartnerProvidersClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityrules_client.go new file mode 100644 index 000000000..372aa0caa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/securityrules_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityRulesClient contains the methods for the SecurityRules group. +// Don't use this type directly, use NewSecurityRulesClient() instead. +type SecurityRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSecurityRulesClient creates a new instance of SecurityRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSecurityRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SecurityRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a security rule in the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// securityRuleName - The name of the security rule. +// securityRuleParameters - Parameters supplied to the create or update network security rule operation. +// options - SecurityRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the SecurityRulesClient.BeginCreateOrUpdate +// method. +func (client *SecurityRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, options *SecurityRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecurityRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a security rule in the specified network security group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, options *SecurityRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, options *SecurityRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if securityRuleName == "" { + return nil, errors.New("parameter securityRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityRuleName}", url.PathEscape(securityRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, securityRuleParameters) +} + +// BeginDelete - Deletes the specified network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// securityRuleName - The name of the security rule. +// options - SecurityRulesClientBeginDeleteOptions contains the optional parameters for the SecurityRulesClient.BeginDelete +// method. +func (client *SecurityRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientBeginDeleteOptions) (*runtime.Poller[SecurityRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SecurityRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SecurityRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SecurityRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if securityRuleName == "" { + return nil, errors.New("parameter securityRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityRuleName}", url.PathEscape(securityRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified network security rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// securityRuleName - The name of the security rule. +// options - SecurityRulesClientGetOptions contains the optional parameters for the SecurityRulesClient.Get method. +func (client *SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientGetOptions) (SecurityRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, options) + if err != nil { + return SecurityRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SecurityRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, options *SecurityRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if securityRuleName == "" { + return nil, errors.New("parameter securityRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityRuleName}", url.PathEscape(securityRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityRulesClient) getHandleResponse(resp *http.Response) (SecurityRulesClientGetResponse, error) { + result := SecurityRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRule); err != nil { + return SecurityRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all security rules in a network security group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkSecurityGroupName - The name of the network security group. +// options - SecurityRulesClientListOptions contains the optional parameters for the SecurityRulesClient.List method. +func (client *SecurityRulesClient) NewListPager(resourceGroupName string, networkSecurityGroupName string, options *SecurityRulesClientListOptions) *runtime.Pager[SecurityRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityRulesClientListResponse]{ + More: func(page SecurityRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityRulesClientListResponse) (SecurityRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkSecurityGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecurityRulesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SecurityRulesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, options *SecurityRulesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkSecurityGroupName == "" { + return nil, errors.New("parameter networkSecurityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityGroupName}", url.PathEscape(networkSecurityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityRulesClient) listHandleResponse(resp *http.Response) (SecurityRulesClientListResponse, error) { + result := SecurityRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRuleListResult); err != nil { + return SecurityRulesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceassociationlinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceassociationlinks_client.go new file mode 100644 index 000000000..77943592f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceassociationlinks_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServiceAssociationLinksClient contains the methods for the ServiceAssociationLinks group. +// Don't use this type directly, use NewServiceAssociationLinksClient() instead. +type ServiceAssociationLinksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceAssociationLinksClient creates a new instance of ServiceAssociationLinksClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceAssociationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceAssociationLinksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServiceAssociationLinksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Gets a list of service association links for a subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// options - ServiceAssociationLinksClientListOptions contains the optional parameters for the ServiceAssociationLinksClient.List +// method. +func (client *ServiceAssociationLinksClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *ServiceAssociationLinksClientListOptions) (ServiceAssociationLinksClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return ServiceAssociationLinksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceAssociationLinksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceAssociationLinksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ServiceAssociationLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *ServiceAssociationLinksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServiceAssociationLinksClient) listHandleResponse(resp *http.Response) (ServiceAssociationLinksClientListResponse, error) { + result := ServiceAssociationLinksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceAssociationLinksListResult); err != nil { + return ServiceAssociationLinksClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicies_client.go new file mode 100644 index 000000000..5a6da7c4d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicies_client.go @@ -0,0 +1,429 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServiceEndpointPoliciesClient contains the methods for the ServiceEndpointPolicies group. +// Don't use this type directly, use NewServiceEndpointPoliciesClient() instead. +type ServiceEndpointPoliciesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceEndpointPoliciesClient creates a new instance of ServiceEndpointPoliciesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceEndpointPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceEndpointPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServiceEndpointPoliciesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a service Endpoint Policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy. +// parameters - Parameters supplied to the create or update service endpoint policy operation. +// options - ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceEndpointPoliciesClient.BeginCreateOrUpdate +// method. +func (client *ServiceEndpointPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy, options *ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServiceEndpointPoliciesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceEndpointPolicyName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServiceEndpointPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a service Endpoint Policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ServiceEndpointPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy, options *ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ServiceEndpointPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy, options *ServiceEndpointPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy. +// options - ServiceEndpointPoliciesClientBeginDeleteOptions contains the optional parameters for the ServiceEndpointPoliciesClient.BeginDelete +// method. +func (client *ServiceEndpointPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientBeginDeleteOptions) (*runtime.Poller[ServiceEndpointPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serviceEndpointPolicyName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServiceEndpointPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPoliciesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ServiceEndpointPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ServiceEndpointPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified service Endpoint Policies in a specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy. +// options - ServiceEndpointPoliciesClientGetOptions contains the optional parameters for the ServiceEndpointPoliciesClient.Get +// method. +func (client *ServiceEndpointPoliciesClient) Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientGetOptions) (ServiceEndpointPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, options) + if err != nil { + return ServiceEndpointPoliciesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ServiceEndpointPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServiceEndpointPoliciesClient) getHandleResponse(resp *http.Response) (ServiceEndpointPoliciesClientGetResponse, error) { + result := ServiceEndpointPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicy); err != nil { + return ServiceEndpointPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the service endpoint policies in a subscription. +// Generated from API version 2022-05-01 +// options - ServiceEndpointPoliciesClientListOptions contains the optional parameters for the ServiceEndpointPoliciesClient.List +// method. +func (client *ServiceEndpointPoliciesClient) NewListPager(options *ServiceEndpointPoliciesClientListOptions) *runtime.Pager[ServiceEndpointPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ServiceEndpointPoliciesClientListResponse]{ + More: func(page ServiceEndpointPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServiceEndpointPoliciesClientListResponse) (ServiceEndpointPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServiceEndpointPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ServiceEndpointPoliciesClient) listCreateRequest(ctx context.Context, options *ServiceEndpointPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServiceEndpointPoliciesClient) listHandleResponse(resp *http.Response) (ServiceEndpointPoliciesClientListResponse, error) { + result := ServiceEndpointPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyListResult); err != nil { + return ServiceEndpointPoliciesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all service endpoint Policies in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - ServiceEndpointPoliciesClientListByResourceGroupOptions contains the optional parameters for the ServiceEndpointPoliciesClient.ListByResourceGroup +// method. +func (client *ServiceEndpointPoliciesClient) NewListByResourceGroupPager(resourceGroupName string, options *ServiceEndpointPoliciesClientListByResourceGroupOptions) *runtime.Pager[ServiceEndpointPoliciesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ServiceEndpointPoliciesClientListByResourceGroupResponse]{ + More: func(page ServiceEndpointPoliciesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServiceEndpointPoliciesClientListByResourceGroupResponse) (ServiceEndpointPoliciesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServiceEndpointPoliciesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPoliciesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPoliciesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ServiceEndpointPoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServiceEndpointPoliciesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ServiceEndpointPoliciesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServiceEndpointPoliciesClientListByResourceGroupResponse, error) { + result := ServiceEndpointPoliciesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyListResult); err != nil { + return ServiceEndpointPoliciesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags of a service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy. +// parameters - Parameters supplied to update service endpoint policy tags. +// options - ServiceEndpointPoliciesClientUpdateTagsOptions contains the optional parameters for the ServiceEndpointPoliciesClient.UpdateTags +// method. +func (client *ServiceEndpointPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject, options *ServiceEndpointPoliciesClientUpdateTagsOptions) (ServiceEndpointPoliciesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, parameters, options) + if err != nil { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ServiceEndpointPoliciesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject, options *ServiceEndpointPoliciesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ServiceEndpointPoliciesClient) updateTagsHandleResponse(resp *http.Response) (ServiceEndpointPoliciesClientUpdateTagsResponse, error) { + result := ServiceEndpointPoliciesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicy); err != nil { + return ServiceEndpointPoliciesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicydefinitions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicydefinitions_client.go new file mode 100644 index 000000000..8b58e180f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/serviceendpointpolicydefinitions_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServiceEndpointPolicyDefinitionsClient contains the methods for the ServiceEndpointPolicyDefinitions group. +// Don't use this type directly, use NewServiceEndpointPolicyDefinitionsClient() instead. +type ServiceEndpointPolicyDefinitionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceEndpointPolicyDefinitionsClient creates a new instance of ServiceEndpointPolicyDefinitionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceEndpointPolicyDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceEndpointPolicyDefinitionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServiceEndpointPolicyDefinitionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a service endpoint policy definition in the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy. +// serviceEndpointPolicyDefinitionName - The name of the service endpoint policy definition name. +// serviceEndpointPolicyDefinitions - Parameters supplied to the create or update service endpoint policy operation. +// options - ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.BeginCreateOrUpdate +// method. +func (client *ServiceEndpointPolicyDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition, options *ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPolicyDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a service endpoint policy definition in the specified service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ServiceEndpointPolicyDefinitionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition, options *ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ServiceEndpointPolicyDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition, options *ServiceEndpointPolicyDefinitionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if serviceEndpointPolicyDefinitionName == "" { + return nil, errors.New("parameter serviceEndpointPolicyDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyDefinitionName}", url.PathEscape(serviceEndpointPolicyDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, serviceEndpointPolicyDefinitions) +} + +// BeginDelete - Deletes the specified ServiceEndpoint policy definitions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the Service Endpoint Policy. +// serviceEndpointPolicyDefinitionName - The name of the service endpoint policy definition. +// options - ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.BeginDelete +// method. +func (client *ServiceEndpointPolicyDefinitionsClient) BeginDelete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions) (*runtime.Poller[ServiceEndpointPolicyDefinitionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServiceEndpointPolicyDefinitionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ServiceEndpointPolicyDefinitionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified ServiceEndpoint policy definitions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *ServiceEndpointPolicyDefinitionsClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ServiceEndpointPolicyDefinitionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if serviceEndpointPolicyDefinitionName == "" { + return nil, errors.New("parameter serviceEndpointPolicyDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyDefinitionName}", url.PathEscape(serviceEndpointPolicyDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified service endpoint policy definitions from service endpoint policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy name. +// serviceEndpointPolicyDefinitionName - The name of the service endpoint policy definition name. +// options - ServiceEndpointPolicyDefinitionsClientGetOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.Get +// method. +func (client *ServiceEndpointPolicyDefinitionsClient) Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientGetOptions) (ServiceEndpointPolicyDefinitionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, options) + if err != nil { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ServiceEndpointPolicyDefinitionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, options *ServiceEndpointPolicyDefinitionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if serviceEndpointPolicyDefinitionName == "" { + return nil, errors.New("parameter serviceEndpointPolicyDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyDefinitionName}", url.PathEscape(serviceEndpointPolicyDefinitionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServiceEndpointPolicyDefinitionsClient) getHandleResponse(resp *http.Response) (ServiceEndpointPolicyDefinitionsClientGetResponse, error) { + result := ServiceEndpointPolicyDefinitionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyDefinition); err != nil { + return ServiceEndpointPolicyDefinitionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all service endpoint policy definitions in a service end point policy. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// serviceEndpointPolicyName - The name of the service endpoint policy name. +// options - ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions contains the optional parameters for the ServiceEndpointPolicyDefinitionsClient.ListByResourceGroup +// method. +func (client *ServiceEndpointPolicyDefinitionsClient) NewListByResourceGroupPager(resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions) *runtime.Pager[ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse]{ + More: func(page ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse) (ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, serviceEndpointPolicyName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ServiceEndpointPolicyDefinitionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, options *ServiceEndpointPolicyDefinitionsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceEndpointPolicyName == "" { + return nil, errors.New("parameter serviceEndpointPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceEndpointPolicyName}", url.PathEscape(serviceEndpointPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ServiceEndpointPolicyDefinitionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse, error) { + result := ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyDefinitionListResult); err != nil { + return ServiceEndpointPolicyDefinitionsClientListByResourceGroupResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetaginformation_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetaginformation_client.go new file mode 100644 index 000000000..77e32fa56 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetaginformation_client.go @@ -0,0 +1,130 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ServiceTagInformationClient contains the methods for the ServiceTagInformation group. +// Don't use this type directly, use NewServiceTagInformationClient() instead. +type ServiceTagInformationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceTagInformationClient creates a new instance of ServiceTagInformationClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceTagInformationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceTagInformationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServiceTagInformationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Gets a list of service tag information resources with pagination. +// Generated from API version 2022-05-01 +// location - The location that will be used as a reference for cloud (not as a filter based on location, you will get the +// list of service tags with prefix details across all regions but limited to the cloud that +// your subscription belongs to). +// options - ServiceTagInformationClientListOptions contains the optional parameters for the ServiceTagInformationClient.List +// method. +func (client *ServiceTagInformationClient) NewListPager(location string, options *ServiceTagInformationClientListOptions) *runtime.Pager[ServiceTagInformationClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ServiceTagInformationClientListResponse]{ + More: func(page ServiceTagInformationClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServiceTagInformationClientListResponse) (ServiceTagInformationClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServiceTagInformationClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceTagInformationClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceTagInformationClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ServiceTagInformationClient) listCreateRequest(ctx context.Context, location string, options *ServiceTagInformationClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.NoAddressPrefixes != nil { + reqQP.Set("noAddressPrefixes", strconv.FormatBool(*options.NoAddressPrefixes)) + } + if options != nil && options.TagName != nil { + reqQP.Set("tagName", *options.TagName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServiceTagInformationClient) listHandleResponse(resp *http.Response) (ServiceTagInformationClientListResponse, error) { + result := ServiceTagInformationClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceTagInformationListResult); err != nil { + return ServiceTagInformationClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetags_client.go new file mode 100644 index 000000000..d725d6984 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/servicetags_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServiceTagsClient contains the methods for the ServiceTags group. +// Don't use this type directly, use NewServiceTagsClient() instead. +type ServiceTagsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceTagsClient creates a new instance of ServiceTagsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceTagsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServiceTagsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - Gets a list of service tag information resources. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The location that will be used as a reference for version (not as a filter based on location, you will get the +// list of service tags with prefix details across all regions but limited to the cloud that +// your subscription belongs to). +// options - ServiceTagsClientListOptions contains the optional parameters for the ServiceTagsClient.List method. +func (client *ServiceTagsClient) List(ctx context.Context, location string, options *ServiceTagsClientListOptions) (ServiceTagsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return ServiceTagsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServiceTagsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServiceTagsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ServiceTagsClient) listCreateRequest(ctx context.Context, location string, options *ServiceTagsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServiceTagsClient) listHandleResponse(resp *http.Response) (ServiceTagsClientListResponse, error) { + result := ServiceTagsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceTagsListResult); err != nil { + return ServiceTagsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/staticmembers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/staticmembers_client.go new file mode 100644 index 000000000..0a4141c2c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/staticmembers_client.go @@ -0,0 +1,328 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// StaticMembersClient contains the methods for the StaticMembers group. +// Don't use this type directly, use NewStaticMembersClient() instead. +type StaticMembersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewStaticMembersClient creates a new instance of StaticMembersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewStaticMembersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StaticMembersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &StaticMembersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a static member. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// staticMemberName - The name of the static member. +// parameters - Parameters supplied to the specify the static member to create +// options - StaticMembersClientCreateOrUpdateOptions contains the optional parameters for the StaticMembersClient.CreateOrUpdate +// method. +func (client *StaticMembersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, parameters StaticMember, options *StaticMembersClientCreateOrUpdateOptions) (StaticMembersClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, parameters, options) + if err != nil { + return StaticMembersClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StaticMembersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return StaticMembersClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StaticMembersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, parameters StaticMember, options *StaticMembersClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + if staticMemberName == "" { + return nil, errors.New("parameter staticMemberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{staticMemberName}", url.PathEscape(staticMemberName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *StaticMembersClient) createOrUpdateHandleResponse(resp *http.Response) (StaticMembersClientCreateOrUpdateResponse, error) { + result := StaticMembersClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StaticMember); err != nil { + return StaticMembersClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a static member. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// staticMemberName - The name of the static member. +// options - StaticMembersClientDeleteOptions contains the optional parameters for the StaticMembersClient.Delete method. +func (client *StaticMembersClient) Delete(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, options *StaticMembersClientDeleteOptions) (StaticMembersClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, options) + if err != nil { + return StaticMembersClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StaticMembersClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return StaticMembersClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return StaticMembersClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StaticMembersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, options *StaticMembersClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + if staticMemberName == "" { + return nil, errors.New("parameter staticMemberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{staticMemberName}", url.PathEscape(staticMemberName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified static member. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// staticMemberName - The name of the static member. +// options - StaticMembersClientGetOptions contains the optional parameters for the StaticMembersClient.Get method. +func (client *StaticMembersClient) Get(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, options *StaticMembersClientGetOptions) (StaticMembersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, staticMemberName, options) + if err != nil { + return StaticMembersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StaticMembersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StaticMembersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StaticMembersClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, staticMemberName string, options *StaticMembersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + if staticMemberName == "" { + return nil, errors.New("parameter staticMemberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{staticMemberName}", url.PathEscape(staticMemberName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StaticMembersClient) getHandleResponse(resp *http.Response) (StaticMembersClientGetResponse, error) { + result := StaticMembersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StaticMember); err != nil { + return StaticMembersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the specified static member. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkManagerName - The name of the network manager. +// networkGroupName - The name of the network group. +// options - StaticMembersClientListOptions contains the optional parameters for the StaticMembersClient.List method. +func (client *StaticMembersClient) NewListPager(resourceGroupName string, networkManagerName string, networkGroupName string, options *StaticMembersClientListOptions) *runtime.Pager[StaticMembersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[StaticMembersClientListResponse]{ + More: func(page StaticMembersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StaticMembersClientListResponse) (StaticMembersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkManagerName, networkGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return StaticMembersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StaticMembersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StaticMembersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *StaticMembersClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkManagerName string, networkGroupName string, options *StaticMembersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkManagerName == "" { + return nil, errors.New("parameter networkManagerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerName}", url.PathEscape(networkManagerName)) + if networkGroupName == "" { + return nil, errors.New("parameter networkGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkGroupName}", url.PathEscape(networkGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StaticMembersClient) listHandleResponse(resp *http.Response) (StaticMembersClientListResponse, error) { + result := StaticMembersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StaticMemberListResult); err != nil { + return StaticMembersClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subnets_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subnets_client.go new file mode 100644 index 000000000..bcbf3b63b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subnets_client.go @@ -0,0 +1,471 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SubnetsClient contains the methods for the Subnets group. +// Don't use this type directly, use NewSubnetsClient() instead. +type SubnetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSubnetsClient creates a new instance of SubnetsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSubnetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubnetsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SubnetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a subnet in the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// subnetParameters - Parameters supplied to the create or update subnet operation. +// options - SubnetsClientBeginCreateOrUpdateOptions contains the optional parameters for the SubnetsClient.BeginCreateOrUpdate +// method. +func (client *SubnetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, options *SubnetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SubnetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SubnetsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a subnet in the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SubnetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, options *SubnetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SubnetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, options *SubnetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, subnetParameters) +} + +// BeginDelete - Deletes the specified subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// options - SubnetsClientBeginDeleteOptions contains the optional parameters for the SubnetsClient.BeginDelete method. +func (client *SubnetsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientBeginDeleteOptions) (*runtime.Poller[SubnetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SubnetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified subnet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SubnetsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SubnetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified subnet by virtual network and resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// options - SubnetsClientGetOptions contains the optional parameters for the SubnetsClient.Get method. +func (client *SubnetsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientGetOptions) (SubnetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return SubnetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubnetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubnetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SubnetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SubnetsClient) getHandleResponse(resp *http.Response) (SubnetsClientGetResponse, error) { + result := SubnetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Subnet); err != nil { + return SubnetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all subnets in a virtual network. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - SubnetsClientListOptions contains the optional parameters for the SubnetsClient.List method. +func (client *SubnetsClient) NewListPager(resourceGroupName string, virtualNetworkName string, options *SubnetsClientListOptions) *runtime.Pager[SubnetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SubnetsClientListResponse]{ + More: func(page SubnetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SubnetsClientListResponse) (SubnetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SubnetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubnetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubnetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SubnetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *SubnetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SubnetsClient) listHandleResponse(resp *http.Response) (SubnetsClientListResponse, error) { + result := SubnetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubnetListResult); err != nil { + return SubnetsClientListResponse{}, err + } + return result, nil +} + +// BeginPrepareNetworkPolicies - Prepares a subnet by applying network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// prepareNetworkPoliciesRequestParameters - Parameters supplied to prepare subnet by applying network intent policies. +// options - SubnetsClientBeginPrepareNetworkPoliciesOptions contains the optional parameters for the SubnetsClient.BeginPrepareNetworkPolicies +// method. +func (client *SubnetsClient) BeginPrepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest, options *SubnetsClientBeginPrepareNetworkPoliciesOptions) (*runtime.Poller[SubnetsClientPrepareNetworkPoliciesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.prepareNetworkPolicies(ctx, resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SubnetsClientPrepareNetworkPoliciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientPrepareNetworkPoliciesResponse](options.ResumeToken, client.pl, nil) + } +} + +// PrepareNetworkPolicies - Prepares a subnet by applying network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SubnetsClient) prepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest, options *SubnetsClientBeginPrepareNetworkPoliciesOptions) (*http.Response, error) { + req, err := client.prepareNetworkPoliciesCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// prepareNetworkPoliciesCreateRequest creates the PrepareNetworkPolicies request. +func (client *SubnetsClient) prepareNetworkPoliciesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest, options *SubnetsClientBeginPrepareNetworkPoliciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, prepareNetworkPoliciesRequestParameters) +} + +// BeginUnprepareNetworkPolicies - Unprepares a subnet by removing network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// unprepareNetworkPoliciesRequestParameters - Parameters supplied to unprepare subnet to remove network intent policies. +// options - SubnetsClientBeginUnprepareNetworkPoliciesOptions contains the optional parameters for the SubnetsClient.BeginUnprepareNetworkPolicies +// method. +func (client *SubnetsClient) BeginUnprepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest, options *SubnetsClientBeginUnprepareNetworkPoliciesOptions) (*runtime.Poller[SubnetsClientUnprepareNetworkPoliciesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.unprepareNetworkPolicies(ctx, resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SubnetsClientUnprepareNetworkPoliciesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[SubnetsClientUnprepareNetworkPoliciesResponse](options.ResumeToken, client.pl, nil) + } +} + +// UnprepareNetworkPolicies - Unprepares a subnet by removing network intent policies. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *SubnetsClient) unprepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest, options *SubnetsClientBeginUnprepareNetworkPoliciesOptions) (*http.Response, error) { + req, err := client.unprepareNetworkPoliciesCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// unprepareNetworkPoliciesCreateRequest creates the UnprepareNetworkPolicies request. +func (client *SubnetsClient) unprepareNetworkPoliciesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest, options *SubnetsClientBeginUnprepareNetworkPoliciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, unprepareNetworkPoliciesRequestParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subscriptionnetworkmanagerconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subscriptionnetworkmanagerconnections_client.go new file mode 100644 index 000000000..2a2d1888b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/subscriptionnetworkmanagerconnections_client.go @@ -0,0 +1,271 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SubscriptionNetworkManagerConnectionsClient contains the methods for the SubscriptionNetworkManagerConnections group. +// Don't use this type directly, use NewSubscriptionNetworkManagerConnectionsClient() instead. +type SubscriptionNetworkManagerConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSubscriptionNetworkManagerConnectionsClient creates a new instance of SubscriptionNetworkManagerConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSubscriptionNetworkManagerConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionNetworkManagerConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SubscriptionNetworkManagerConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create a network manager connection on this subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// networkManagerConnectionName - Name for the network manager connection. +// parameters - Network manager connection to be created/updated. +// options - SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.CreateOrUpdate +// method. +func (client *SubscriptionNetworkManagerConnectionsClient) CreateOrUpdate(ctx context.Context, networkManagerConnectionName string, parameters ManagerConnection, options *SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions) (SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, networkManagerConnectionName, parameters, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SubscriptionNetworkManagerConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, networkManagerConnectionName string, parameters ManagerConnection, options *SubscriptionNetworkManagerConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SubscriptionNetworkManagerConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse, error) { + result := SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnection); err != nil { + return SubscriptionNetworkManagerConnectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete specified connection created by this subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// networkManagerConnectionName - Name for the network manager connection. +// options - SubscriptionNetworkManagerConnectionsClientDeleteOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.Delete +// method. +func (client *SubscriptionNetworkManagerConnectionsClient) Delete(ctx context.Context, networkManagerConnectionName string, options *SubscriptionNetworkManagerConnectionsClientDeleteOptions) (SubscriptionNetworkManagerConnectionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, networkManagerConnectionName, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SubscriptionNetworkManagerConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SubscriptionNetworkManagerConnectionsClient) deleteCreateRequest(ctx context.Context, networkManagerConnectionName string, options *SubscriptionNetworkManagerConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a specified connection created by this subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// networkManagerConnectionName - Name for the network manager connection. +// options - SubscriptionNetworkManagerConnectionsClientGetOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.Get +// method. +func (client *SubscriptionNetworkManagerConnectionsClient) Get(ctx context.Context, networkManagerConnectionName string, options *SubscriptionNetworkManagerConnectionsClientGetOptions) (SubscriptionNetworkManagerConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, networkManagerConnectionName, options) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SubscriptionNetworkManagerConnectionsClient) getCreateRequest(ctx context.Context, networkManagerConnectionName string, options *SubscriptionNetworkManagerConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if networkManagerConnectionName == "" { + return nil, errors.New("parameter networkManagerConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkManagerConnectionName}", url.PathEscape(networkManagerConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SubscriptionNetworkManagerConnectionsClient) getHandleResponse(resp *http.Response) (SubscriptionNetworkManagerConnectionsClientGetResponse, error) { + result := SubscriptionNetworkManagerConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnection); err != nil { + return SubscriptionNetworkManagerConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all network manager connections created by this subscription. +// Generated from API version 2022-05-01 +// options - SubscriptionNetworkManagerConnectionsClientListOptions contains the optional parameters for the SubscriptionNetworkManagerConnectionsClient.List +// method. +func (client *SubscriptionNetworkManagerConnectionsClient) NewListPager(options *SubscriptionNetworkManagerConnectionsClientListOptions) *runtime.Pager[SubscriptionNetworkManagerConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SubscriptionNetworkManagerConnectionsClientListResponse]{ + More: func(page SubscriptionNetworkManagerConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SubscriptionNetworkManagerConnectionsClientListResponse) (SubscriptionNetworkManagerConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SubscriptionNetworkManagerConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionNetworkManagerConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionNetworkManagerConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SubscriptionNetworkManagerConnectionsClient) listCreateRequest(ctx context.Context, options *SubscriptionNetworkManagerConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SubscriptionNetworkManagerConnectionsClient) listHandleResponse(resp *http.Response) (SubscriptionNetworkManagerConnectionsClientListResponse, error) { + result := SubscriptionNetworkManagerConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagerConnectionListResult); err != nil { + return SubscriptionNetworkManagerConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/time_rfc3339.go new file mode 100644 index 000000000..c9d8a00ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/time_rfc3339.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/usages_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/usages_client.go new file mode 100644 index 000000000..6b4eeecf3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/usages_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsagesClient contains the methods for the Usages group. +// Don't use this type directly, use NewUsagesClient() instead. +type UsagesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List network usages for a subscription. +// Generated from API version 2022-05-01 +// location - The location where resource usage is queried. +// options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UsagesClientListResponse]{ + More: func(page UsagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UsagesClientListResponse) (UsagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return UsagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UsagesClient) listCreateRequest(ctx context.Context, location string, options *UsagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesClientListResponse, error) { + result := UsagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { + return UsagesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vipswap_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vipswap_client.go new file mode 100644 index 000000000..bc38cd964 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vipswap_client.go @@ -0,0 +1,236 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VipSwapClient contains the methods for the VipSwap group. +// Don't use this type directly, use NewVipSwapClient() instead. +type VipSwapClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVipSwapClient creates a new instance of VipSwapClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVipSwapClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VipSwapClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VipSwapClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Performs vip swap operation on swappable cloud services. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// groupName - The name of the resource group. +// resourceName - The name of the cloud service. +// parameters - SwapResource object where slot type should be the target slot after vip swap for the specified cloud service. +// options - VipSwapClientBeginCreateOptions contains the optional parameters for the VipSwapClient.BeginCreate method. +func (client *VipSwapClient) BeginCreate(ctx context.Context, groupName string, resourceName string, parameters SwapResource, options *VipSwapClientBeginCreateOptions) (*runtime.Poller[VipSwapClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, groupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[VipSwapClientCreateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[VipSwapClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Performs vip swap operation on swappable cloud services. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VipSwapClient) create(ctx context.Context, groupName string, resourceName string, parameters SwapResource, options *VipSwapClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, groupName, resourceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *VipSwapClient) createCreateRequest(ctx context.Context, groupName string, resourceName string, parameters SwapResource, options *VipSwapClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + urlPath = strings.ReplaceAll(urlPath, "{singletonResource}", url.PathEscape("swap")) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Get - Gets the SwapResource which identifies the slot type for the specified cloud service. The slot type on a cloud service +// can either be Staging or Production +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// groupName - The name of the resource group. +// resourceName - The name of the cloud service. +// options - VipSwapClientGetOptions contains the optional parameters for the VipSwapClient.Get method. +func (client *VipSwapClient) Get(ctx context.Context, groupName string, resourceName string, options *VipSwapClientGetOptions) (VipSwapClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, groupName, resourceName, options) + if err != nil { + return VipSwapClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VipSwapClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VipSwapClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VipSwapClient) getCreateRequest(ctx context.Context, groupName string, resourceName string, options *VipSwapClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource}" + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + urlPath = strings.ReplaceAll(urlPath, "{singletonResource}", url.PathEscape("swap")) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VipSwapClient) getHandleResponse(resp *http.Response) (VipSwapClientGetResponse, error) { + result := VipSwapClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SwapResource); err != nil { + return VipSwapClientGetResponse{}, err + } + return result, nil +} + +// List - Gets the list of SwapResource which identifies the slot type for the specified cloud service. The slot type on a +// cloud service can either be Staging or Production +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// groupName - The name of the resource group. +// resourceName - The name of the cloud service. +// options - VipSwapClientListOptions contains the optional parameters for the VipSwapClient.List method. +func (client *VipSwapClient) List(ctx context.Context, groupName string, resourceName string, options *VipSwapClientListOptions) (VipSwapClientListResponse, error) { + req, err := client.listCreateRequest(ctx, groupName, resourceName, options) + if err != nil { + return VipSwapClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VipSwapClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VipSwapClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *VipSwapClient) listCreateRequest(ctx context.Context, groupName string, resourceName string, options *VipSwapClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots" + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VipSwapClient) listHandleResponse(resp *http.Response) (VipSwapClientListResponse, error) { + result := VipSwapClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SwapResourceListResult); err != nil { + return VipSwapClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliances_client.go new file mode 100644 index 000000000..a7d99cf97 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliances_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualAppliancesClient contains the methods for the NetworkVirtualAppliances group. +// Don't use this type directly, use NewVirtualAppliancesClient() instead. +type VirtualAppliancesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualAppliancesClient creates a new instance of VirtualAppliancesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualAppliancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualAppliancesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualAppliancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of Network Virtual Appliance. +// parameters - Parameters supplied to the create or update Network Virtual Appliance. +// options - VirtualAppliancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualAppliancesClient.BeginCreateOrUpdate +// method. +func (client *VirtualAppliancesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance, options *VirtualAppliancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualAppliancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkVirtualApplianceName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualAppliancesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualAppliancesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualAppliancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance, options *VirtualAppliancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualAppliancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance, options *VirtualAppliancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of Network Virtual Appliance. +// options - VirtualAppliancesClientBeginDeleteOptions contains the optional parameters for the VirtualAppliancesClient.BeginDelete +// method. +func (client *VirtualAppliancesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientBeginDeleteOptions) (*runtime.Poller[VirtualAppliancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkVirtualApplianceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualAppliancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualAppliancesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualAppliancesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualAppliancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of Network Virtual Appliance. +// options - VirtualAppliancesClientGetOptions contains the optional parameters for the VirtualAppliancesClient.Get method. +func (client *VirtualAppliancesClient) Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientGetOptions) (VirtualAppliancesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, options) + if err != nil { + return VirtualAppliancesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualAppliancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualAppliancesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualAppliancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualAppliancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualAppliancesClient) getHandleResponse(resp *http.Response) (VirtualAppliancesClientGetResponse, error) { + result := VirtualAppliancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualAppliance); err != nil { + return VirtualAppliancesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all Network Virtual Appliances in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualAppliancesClientListOptions contains the optional parameters for the VirtualAppliancesClient.List method. +func (client *VirtualAppliancesClient) NewListPager(options *VirtualAppliancesClientListOptions) *runtime.Pager[VirtualAppliancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualAppliancesClientListResponse]{ + More: func(page VirtualAppliancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualAppliancesClientListResponse) (VirtualAppliancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualAppliancesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualAppliancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualAppliancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualAppliancesClient) listCreateRequest(ctx context.Context, options *VirtualAppliancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualAppliancesClient) listHandleResponse(resp *http.Response) (VirtualAppliancesClientListResponse, error) { + result := VirtualAppliancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceListResult); err != nil { + return VirtualAppliancesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all Network Virtual Appliances in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualAppliancesClientListByResourceGroupOptions contains the optional parameters for the VirtualAppliancesClient.ListByResourceGroup +// method. +func (client *VirtualAppliancesClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualAppliancesClientListByResourceGroupOptions) *runtime.Pager[VirtualAppliancesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualAppliancesClientListByResourceGroupResponse]{ + More: func(page VirtualAppliancesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualAppliancesClientListByResourceGroupResponse) (VirtualAppliancesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualAppliancesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualAppliancesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualAppliancesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualAppliancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualAppliancesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualAppliancesClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualAppliancesClientListByResourceGroupResponse, error) { + result := VirtualAppliancesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceListResult); err != nil { + return VirtualAppliancesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a Network Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of Network Virtual Appliance. +// networkVirtualApplianceName - The name of Network Virtual Appliance being updated. +// parameters - Parameters supplied to Update Network Virtual Appliance Tags. +// options - VirtualAppliancesClientUpdateTagsOptions contains the optional parameters for the VirtualAppliancesClient.UpdateTags +// method. +func (client *VirtualAppliancesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters TagsObject, options *VirtualAppliancesClientUpdateTagsOptions) (VirtualAppliancesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, parameters, options) + if err != nil { + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualAppliancesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualAppliancesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters TagsObject, options *VirtualAppliancesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VirtualAppliancesClient) updateTagsHandleResponse(resp *http.Response) (VirtualAppliancesClientUpdateTagsResponse, error) { + result := VirtualAppliancesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualAppliance); err != nil { + return VirtualAppliancesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliancesites_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliancesites_client.go new file mode 100644 index 000000000..40d3e3240 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualappliancesites_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualApplianceSitesClient contains the methods for the VirtualApplianceSites group. +// Don't use this type directly, use NewVirtualApplianceSitesClient() instead. +type VirtualApplianceSitesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualApplianceSitesClient creates a new instance of VirtualApplianceSitesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualApplianceSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualApplianceSitesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualApplianceSitesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance Site. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of the Network Virtual Appliance. +// siteName - The name of the site. +// parameters - Parameters supplied to the create or update Network Virtual Appliance Site operation. +// options - VirtualApplianceSitesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualApplianceSitesClient.BeginCreateOrUpdate +// method. +func (client *VirtualApplianceSitesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite, options *VirtualApplianceSitesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualApplianceSitesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, networkVirtualApplianceName, siteName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualApplianceSitesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceSitesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Network Virtual Appliance Site. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualApplianceSitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite, options *VirtualApplianceSitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualApplianceSitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite, options *VirtualApplianceSitesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified site from a Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of the Network Virtual Appliance. +// siteName - The name of the site. +// options - VirtualApplianceSitesClientBeginDeleteOptions contains the optional parameters for the VirtualApplianceSitesClient.BeginDelete +// method. +func (client *VirtualApplianceSitesClient) BeginDelete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientBeginDeleteOptions) (*runtime.Poller[VirtualApplianceSitesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkVirtualApplianceName, siteName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualApplianceSitesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualApplianceSitesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified site from a Virtual Appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualApplianceSitesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualApplianceSitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Virtual Appliance Site. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of the Network Virtual Appliance. +// siteName - The name of the site. +// options - VirtualApplianceSitesClientGetOptions contains the optional parameters for the VirtualApplianceSitesClient.Get +// method. +func (client *VirtualApplianceSitesClient) Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientGetOptions) (VirtualApplianceSitesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, siteName, options) + if err != nil { + return VirtualApplianceSitesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualApplianceSitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualApplianceSitesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualApplianceSitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, options *VirtualApplianceSitesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if siteName == "" { + return nil, errors.New("parameter siteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{siteName}", url.PathEscape(siteName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualApplianceSitesClient) getHandleResponse(resp *http.Response) (VirtualApplianceSitesClientGetResponse, error) { + result := VirtualApplianceSitesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceSite); err != nil { + return VirtualApplianceSitesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all Network Virtual Appliance Sites in a Network Virtual Appliance resource. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkVirtualApplianceName - The name of the Network Virtual Appliance. +// options - VirtualApplianceSitesClientListOptions contains the optional parameters for the VirtualApplianceSitesClient.List +// method. +func (client *VirtualApplianceSitesClient) NewListPager(resourceGroupName string, networkVirtualApplianceName string, options *VirtualApplianceSitesClientListOptions) *runtime.Pager[VirtualApplianceSitesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualApplianceSitesClientListResponse]{ + More: func(page VirtualApplianceSitesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualApplianceSitesClientListResponse) (VirtualApplianceSitesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, networkVirtualApplianceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualApplianceSitesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualApplianceSitesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualApplianceSitesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualApplianceSitesClient) listCreateRequest(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, options *VirtualApplianceSitesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkVirtualApplianceName == "" { + return nil, errors.New("parameter networkVirtualApplianceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkVirtualApplianceName}", url.PathEscape(networkVirtualApplianceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualApplianceSitesClient) listHandleResponse(resp *http.Response) (VirtualApplianceSitesClientListResponse, error) { + result := VirtualApplianceSitesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceSiteListResult); err != nil { + return VirtualApplianceSitesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualapplianceskus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualapplianceskus_client.go new file mode 100644 index 000000000..ff4ddb47a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualapplianceskus_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualApplianceSKUsClient contains the methods for the VirtualApplianceSKUs group. +// Don't use this type directly, use NewVirtualApplianceSKUsClient() instead. +type VirtualApplianceSKUsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualApplianceSKUsClient creates a new instance of VirtualApplianceSKUsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualApplianceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualApplianceSKUsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualApplianceSKUsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Retrieves a single available sku for network virtual appliance. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// skuName - Name of the Sku. +// options - VirtualApplianceSKUsClientGetOptions contains the optional parameters for the VirtualApplianceSKUsClient.Get +// method. +func (client *VirtualApplianceSKUsClient) Get(ctx context.Context, skuName string, options *VirtualApplianceSKUsClientGetOptions) (VirtualApplianceSKUsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, skuName, options) + if err != nil { + return VirtualApplianceSKUsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualApplianceSKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualApplianceSKUsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualApplianceSKUsClient) getCreateRequest(ctx context.Context, skuName string, options *VirtualApplianceSKUsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualApplianceSKUsClient) getHandleResponse(resp *http.Response) (VirtualApplianceSKUsClientGetResponse, error) { + result := VirtualApplianceSKUsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceSKU); err != nil { + return VirtualApplianceSKUsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all SKUs available for a virtual appliance. +// Generated from API version 2022-05-01 +// options - VirtualApplianceSKUsClientListOptions contains the optional parameters for the VirtualApplianceSKUsClient.List +// method. +func (client *VirtualApplianceSKUsClient) NewListPager(options *VirtualApplianceSKUsClientListOptions) *runtime.Pager[VirtualApplianceSKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualApplianceSKUsClientListResponse]{ + More: func(page VirtualApplianceSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualApplianceSKUsClientListResponse) (VirtualApplianceSKUsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualApplianceSKUsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualApplianceSKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualApplianceSKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualApplianceSKUsClient) listCreateRequest(ctx context.Context, options *VirtualApplianceSKUsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualApplianceSKUsClient) listHandleResponse(resp *http.Response) (VirtualApplianceSKUsClientListResponse, error) { + result := VirtualApplianceSKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceSKUListResult); err != nil { + return VirtualApplianceSKUsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnection_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnection_client.go new file mode 100644 index 000000000..556e030f7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnection_client.go @@ -0,0 +1,260 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualHubBgpConnectionClient contains the methods for the VirtualHubBgpConnection group. +// Don't use this type directly, use NewVirtualHubBgpConnectionClient() instead. +type VirtualHubBgpConnectionClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualHubBgpConnectionClient creates a new instance of VirtualHubBgpConnectionClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualHubBgpConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHubBgpConnectionClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualHubBgpConnectionClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the connection. +// parameters - Parameters of Bgp connection. +// options - VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubBgpConnectionClient.BeginCreateOrUpdate +// method. +func (client *VirtualHubBgpConnectionClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection, options *VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHubBgpConnectionClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, connectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubBgpConnectionClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubBgpConnectionClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection, options *VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualHubBgpConnectionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection, options *VirtualHubBgpConnectionClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHubBgpConnection. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the connection. +// options - VirtualHubBgpConnectionClientBeginDeleteOptions contains the optional parameters for the VirtualHubBgpConnectionClient.BeginDelete +// method. +func (client *VirtualHubBgpConnectionClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientBeginDeleteOptions) (*runtime.Poller[VirtualHubBgpConnectionClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubBgpConnectionClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VirtualHubBgpConnection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubBgpConnectionClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualHubBgpConnectionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a Virtual Hub Bgp Connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// connectionName - The name of the connection. +// options - VirtualHubBgpConnectionClientGetOptions contains the optional parameters for the VirtualHubBgpConnectionClient.Get +// method. +func (client *VirtualHubBgpConnectionClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientGetOptions) (VirtualHubBgpConnectionClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, connectionName, options) + if err != nil { + return VirtualHubBgpConnectionClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubBgpConnectionClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubBgpConnectionClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualHubBgpConnectionClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, options *VirtualHubBgpConnectionClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualHubBgpConnectionClient) getHandleResponse(resp *http.Response) (VirtualHubBgpConnectionClientGetResponse, error) { + result := VirtualHubBgpConnectionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BgpConnection); err != nil { + return VirtualHubBgpConnectionClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnections_client.go new file mode 100644 index 000000000..f47ee7dc5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubbgpconnections_client.go @@ -0,0 +1,266 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualHubBgpConnectionsClient contains the methods for the VirtualHubBgpConnections group. +// Don't use this type directly, use NewVirtualHubBgpConnectionsClient() instead. +type VirtualHubBgpConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualHubBgpConnectionsClient creates a new instance of VirtualHubBgpConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualHubBgpConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHubBgpConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualHubBgpConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Retrieves the details of all VirtualHubBgpConnections. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubBgpConnectionsClientListOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.List +// method. +func (client *VirtualHubBgpConnectionsClient) NewListPager(resourceGroupName string, virtualHubName string, options *VirtualHubBgpConnectionsClientListOptions) *runtime.Pager[VirtualHubBgpConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHubBgpConnectionsClientListResponse]{ + More: func(page VirtualHubBgpConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHubBgpConnectionsClientListResponse) (VirtualHubBgpConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHubBgpConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubBgpConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubBgpConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualHubBgpConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubBgpConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualHubBgpConnectionsClient) listHandleResponse(resp *http.Response) (VirtualHubBgpConnectionsClientListResponse, error) { + result := VirtualHubBgpConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubBgpConnectionResults); err != nil { + return VirtualHubBgpConnectionsClientListResponse{}, err + } + return result, nil +} + +// BeginListAdvertisedRoutes - Retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// hubName - The name of the virtual hub. +// connectionName - The name of the virtual hub bgp connection. +// options - VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.BeginListAdvertisedRoutes +// method. +func (client *VirtualHubBgpConnectionsClient) BeginListAdvertisedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions) (*runtime.Poller[VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listAdvertisedRoutes(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionsClientListAdvertisedRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListAdvertisedRoutes - Retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubBgpConnectionsClient) listAdvertisedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions) (*http.Response, error) { + req, err := client.listAdvertisedRoutesCreateRequest(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listAdvertisedRoutesCreateRequest creates the ListAdvertisedRoutes request. +func (client *VirtualHubBgpConnectionsClient) listAdvertisedRoutesCreateRequest(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListAdvertisedRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListLearnedRoutes - Retrieves a list of routes the virtual hub bgp connection has learned. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// hubName - The name of the virtual hub. +// connectionName - The name of the virtual hub bgp connection. +// options - VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions contains the optional parameters for the VirtualHubBgpConnectionsClient.BeginListLearnedRoutes +// method. +func (client *VirtualHubBgpConnectionsClient) BeginListLearnedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions) (*runtime.Poller[VirtualHubBgpConnectionsClientListLearnedRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listLearnedRoutes(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubBgpConnectionsClientListLearnedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubBgpConnectionsClientListLearnedRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListLearnedRoutes - Retrieves a list of routes the virtual hub bgp connection has learned. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubBgpConnectionsClient) listLearnedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions) (*http.Response, error) { + req, err := client.listLearnedRoutesCreateRequest(ctx, resourceGroupName, hubName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listLearnedRoutesCreateRequest creates the ListLearnedRoutes request. +func (client *VirtualHubBgpConnectionsClient) listLearnedRoutesCreateRequest(ctx context.Context, resourceGroupName string, hubName string, connectionName string, options *VirtualHubBgpConnectionsClientBeginListLearnedRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubipconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubipconfiguration_client.go new file mode 100644 index 000000000..7464ed2a6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubipconfiguration_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualHubIPConfigurationClient contains the methods for the VirtualHubIPConfiguration group. +// Don't use this type directly, use NewVirtualHubIPConfigurationClient() instead. +type VirtualHubIPConfigurationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualHubIPConfigurationClient creates a new instance of VirtualHubIPConfigurationClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualHubIPConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHubIPConfigurationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualHubIPConfigurationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// ipConfigName - The name of the ipconfig. +// parameters - Hub Ip Configuration parameters. +// options - VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubIPConfigurationClient.BeginCreateOrUpdate +// method. +func (client *VirtualHubIPConfigurationClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, parameters HubIPConfiguration, options *VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHubIPConfigurationClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, ipConfigName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubIPConfigurationClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubIPConfigurationClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubIPConfigurationClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, parameters HubIPConfiguration, options *VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualHubIPConfigurationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, parameters HubIPConfiguration, options *VirtualHubIPConfigurationClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if ipConfigName == "" { + return nil, errors.New("parameter ipConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigName}", url.PathEscape(ipConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHubBgpConnection. +// virtualHubName - The name of the VirtualHub. +// ipConfigName - The name of the ipconfig. +// options - VirtualHubIPConfigurationClientBeginDeleteOptions contains the optional parameters for the VirtualHubIPConfigurationClient.BeginDelete +// method. +func (client *VirtualHubIPConfigurationClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientBeginDeleteOptions) (*runtime.Poller[VirtualHubIPConfigurationClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, ipConfigName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubIPConfigurationClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubIPConfigurationClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VirtualHubIpConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubIPConfigurationClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualHubIPConfigurationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if ipConfigName == "" { + return nil, errors.New("parameter ipConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigName}", url.PathEscape(ipConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a Virtual Hub Ip configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// ipConfigName - The name of the ipconfig. +// options - VirtualHubIPConfigurationClientGetOptions contains the optional parameters for the VirtualHubIPConfigurationClient.Get +// method. +func (client *VirtualHubIPConfigurationClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientGetOptions) (VirtualHubIPConfigurationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, ipConfigName, options) + if err != nil { + return VirtualHubIPConfigurationClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubIPConfigurationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubIPConfigurationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualHubIPConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, ipConfigName string, options *VirtualHubIPConfigurationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if ipConfigName == "" { + return nil, errors.New("parameter ipConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ipConfigName}", url.PathEscape(ipConfigName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualHubIPConfigurationClient) getHandleResponse(resp *http.Response) (VirtualHubIPConfigurationClientGetResponse, error) { + result := VirtualHubIPConfigurationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HubIPConfiguration); err != nil { + return VirtualHubIPConfigurationClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all VirtualHubIpConfigurations. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubIPConfigurationClientListOptions contains the optional parameters for the VirtualHubIPConfigurationClient.List +// method. +func (client *VirtualHubIPConfigurationClient) NewListPager(resourceGroupName string, virtualHubName string, options *VirtualHubIPConfigurationClientListOptions) *runtime.Pager[VirtualHubIPConfigurationClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHubIPConfigurationClientListResponse]{ + More: func(page VirtualHubIPConfigurationClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHubIPConfigurationClientListResponse) (VirtualHubIPConfigurationClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHubIPConfigurationClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubIPConfigurationClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubIPConfigurationClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualHubIPConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubIPConfigurationClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualHubIPConfigurationClient) listHandleResponse(resp *http.Response) (VirtualHubIPConfigurationClientListResponse, error) { + result := VirtualHubIPConfigurationClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubIPConfigurationResults); err != nil { + return VirtualHubIPConfigurationClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubroutetablev2s_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubroutetablev2s_client.go new file mode 100644 index 000000000..a888ccebb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubroutetablev2s_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualHubRouteTableV2SClient contains the methods for the VirtualHubRouteTableV2S group. +// Don't use this type directly, use NewVirtualHubRouteTableV2SClient() instead. +type VirtualHubRouteTableV2SClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualHubRouteTableV2SClient creates a new instance of VirtualHubRouteTableV2SClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualHubRouteTableV2SClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHubRouteTableV2SClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualHubRouteTableV2SClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the VirtualHubRouteTableV2. +// virtualHubRouteTableV2Parameters - Parameters supplied to create or update VirtualHubRouteTableV2. +// options - VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.BeginCreateOrUpdate +// method. +func (client *VirtualHubRouteTableV2SClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2, options *VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHubRouteTableV2SClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubRouteTableV2SClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubRouteTableV2SClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubRouteTableV2SClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2, options *VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualHubRouteTableV2SClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2, options *VirtualHubRouteTableV2SClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, virtualHubRouteTableV2Parameters) +} + +// BeginDelete - Deletes a VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHubRouteTableV2. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the VirtualHubRouteTableV2. +// options - VirtualHubRouteTableV2SClientBeginDeleteOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.BeginDelete +// method. +func (client *VirtualHubRouteTableV2SClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientBeginDeleteOptions) (*runtime.Poller[VirtualHubRouteTableV2SClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubRouteTableV2SClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubRouteTableV2SClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubRouteTableV2SClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualHubRouteTableV2SClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a VirtualHubRouteTableV2. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHubRouteTableV2. +// virtualHubName - The name of the VirtualHub. +// routeTableName - The name of the VirtualHubRouteTableV2. +// options - VirtualHubRouteTableV2SClientGetOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.Get +// method. +func (client *VirtualHubRouteTableV2SClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientGetOptions) (VirtualHubRouteTableV2SClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routeTableName, options) + if err != nil { + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubRouteTableV2SClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualHubRouteTableV2SClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, options *VirtualHubRouteTableV2SClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routeTableName == "" { + return nil, errors.New("parameter routeTableName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routeTableName}", url.PathEscape(routeTableName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualHubRouteTableV2SClient) getHandleResponse(resp *http.Response) (VirtualHubRouteTableV2SClientGetResponse, error) { + result := VirtualHubRouteTableV2SClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHubRouteTableV2); err != nil { + return VirtualHubRouteTableV2SClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Retrieves the details of all VirtualHubRouteTableV2s. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubRouteTableV2SClientListOptions contains the optional parameters for the VirtualHubRouteTableV2SClient.List +// method. +func (client *VirtualHubRouteTableV2SClient) NewListPager(resourceGroupName string, virtualHubName string, options *VirtualHubRouteTableV2SClientListOptions) *runtime.Pager[VirtualHubRouteTableV2SClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHubRouteTableV2SClientListResponse]{ + More: func(page VirtualHubRouteTableV2SClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHubRouteTableV2SClientListResponse) (VirtualHubRouteTableV2SClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHubRouteTableV2SClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubRouteTableV2SClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubRouteTableV2SClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualHubRouteTableV2SClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubRouteTableV2SClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualHubRouteTableV2SClient) listHandleResponse(resp *http.Response) (VirtualHubRouteTableV2SClientListResponse, error) { + result := VirtualHubRouteTableV2SClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubRouteTableV2SResult); err != nil { + return VirtualHubRouteTableV2SClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubs_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubs_client.go new file mode 100644 index 000000000..6e9261315 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualhubs_client.go @@ -0,0 +1,624 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualHubsClient contains the methods for the VirtualHubs group. +// Don't use this type directly, use NewVirtualHubsClient() instead. +type VirtualHubsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualHubsClient creates a new instance of VirtualHubsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualHubsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualHubsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// virtualHubParameters - Parameters supplied to create or update VirtualHub. +// options - VirtualHubsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHubsClient.BeginCreateOrUpdate +// method. +func (client *VirtualHubsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub, options *VirtualHubsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHubsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, virtualHubParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub, options *VirtualHubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, virtualHubParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualHubsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub, options *VirtualHubsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, virtualHubParameters) +} + +// BeginDelete - Deletes a VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubsClientBeginDeleteOptions contains the optional parameters for the VirtualHubsClient.BeginDelete method. +func (client *VirtualHubsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginDeleteOptions) (*runtime.Poller[VirtualHubsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualHubsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a VirtualHub. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubsClientGetOptions contains the optional parameters for the VirtualHubsClient.Get method. +func (client *VirtualHubsClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientGetOptions) (VirtualHubsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return VirtualHubsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualHubsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualHubsClient) getHandleResponse(resp *http.Response) (VirtualHubsClientGetResponse, error) { + result := VirtualHubsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHub); err != nil { + return VirtualHubsClientGetResponse{}, err + } + return result, nil +} + +// BeginGetEffectiveVirtualHubRoutes - Gets the effective routes configured for the Virtual Hub resource or the specified +// resource . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// options - VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetEffectiveVirtualHubRoutes +// method. +func (client *VirtualHubsClient) BeginGetEffectiveVirtualHubRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions) (*runtime.Poller[VirtualHubsClientGetEffectiveVirtualHubRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getEffectiveVirtualHubRoutes(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubsClientGetEffectiveVirtualHubRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetEffectiveVirtualHubRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetEffectiveVirtualHubRoutes - Gets the effective routes configured for the Virtual Hub resource or the specified resource +// . +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubsClient) getEffectiveVirtualHubRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions) (*http.Response, error) { + req, err := client.getEffectiveVirtualHubRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getEffectiveVirtualHubRoutesCreateRequest creates the GetEffectiveVirtualHubRoutes request. +func (client *VirtualHubsClient) getEffectiveVirtualHubRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *VirtualHubsClientBeginGetEffectiveVirtualHubRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/effectiveRoutes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.EffectiveRoutesParameters != nil { + return req, runtime.MarshalAsJSON(req, *options.EffectiveRoutesParameters) + } + return req, nil +} + +// BeginGetInboundRoutes - Gets the inbound routes configured for the Virtual Hub on a particular connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// getInboundRoutesParameters - Parameters supplied to get the inbound routes for a connection resource. +// options - VirtualHubsClientBeginGetInboundRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetInboundRoutes +// method. +func (client *VirtualHubsClient) BeginGetInboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getInboundRoutesParameters GetInboundRoutesParameters, options *VirtualHubsClientBeginGetInboundRoutesOptions) (*runtime.Poller[VirtualHubsClientGetInboundRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getInboundRoutes(ctx, resourceGroupName, virtualHubName, getInboundRoutesParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubsClientGetInboundRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetInboundRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetInboundRoutes - Gets the inbound routes configured for the Virtual Hub on a particular connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubsClient) getInboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getInboundRoutesParameters GetInboundRoutesParameters, options *VirtualHubsClientBeginGetInboundRoutesOptions) (*http.Response, error) { + req, err := client.getInboundRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, getInboundRoutesParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getInboundRoutesCreateRequest creates the GetInboundRoutes request. +func (client *VirtualHubsClient) getInboundRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, getInboundRoutesParameters GetInboundRoutesParameters, options *VirtualHubsClientBeginGetInboundRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/inboundRoutes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, getInboundRoutesParameters) +} + +// BeginGetOutboundRoutes - Gets the outbound routes configured for the Virtual Hub on a particular connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// getOutboundRoutesParameters - Parameters supplied to get the outbound routes for a connection resource. +// options - VirtualHubsClientBeginGetOutboundRoutesOptions contains the optional parameters for the VirtualHubsClient.BeginGetOutboundRoutes +// method. +func (client *VirtualHubsClient) BeginGetOutboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getOutboundRoutesParameters GetOutboundRoutesParameters, options *VirtualHubsClientBeginGetOutboundRoutesOptions) (*runtime.Poller[VirtualHubsClientGetOutboundRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getOutboundRoutes(ctx, resourceGroupName, virtualHubName, getOutboundRoutesParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualHubsClientGetOutboundRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualHubsClientGetOutboundRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetOutboundRoutes - Gets the outbound routes configured for the Virtual Hub on a particular connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualHubsClient) getOutboundRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, getOutboundRoutesParameters GetOutboundRoutesParameters, options *VirtualHubsClientBeginGetOutboundRoutesOptions) (*http.Response, error) { + req, err := client.getOutboundRoutesCreateRequest(ctx, resourceGroupName, virtualHubName, getOutboundRoutesParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getOutboundRoutesCreateRequest creates the GetOutboundRoutes request. +func (client *VirtualHubsClient) getOutboundRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, getOutboundRoutesParameters GetOutboundRoutesParameters, options *VirtualHubsClientBeginGetOutboundRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/outboundRoutes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, getOutboundRoutesParameters) +} + +// NewListPager - Lists all the VirtualHubs in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualHubsClientListOptions contains the optional parameters for the VirtualHubsClient.List method. +func (client *VirtualHubsClient) NewListPager(options *VirtualHubsClientListOptions) *runtime.Pager[VirtualHubsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHubsClientListResponse]{ + More: func(page VirtualHubsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHubsClientListResponse) (VirtualHubsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHubsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualHubsClient) listCreateRequest(ctx context.Context, options *VirtualHubsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualHubsClient) listHandleResponse(resp *http.Response) (VirtualHubsClientListResponse, error) { + result := VirtualHubsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubsResult); err != nil { + return VirtualHubsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the VirtualHubs in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// options - VirtualHubsClientListByResourceGroupOptions contains the optional parameters for the VirtualHubsClient.ListByResourceGroup +// method. +func (client *VirtualHubsClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualHubsClientListByResourceGroupOptions) *runtime.Pager[VirtualHubsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualHubsClientListByResourceGroupResponse]{ + More: func(page VirtualHubsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualHubsClientListByResourceGroupResponse) (VirtualHubsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualHubsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualHubsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualHubsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualHubsClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualHubsClientListByResourceGroupResponse, error) { + result := VirtualHubsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubsResult); err != nil { + return VirtualHubsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates VirtualHub tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualHub. +// virtualHubName - The name of the VirtualHub. +// virtualHubParameters - Parameters supplied to update VirtualHub tags. +// options - VirtualHubsClientUpdateTagsOptions contains the optional parameters for the VirtualHubsClient.UpdateTags method. +func (client *VirtualHubsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters TagsObject, options *VirtualHubsClientUpdateTagsOptions) (VirtualHubsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualHubName, virtualHubParameters, options) + if err != nil { + return VirtualHubsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualHubsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualHubsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualHubsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters TagsObject, options *VirtualHubsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, virtualHubParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VirtualHubsClient) updateTagsHandleResponse(resp *http.Response) (VirtualHubsClientUpdateTagsResponse, error) { + result := VirtualHubsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHub); err != nil { + return VirtualHubsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewayconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewayconnections_client.go new file mode 100644 index 000000000..049ec3000 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewayconnections_client.go @@ -0,0 +1,840 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkGatewayConnectionsClient contains the methods for the VirtualNetworkGatewayConnections group. +// Don't use this type directly, use NewVirtualNetworkGatewayConnectionsClient() instead. +type VirtualNetworkGatewayConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworkGatewayConnectionsClient creates a new instance of VirtualNetworkGatewayConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkGatewayConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewayConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection. +// parameters - Parameters supplied to the create or update virtual network gateway connection operation. +// options - VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, options *VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, options *VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkGatewayConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, options *VirtualNetworkGatewayConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified virtual network Gateway connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection. +// options - VirtualNetworkGatewayConnectionsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginDelete +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified virtual network Gateway connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkGatewayConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified virtual network gateway connection by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection. +// options - VirtualNetworkGatewayConnectionsClientGetOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.Get +// method. +func (client *VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientGetOptions) (VirtualNetworkGatewayConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkGatewayConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkGatewayConnectionsClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsClientGetResponse, error) { + result := VirtualNetworkGatewayConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayConnection); err != nil { + return VirtualNetworkGatewayConnectionsClientGetResponse{}, err + } + return result, nil +} + +// BeginGetIkeSas - Lists IKE Security Associations for the virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway Connection. +// options - VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginGetIkeSas +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginGetIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientGetIkeSasResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getIkeSas(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientGetIkeSasResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientGetIkeSasResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetIkeSas - Lists IKE Security Associations for the virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) getIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions) (*http.Response, error) { + req, err := client.getIkeSasCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getIkeSasCreateRequest creates the GetIkeSas request. +func (client *VirtualNetworkGatewayConnectionsClient) getIkeSasCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginGetIkeSasOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetSharedKey - The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified virtual +// network gateway connection shared key through Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The virtual network gateway connection shared key name. +// options - VirtualNetworkGatewayConnectionsClientGetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.GetSharedKey +// method. +func (client *VirtualNetworkGatewayConnectionsClient) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientGetSharedKeyOptions) (VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse, error) { + req, err := client.getSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, runtime.NewResponseError(resp) + } + return client.getSharedKeyHandleResponse(resp) +} + +// getSharedKeyCreateRequest creates the GetSharedKey request. +func (client *VirtualNetworkGatewayConnectionsClient) getSharedKeyCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientGetSharedKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSharedKeyHandleResponse handles the GetSharedKey response. +func (client *VirtualNetworkGatewayConnectionsClient) getSharedKeyHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse, error) { + result := VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionSharedKey); err != nil { + return VirtualNetworkGatewayConnectionsClientGetSharedKeyResponse{}, err + } + return result, nil +} + +// NewListPager - The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections +// created. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualNetworkGatewayConnectionsClientListOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.List +// method. +func (client *VirtualNetworkGatewayConnectionsClient) NewListPager(resourceGroupName string, options *VirtualNetworkGatewayConnectionsClientListOptions) *runtime.Pager[VirtualNetworkGatewayConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewayConnectionsClientListResponse]{ + More: func(page VirtualNetworkGatewayConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkGatewayConnectionsClientListResponse) (VirtualNetworkGatewayConnectionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkGatewayConnectionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewayConnectionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewayConnectionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworkGatewayConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworkGatewayConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualNetworkGatewayConnectionsClient) listHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsClientListResponse, error) { + result := VirtualNetworkGatewayConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayConnectionListResult); err != nil { + return VirtualNetworkGatewayConnectionsClientListResponse{}, err + } + return result, nil +} + +// BeginResetConnection - Resets the virtual network gateway connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway Connection. +// options - VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginResetConnection +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginResetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientResetConnectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetConnection(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientResetConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientResetConnectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResetConnection - Resets the virtual network gateway connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) resetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions) (*http.Response, error) { + req, err := client.resetConnectionCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetConnectionCreateRequest creates the ResetConnection request. +func (client *VirtualNetworkGatewayConnectionsClient) resetConnectionCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginResetConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginResetSharedKey - The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection +// shared key for passed virtual network gateway connection in the specified resource group +// through Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The virtual network gateway connection reset shared key Name. +// parameters - Parameters supplied to the begin reset virtual network gateway connection shared key operation through network +// resource provider. +// options - VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginResetSharedKey +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetSharedKey(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientResetSharedKeyResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResetSharedKey - The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection +// shared key for passed virtual network gateway connection in the specified resource group +// through Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) resetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions) (*http.Response, error) { + req, err := client.resetSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetSharedKeyCreateRequest creates the ResetSharedKey request. +func (client *VirtualNetworkGatewayConnectionsClient) resetSharedKeyCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginResetSharedKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginSetSharedKey - The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection +// shared key for passed virtual network gateway connection in the specified resource group through +// Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The virtual network gateway connection name. +// parameters - Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation throughNetwork +// resource provider. +// options - VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginSetSharedKey +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginSetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.setSharedKey(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientSetSharedKeyResponse](options.ResumeToken, client.pl, nil) + } +} + +// SetSharedKey - The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared +// key for passed virtual network gateway connection in the specified resource group through +// Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) setSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions) (*http.Response, error) { + req, err := client.setSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// setSharedKeyCreateRequest creates the SetSharedKey request. +func (client *VirtualNetworkGatewayConnectionsClient) setSharedKeyCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, options *VirtualNetworkGatewayConnectionsClientBeginSetSharedKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginStartPacketCapture - Starts packet capture on virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection. +// options - VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions contains the optional parameters for the +// VirtualNetworkGatewayConnectionsClient.BeginStartPacketCapture method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginStartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientStartPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartPacketCapture - Starts packet capture on virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) startPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions) (*http.Response, error) { + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startPacketCaptureCreateRequest creates the StartPacketCapture request. +func (client *VirtualNetworkGatewayConnectionsClient) startPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, options *VirtualNetworkGatewayConnectionsClientBeginStartPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginStopPacketCapture - Stops packet capture on virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway Connection. +// parameters - Virtual network gateway packet capture parameters supplied to stop packet capture on gateway connection. +// options - VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions contains the optional parameters for the +// VirtualNetworkGatewayConnectionsClient.BeginStopPacketCapture method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginStopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientStopPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StopPacketCapture - Stops packet capture on virtual network gateway connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) stopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions) (*http.Response, error) { + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopPacketCaptureCreateRequest creates the StopPacketCapture request. +func (client *VirtualNetworkGatewayConnectionsClient) stopPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewayConnectionsClientBeginStopPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdateTags - Updates a virtual network gateway connection tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection. +// parameters - Parameters supplied to update virtual network gateway connection tags. +// options - VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the VirtualNetworkGatewayConnectionsClient.BeginUpdateTags +// method. +func (client *VirtualNetworkGatewayConnectionsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject, options *VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions) (*runtime.Poller[VirtualNetworkGatewayConnectionsClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayConnectionsClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayConnectionsClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates a virtual network gateway connection tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayConnectionsClient) updateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject, options *VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualNetworkGatewayConnectionsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject, options *VirtualNetworkGatewayConnectionsClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewaynatrules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewaynatrules_client.go new file mode 100644 index 000000000..e56f4436c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgatewaynatrules_client.go @@ -0,0 +1,331 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkGatewayNatRulesClient contains the methods for the VirtualNetworkGatewayNatRules group. +// Don't use this type directly, use NewVirtualNetworkGatewayNatRulesClient() instead. +type VirtualNetworkGatewayNatRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworkGatewayNatRulesClient creates a new instance of VirtualNetworkGatewayNatRulesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworkGatewayNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkGatewayNatRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewayNatRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the existing +// nat rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// natRuleParameters - Parameters supplied to create or Update a Nat Rule. +// options - VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkGatewayNatRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule, options *VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayNatRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the existing +// nat rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayNatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule, options *VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkGatewayNatRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule, options *VirtualNetworkGatewayNatRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, natRuleParameters) +} + +// BeginDelete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// options - VirtualNetworkGatewayNatRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.BeginDelete +// method. +func (client *VirtualNetworkGatewayNatRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkGatewayNatRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewayNatRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewayNatRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewayNatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkGatewayNatRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a nat rule. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - The name of the gateway. +// natRuleName - The name of the nat rule. +// options - VirtualNetworkGatewayNatRulesClientGetOptions contains the optional parameters for the VirtualNetworkGatewayNatRulesClient.Get +// method. +func (client *VirtualNetworkGatewayNatRulesClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientGetOptions) (VirtualNetworkGatewayNatRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, options) + if err != nil { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkGatewayNatRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, options *VirtualNetworkGatewayNatRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if natRuleName == "" { + return nil, errors.New("parameter natRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{natRuleName}", url.PathEscape(natRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkGatewayNatRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewayNatRulesClientGetResponse, error) { + result := VirtualNetworkGatewayNatRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayNatRule); err != nil { + return VirtualNetworkGatewayNatRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByVirtualNetworkGatewayPager - Retrieves all nat rules for a particular virtual network gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the virtual network gateway. +// virtualNetworkGatewayName - The name of the gateway. +// options - VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions contains the optional parameters for the +// VirtualNetworkGatewayNatRulesClient.ListByVirtualNetworkGateway method. +func (client *VirtualNetworkGatewayNatRulesClient) NewListByVirtualNetworkGatewayPager(resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions) *runtime.Pager[VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse]{ + More: func(page VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse) (VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVirtualNetworkGatewayCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse{}, runtime.NewResponseError(resp) + } + return client.listByVirtualNetworkGatewayHandleResponse(resp) + }, + }) +} + +// listByVirtualNetworkGatewayCreateRequest creates the ListByVirtualNetworkGateway request. +func (client *VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVirtualNetworkGatewayHandleResponse handles the ListByVirtualNetworkGateway response. +func (client *VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayHandleResponse(resp *http.Response) (VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse, error) { + result := VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualNetworkGatewayNatRulesResult); err != nil { + return VirtualNetworkGatewayNatRulesClientListByVirtualNetworkGatewayResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgateways_client.go new file mode 100644 index 000000000..585a830ef --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkgateways_client.go @@ -0,0 +1,1508 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkGatewaysClient contains the methods for the VirtualNetworkGateways group. +// Don't use this type directly, use NewVirtualNetworkGatewaysClient() instead. +type VirtualNetworkGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworkGatewaysClient creates a new instance of VirtualNetworkGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworkGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// parameters - Parameters supplied to create or update virtual network gateway operation. +// options - VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, options *VirtualNetworkGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified virtual network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginDelete +// method. +func (client *VirtualNetworkGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified virtual network gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDisconnectVirtualNetworkGatewayVPNConnections - Disconnect vpn connections of virtual network gateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// request - The parameters are supplied to disconnect vpn connections. +// options - VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions contains the optional parameters +// for the VirtualNetworkGatewaysClient.BeginDisconnectVirtualNetworkGatewayVPNConnections method. +func (client *VirtualNetworkGatewaysClient) BeginDisconnectVirtualNetworkGatewayVPNConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.disconnectVirtualNetworkGatewayVPNConnections(ctx, resourceGroupName, virtualNetworkGatewayName, request, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientDisconnectVirtualNetworkGatewayVPNConnectionsResponse](options.ResumeToken, client.pl, nil) + } +} + +// DisconnectVirtualNetworkGatewayVPNConnections - Disconnect vpn connections of virtual network gateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*http.Response, error) { + req, err := client.disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, request, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest creates the DisconnectVirtualNetworkGatewayVPNConnections request. +func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNConnectionsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVPNConnectionRequest, options *VirtualNetworkGatewaysClientBeginDisconnectVirtualNetworkGatewayVPNConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// BeginGenerateVPNProfile - Generates VPN profile for P2S client of the virtual network gateway in the specified resource +// group. Used for IKEV2 and radius based authentication. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// parameters - Parameters supplied to the generate virtual network gateway VPN client package operation. +// options - VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGenerateVPNProfile +// method. +func (client *VirtualNetworkGatewaysClient) BeginGenerateVPNProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGenerateVPNProfileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateVPNProfile(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGenerateVPNProfileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGenerateVPNProfileResponse](options.ResumeToken, client.pl, nil) + } +} + +// GenerateVPNProfile - Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. +// Used for IKEV2 and radius based authentication. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) generateVPNProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*http.Response, error) { + req, err := client.generateVPNProfileCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generateVPNProfileCreateRequest creates the GenerateVPNProfile request. +func (client *VirtualNetworkGatewaysClient) generateVPNProfileCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGenerateVPNProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGeneratevpnclientpackage - Generates VPN client package for P2S client of the virtual network gateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// parameters - Parameters supplied to the generate virtual network gateway VPN client package operation. +// options - VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGeneratevpnclientpackage +// method. +func (client *VirtualNetworkGatewaysClient) BeginGeneratevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generatevpnclientpackage(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGeneratevpnclientpackageResponse](options.ResumeToken, client.pl, nil) + } +} + +// Generatevpnclientpackage - Generates VPN client package for P2S client of the virtual network gateway in the specified +// resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*http.Response, error) { + req, err := client.generatevpnclientpackageCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// generatevpnclientpackageCreateRequest creates the Generatevpnclientpackage request. +func (client *VirtualNetworkGatewaysClient) generatevpnclientpackageCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNClientParameters, options *VirtualNetworkGatewaysClientBeginGeneratevpnclientpackageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Get - Gets the specified virtual network gateway by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientGetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.Get +// method. +func (client *VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientGetOptions) (VirtualNetworkGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return VirtualNetworkGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkGatewaysClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientGetResponse, error) { + result := VirtualNetworkGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGateway); err != nil { + return VirtualNetworkGatewaysClientGetResponse{}, err + } + return result, nil +} + +// BeginGetAdvertisedRoutes - This operation retrieves a list of routes the virtual network gateway is advertising to the +// specified peer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// peer - The IP address of the peer. +// options - VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetAdvertisedRoutes +// method. +func (client *VirtualNetworkGatewaysClient) BeginGetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getAdvertisedRoutes(ctx, resourceGroupName, virtualNetworkGatewayName, peer, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetAdvertisedRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetAdvertisedRoutes - This operation retrieves a list of routes the virtual network gateway is advertising to the specified +// peer. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*http.Response, error) { + req, err := client.getAdvertisedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, peer, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getAdvertisedRoutesCreateRequest creates the GetAdvertisedRoutes request. +func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string, options *VirtualNetworkGatewaysClientBeginGetAdvertisedRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("peer", peer) + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetBgpPeerStatus - The GetBgpPeerStatus operation retrieves the status of all BGP peers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetBgpPeerStatus +// method. +func (client *VirtualNetworkGatewaysClient) BeginGetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getBgpPeerStatus(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetBgpPeerStatusResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetBgpPeerStatus - The GetBgpPeerStatus operation retrieves the status of all BGP peers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*http.Response, error) { + req, err := client.getBgpPeerStatusCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getBgpPeerStatusCreateRequest creates the GetBgpPeerStatus request. +func (client *VirtualNetworkGatewaysClient) getBgpPeerStatusCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetBgpPeerStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Peer != nil { + reqQP.Set("peer", *options.Peer) + } + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetLearnedRoutes - This operation retrieves a list of routes the virtual network gateway has learned, including routes +// learned from BGP peers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetLearnedRoutes +// method. +func (client *VirtualNetworkGatewaysClient) BeginGetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetLearnedRoutesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getLearnedRoutes(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetLearnedRoutesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetLearnedRoutesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetLearnedRoutes - This operation retrieves a list of routes the virtual network gateway has learned, including routes +// learned from BGP peers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*http.Response, error) { + req, err := client.getLearnedRoutesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getLearnedRoutesCreateRequest creates the GetLearnedRoutes request. +func (client *VirtualNetworkGatewaysClient) getLearnedRoutesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetLearnedRoutesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetVPNProfilePackageURL - Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified +// resource group. The profile needs to be generated first using generateVpnProfile. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginGetVPNProfilePackageURL +// method. +func (client *VirtualNetworkGatewaysClient) BeginGetVPNProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getVPNProfilePackageURL(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVPNProfilePackageURLResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetVPNProfilePackageURL - Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified +// resource group. The profile needs to be generated first using generateVpnProfile. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*http.Response, error) { + req, err := client.getVPNProfilePackageURLCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getVPNProfilePackageURLCreateRequest creates the GetVPNProfilePackageURL request. +func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURLCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVPNProfilePackageURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetVpnclientConnectionHealth - Get VPN client connection health detail per P2S client connection of the virtual network +// gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions contains the optional parameters for the +// VirtualNetworkGatewaysClient.BeginGetVpnclientConnectionHealth method. +func (client *VirtualNetworkGatewaysClient) BeginGetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getVpnclientConnectionHealth(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVpnclientConnectionHealthResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetVpnclientConnectionHealth - Get VPN client connection health detail per P2S client connection of the virtual network +// gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*http.Response, error) { + req, err := client.getVpnclientConnectionHealthCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getVpnclientConnectionHealthCreateRequest creates the GetVpnclientConnectionHealth request. +func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealthCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientConnectionHealthOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginGetVpnclientIPSecParameters - The Get VpnclientIpsecParameters operation retrieves information about the vpnclient +// ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource +// provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The virtual network gateway name. +// options - VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions contains the optional parameters for the +// VirtualNetworkGatewaysClient.BeginGetVpnclientIPSecParameters method. +func (client *VirtualNetworkGatewaysClient) BeginGetVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*runtime.Poller[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getVpnclientIPSecParameters(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientGetVpnclientIPSecParametersResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetVpnclientIPSecParameters - The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec +// policy for P2S client of virtual network gateway in the specified resource group through Network resource +// provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*http.Response, error) { + req, err := client.getVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getVpnclientIPSecParametersCreateRequest creates the GetVpnclientIPSecParameters request. +func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParametersCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginGetVpnclientIPSecParametersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListPager - Gets all virtual network gateways by resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualNetworkGatewaysClientListOptions contains the optional parameters for the VirtualNetworkGatewaysClient.List +// method. +func (client *VirtualNetworkGatewaysClient) NewListPager(resourceGroupName string, options *VirtualNetworkGatewaysClientListOptions) *runtime.Pager[VirtualNetworkGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewaysClientListResponse]{ + More: func(page VirtualNetworkGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkGatewaysClientListResponse) (VirtualNetworkGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworkGatewaysClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworkGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualNetworkGatewaysClient) listHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientListResponse, error) { + result := VirtualNetworkGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListResult); err != nil { + return VirtualNetworkGatewaysClientListResponse{}, err + } + return result, nil +} + +// NewListConnectionsPager - Gets all the connections in a virtual network gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientListConnectionsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.ListConnections +// method. +func (client *VirtualNetworkGatewaysClient) NewListConnectionsPager(resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientListConnectionsOptions) *runtime.Pager[VirtualNetworkGatewaysClientListConnectionsResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkGatewaysClientListConnectionsResponse]{ + More: func(page VirtualNetworkGatewaysClientListConnectionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkGatewaysClientListConnectionsResponse) (VirtualNetworkGatewaysClientListConnectionsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listConnectionsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkGatewaysClientListConnectionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewaysClientListConnectionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewaysClientListConnectionsResponse{}, runtime.NewResponseError(resp) + } + return client.listConnectionsHandleResponse(resp) + }, + }) +} + +// listConnectionsCreateRequest creates the ListConnections request. +func (client *VirtualNetworkGatewaysClient) listConnectionsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientListConnectionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listConnectionsHandleResponse handles the ListConnections response. +func (client *VirtualNetworkGatewaysClient) listConnectionsHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientListConnectionsResponse, error) { + result := VirtualNetworkGatewaysClientListConnectionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListConnectionsResult); err != nil { + return VirtualNetworkGatewaysClientListConnectionsResponse{}, err + } + return result, nil +} + +// BeginReset - Resets the primary of the virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginResetOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginReset +// method. +func (client *VirtualNetworkGatewaysClient) BeginReset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*runtime.Poller[VirtualNetworkGatewaysClientResetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reset(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientResetResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reset - Resets the primary of the virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*http.Response, error) { + req, err := client.resetCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetCreateRequest creates the Reset request. +func (client *VirtualNetworkGatewaysClient) resetCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.GatewayVip != nil { + reqQP.Set("gatewayVip", *options.GatewayVip) + } + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginResetVPNClientSharedKey - Resets the VPN client shared key of the virtual network gateway in the specified resource +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginResetVPNClientSharedKey +// method. +func (client *VirtualNetworkGatewaysClient) BeginResetVPNClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*runtime.Poller[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetVPNClientSharedKey(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientResetVPNClientSharedKeyResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResetVPNClientSharedKey - Resets the VPN client shared key of the virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*http.Response, error) { + req, err := client.resetVPNClientSharedKeyCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetVPNClientSharedKeyCreateRequest creates the ResetVPNClientSharedKey request. +func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKeyCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginResetVPNClientSharedKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginSetVpnclientIPSecParameters - The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client +// of virtual network gateway in the specified resource group through Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// vpnclientIPSecParams - Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client +// operation through Network resource provider. +// options - VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions contains the optional parameters for the +// VirtualNetworkGatewaysClient.BeginSetVpnclientIPSecParameters method. +func (client *VirtualNetworkGatewaysClient) BeginSetVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*runtime.Poller[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.setVpnclientIPSecParameters(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIPSecParams, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientSetVpnclientIPSecParametersResponse](options.ResumeToken, client.pl, nil) + } +} + +// SetVpnclientIPSecParameters - The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client +// of virtual network gateway in the specified resource group through Network resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*http.Response, error) { + req, err := client.setVpnclientIPSecParametersCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIPSecParams, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// setVpnclientIPSecParametersCreateRequest creates the SetVpnclientIPSecParameters request. +func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParametersCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIPSecParams VPNClientIPsecParameters, options *VirtualNetworkGatewaysClientBeginSetVpnclientIPSecParametersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnclientIPSecParams) +} + +// BeginStartPacketCapture - Starts packet capture on virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStartPacketCapture +// method. +func (client *VirtualNetworkGatewaysClient) BeginStartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStartPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientStartPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartPacketCapture - Starts packet capture on virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) startPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*http.Response, error) { + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startPacketCaptureCreateRequest creates the StartPacketCapture request. +func (client *VirtualNetworkGatewaysClient) startPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientBeginStartPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginStopPacketCapture - Stops packet capture on virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// parameters - Virtual network gateway packet capture parameters supplied to stop packet capture on gateway. +// options - VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginStopPacketCapture +// method. +func (client *VirtualNetworkGatewaysClient) BeginStopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*runtime.Poller[VirtualNetworkGatewaysClientStopPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopPacketCapture(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientStopPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StopPacketCapture - Stops packet capture on virtual network gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) stopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*http.Response, error) { + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopPacketCaptureCreateRequest creates the StopPacketCapture request. +func (client *VirtualNetworkGatewaysClient) stopPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VPNPacketCaptureStopParameters, options *VirtualNetworkGatewaysClientBeginStopPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// SupportedVPNDevices - Gets a xml format representation for supported vpn devices. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// options - VirtualNetworkGatewaysClientSupportedVPNDevicesOptions contains the optional parameters for the VirtualNetworkGatewaysClient.SupportedVPNDevices +// method. +func (client *VirtualNetworkGatewaysClient) SupportedVPNDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientSupportedVPNDevicesOptions) (VirtualNetworkGatewaysClientSupportedVPNDevicesResponse, error) { + req, err := client.supportedVPNDevicesCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, options) + if err != nil { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, runtime.NewResponseError(resp) + } + return client.supportedVPNDevicesHandleResponse(resp) +} + +// supportedVPNDevicesCreateRequest creates the SupportedVPNDevices request. +func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, options *VirtualNetworkGatewaysClientSupportedVPNDevicesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// supportedVPNDevicesHandleResponse handles the SupportedVPNDevices response. +func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientSupportedVPNDevicesResponse, error) { + result := VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { + return VirtualNetworkGatewaysClientSupportedVPNDevicesResponse{}, err + } + return result, nil +} + +// BeginUpdateTags - Updates a virtual network gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayName - The name of the virtual network gateway. +// parameters - Parameters supplied to update virtual network gateway tags. +// options - VirtualNetworkGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the VirtualNetworkGatewaysClient.BeginUpdateTags +// method. +func (client *VirtualNetworkGatewaysClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*runtime.Poller[VirtualNetworkGatewaysClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkGatewaysClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates a virtual network gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualNetworkGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject, options *VirtualNetworkGatewaysClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayName == "" { + return nil, errors.New("parameter virtualNetworkGatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayName}", url.PathEscape(virtualNetworkGatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// VPNDeviceConfigurationScript - Gets a xml format representation for vpn device configuration script. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkGatewayConnectionName - The name of the virtual network gateway connection for which the configuration script +// is generated. +// parameters - Parameters supplied to the generate vpn device script operation. +// options - VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions contains the optional parameters for the VirtualNetworkGatewaysClient.VPNDeviceConfigurationScript +// method. +func (client *VirtualNetworkGatewaysClient) VPNDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNDeviceScriptParameters, options *VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions) (VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse, error) { + req, err := client.vpnDeviceConfigurationScriptCreateRequest(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) + if err != nil { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, runtime.NewResponseError(resp) + } + return client.vpnDeviceConfigurationScriptHandleResponse(resp) +} + +// vpnDeviceConfigurationScriptCreateRequest creates the VPNDeviceConfigurationScript request. +func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VPNDeviceScriptParameters, options *VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkGatewayConnectionName == "" { + return nil, errors.New("parameter virtualNetworkGatewayConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkGatewayConnectionName}", url.PathEscape(virtualNetworkGatewayConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// vpnDeviceConfigurationScriptHandleResponse handles the VPNDeviceConfigurationScript response. +func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptHandleResponse(resp *http.Response) (VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse, error) { + result := VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { + return VirtualNetworkGatewaysClientVPNDeviceConfigurationScriptResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkpeerings_client.go new file mode 100644 index 000000000..0a6a19c19 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworkpeerings_client.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkPeeringsClient contains the methods for the VirtualNetworkPeerings group. +// Don't use this type directly, use NewVirtualNetworkPeeringsClient() instead. +type VirtualNetworkPeeringsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworkPeeringsClient creates a new instance of VirtualNetworkPeeringsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworkPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkPeeringsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkPeeringsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a peering in the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// virtualNetworkPeeringName - The name of the peering. +// virtualNetworkPeeringParameters - Parameters supplied to the create or update virtual network peering operation. +// options - VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkPeeringsClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkPeeringsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, options *VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkPeeringsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a peering in the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, options *VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkPeeringsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, options *VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if virtualNetworkPeeringName == "" { + return nil, errors.New("parameter virtualNetworkPeeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkPeeringName}", url.PathEscape(virtualNetworkPeeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.SyncRemoteAddressSpace != nil { + reqQP.Set("syncRemoteAddressSpace", string(*options.SyncRemoteAddressSpace)) + } + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, virtualNetworkPeeringParameters) +} + +// BeginDelete - Deletes the specified virtual network peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// virtualNetworkPeeringName - The name of the virtual network peering. +// options - VirtualNetworkPeeringsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkPeeringsClient.BeginDelete +// method. +func (client *VirtualNetworkPeeringsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkPeeringsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkPeeringsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified virtual network peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkPeeringsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if virtualNetworkPeeringName == "" { + return nil, errors.New("parameter virtualNetworkPeeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkPeeringName}", url.PathEscape(virtualNetworkPeeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified virtual network peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// virtualNetworkPeeringName - The name of the virtual network peering. +// options - VirtualNetworkPeeringsClientGetOptions contains the optional parameters for the VirtualNetworkPeeringsClient.Get +// method. +func (client *VirtualNetworkPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientGetOptions) (VirtualNetworkPeeringsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) + if err != nil { + return VirtualNetworkPeeringsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkPeeringsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkPeeringsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *VirtualNetworkPeeringsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if virtualNetworkPeeringName == "" { + return nil, errors.New("parameter virtualNetworkPeeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkPeeringName}", url.PathEscape(virtualNetworkPeeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkPeeringsClient) getHandleResponse(resp *http.Response) (VirtualNetworkPeeringsClientGetResponse, error) { + result := VirtualNetworkPeeringsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeering); err != nil { + return VirtualNetworkPeeringsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all virtual network peerings in a virtual network. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - VirtualNetworkPeeringsClientListOptions contains the optional parameters for the VirtualNetworkPeeringsClient.List +// method. +func (client *VirtualNetworkPeeringsClient) NewListPager(resourceGroupName string, virtualNetworkName string, options *VirtualNetworkPeeringsClientListOptions) *runtime.Pager[VirtualNetworkPeeringsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkPeeringsClientListResponse]{ + More: func(page VirtualNetworkPeeringsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkPeeringsClientListResponse) (VirtualNetworkPeeringsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkPeeringsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkPeeringsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkPeeringsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworkPeeringsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworkPeeringsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualNetworkPeeringsClient) listHandleResponse(resp *http.Response) (VirtualNetworkPeeringsClientListResponse, error) { + result := VirtualNetworkPeeringsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeeringListResult); err != nil { + return VirtualNetworkPeeringsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworks_client.go new file mode 100644 index 000000000..3a465baa6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworks_client.go @@ -0,0 +1,655 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// VirtualNetworksClient contains the methods for the VirtualNetworks group. +// Don't use this type directly, use NewVirtualNetworksClient() instead. +type VirtualNetworksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworksClient creates a new instance of VirtualNetworksClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckIPAddressAvailability - Checks whether a private IP address is available for use. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// ipAddress - The private IP address to be verified. +// options - VirtualNetworksClientCheckIPAddressAvailabilityOptions contains the optional parameters for the VirtualNetworksClient.CheckIPAddressAvailability +// method. +func (client *VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, ipAddress string, options *VirtualNetworksClientCheckIPAddressAvailabilityOptions) (VirtualNetworksClientCheckIPAddressAvailabilityResponse, error) { + req, err := client.checkIPAddressAvailabilityCreateRequest(ctx, resourceGroupName, virtualNetworkName, ipAddress, options) + if err != nil { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkIPAddressAvailabilityHandleResponse(resp) +} + +// checkIPAddressAvailabilityCreateRequest creates the CheckIPAddressAvailability request. +func (client *VirtualNetworksClient) checkIPAddressAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, ipAddress string, options *VirtualNetworksClientCheckIPAddressAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("ipAddress", ipAddress) + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// checkIPAddressAvailabilityHandleResponse handles the CheckIPAddressAvailability response. +func (client *VirtualNetworksClient) checkIPAddressAvailabilityHandleResponse(resp *http.Response) (VirtualNetworksClientCheckIPAddressAvailabilityResponse, error) { + result := VirtualNetworksClientCheckIPAddressAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IPAddressAvailabilityResult); err != nil { + return VirtualNetworksClientCheckIPAddressAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Creates or updates a virtual network in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// parameters - Parameters supplied to the create or update virtual network operation. +// options - VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a virtual network in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete +// method. +func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworksClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified virtual network. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified virtual network by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. +func (client *VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (VirtualNetworksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (VirtualNetworksClientGetResponse, error) { + result := VirtualNetworksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { + return VirtualNetworksClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all virtual networks in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualNetworksClientListOptions contains the optional parameters for the VirtualNetworksClient.List method. +func (client *VirtualNetworksClient) NewListPager(resourceGroupName string, options *VirtualNetworksClientListOptions) *runtime.Pager[VirtualNetworksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListResponse]{ + More: func(page VirtualNetworksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListResponse) (VirtualNetworksClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworksClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (VirtualNetworksClientListResponse, error) { + result := VirtualNetworksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListResult); err != nil { + return VirtualNetworksClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all virtual networks in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualNetworksClientListAllOptions contains the optional parameters for the VirtualNetworksClient.ListAll method. +func (client *VirtualNetworksClient) NewListAllPager(options *VirtualNetworksClientListAllOptions) *runtime.Pager[VirtualNetworksClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListAllResponse]{ + More: func(page VirtualNetworksClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListAllResponse) (VirtualNetworksClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworksClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualNetworksClient) listAllCreateRequest(ctx context.Context, options *VirtualNetworksClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *VirtualNetworksClient) listAllHandleResponse(resp *http.Response) (VirtualNetworksClientListAllResponse, error) { + result := VirtualNetworksClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListResult); err != nil { + return VirtualNetworksClientListAllResponse{}, err + } + return result, nil +} + +// BeginListDdosProtectionStatus - Gets the Ddos Protection Status of all IP Addresses under the Virtual Network +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - VirtualNetworksClientBeginListDdosProtectionStatusOptions contains the optional parameters for the VirtualNetworksClient.BeginListDdosProtectionStatus +// method. +func (client *VirtualNetworksClient) BeginListDdosProtectionStatus(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginListDdosProtectionStatusOptions) (*runtime.Poller[*runtime.Pager[VirtualNetworksClientListDdosProtectionStatusResponse]], error) { + pager := runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListDdosProtectionStatusResponse]{ + More: func(page VirtualNetworksClientListDdosProtectionStatusResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListDdosProtectionStatusResponse) (VirtualNetworksClientListDdosProtectionStatusResponse, error) { + req, err := runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + if err != nil { + return VirtualNetworksClientListDdosProtectionStatusResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientListDdosProtectionStatusResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListDdosProtectionStatusResponse{}, runtime.NewResponseError(resp) + } + return client.listDdosProtectionStatusHandleResponse(resp) + }, + }) + if options == nil || options.ResumeToken == "" { + resp, err := client.listDdosProtectionStatus(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[*runtime.Pager[VirtualNetworksClientListDdosProtectionStatusResponse]]{ + FinalStateVia: runtime.FinalStateViaLocation, + Response: &pager, + }) + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.pl, &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[VirtualNetworksClientListDdosProtectionStatusResponse]]{ + Response: &pager, + }) + } +} + +// ListDdosProtectionStatus - Gets the Ddos Protection Status of all IP Addresses under the Virtual Network +// Generated from API version 2022-05-01 +func (client *VirtualNetworksClient) listDdosProtectionStatus(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginListDdosProtectionStatusOptions) (*http.Response, error) { + req, err := client.listDdosProtectionStatusCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listDdosProtectionStatusCreateRequest creates the ListDdosProtectionStatus request. +func (client *VirtualNetworksClient) listDdosProtectionStatusCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginListDdosProtectionStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listDdosProtectionStatusHandleResponse handles the ListDdosProtectionStatus response. +func (client *VirtualNetworksClient) listDdosProtectionStatusHandleResponse(resp *http.Response) (VirtualNetworksClientListDdosProtectionStatusResponse, error) { + result := VirtualNetworksClientListDdosProtectionStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkDdosProtectionStatusResult); err != nil { + return VirtualNetworksClientListDdosProtectionStatusResponse{}, err + } + return result, nil +} + +// NewListUsagePager - Lists usage stats. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// options - VirtualNetworksClientListUsageOptions contains the optional parameters for the VirtualNetworksClient.ListUsage +// method. +func (client *VirtualNetworksClient) NewListUsagePager(resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientListUsageOptions) *runtime.Pager[VirtualNetworksClientListUsageResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListUsageResponse]{ + More: func(page VirtualNetworksClientListUsageResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListUsageResponse) (VirtualNetworksClientListUsageResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listUsageCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworksClientListUsageResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientListUsageResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientListUsageResponse{}, runtime.NewResponseError(resp) + } + return client.listUsageHandleResponse(resp) + }, + }) +} + +// listUsageCreateRequest creates the ListUsage request. +func (client *VirtualNetworksClient) listUsageCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientListUsageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listUsageHandleResponse handles the ListUsage response. +func (client *VirtualNetworksClient) listUsageHandleResponse(resp *http.Response) (VirtualNetworksClientListUsageResponse, error) { + result := VirtualNetworksClientListUsageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListUsageResult); err != nil { + return VirtualNetworksClientListUsageResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a virtual network tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// parameters - Parameters supplied to update virtual network tags. +// options - VirtualNetworksClientUpdateTagsOptions contains the optional parameters for the VirtualNetworksClient.UpdateTags +// method. +func (client *VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject, options *VirtualNetworksClientUpdateTagsOptions) (VirtualNetworksClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualNetworkName, parameters, options) + if err != nil { + return VirtualNetworksClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworksClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworksClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualNetworksClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject, options *VirtualNetworksClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VirtualNetworksClient) updateTagsHandleResponse(resp *http.Response) (VirtualNetworksClientUpdateTagsResponse, error) { + result := VirtualNetworksClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { + return VirtualNetworksClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworktaps_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworktaps_client.go new file mode 100644 index 000000000..e418e3847 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualnetworktaps_client.go @@ -0,0 +1,425 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworkTapsClient contains the methods for the VirtualNetworkTaps group. +// Don't use this type directly, use NewVirtualNetworkTapsClient() instead. +type VirtualNetworkTapsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualNetworkTapsClient creates a new instance of VirtualNetworkTapsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualNetworkTapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworkTapsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualNetworkTapsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Virtual Network Tap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// tapName - The name of the virtual network tap. +// parameters - Parameters supplied to the create or update virtual network tap operation. +// options - VirtualNetworkTapsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkTapsClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworkTapsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap, options *VirtualNetworkTapsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworkTapsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, tapName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkTapsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkTapsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a Virtual Network Tap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkTapsClient) createOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap, options *VirtualNetworkTapsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, tapName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworkTapsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap, options *VirtualNetworkTapsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if tapName == "" { + return nil, errors.New("parameter tapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapName}", url.PathEscape(tapName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified virtual network tap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// tapName - The name of the virtual network tap. +// options - VirtualNetworkTapsClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkTapsClient.BeginDelete +// method. +func (client *VirtualNetworkTapsClient) BeginDelete(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworkTapsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, tapName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualNetworkTapsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualNetworkTapsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified virtual network tap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualNetworkTapsClient) deleteOperation(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, tapName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualNetworkTapsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if tapName == "" { + return nil, errors.New("parameter tapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapName}", url.PathEscape(tapName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about the specified virtual network tap. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// tapName - The name of virtual network tap. +// options - VirtualNetworkTapsClientGetOptions contains the optional parameters for the VirtualNetworkTapsClient.Get method. +func (client *VirtualNetworkTapsClient) Get(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientGetOptions) (VirtualNetworkTapsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, tapName, options) + if err != nil { + return VirtualNetworkTapsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkTapsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkTapsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualNetworkTapsClient) getCreateRequest(ctx context.Context, resourceGroupName string, tapName string, options *VirtualNetworkTapsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if tapName == "" { + return nil, errors.New("parameter tapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapName}", url.PathEscape(tapName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualNetworkTapsClient) getHandleResponse(resp *http.Response) (VirtualNetworkTapsClientGetResponse, error) { + result := VirtualNetworkTapsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTap); err != nil { + return VirtualNetworkTapsClientGetResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the VirtualNetworkTaps in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualNetworkTapsClientListAllOptions contains the optional parameters for the VirtualNetworkTapsClient.ListAll +// method. +func (client *VirtualNetworkTapsClient) NewListAllPager(options *VirtualNetworkTapsClientListAllOptions) *runtime.Pager[VirtualNetworkTapsClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkTapsClientListAllResponse]{ + More: func(page VirtualNetworkTapsClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkTapsClientListAllResponse) (VirtualNetworkTapsClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkTapsClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkTapsClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkTapsClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *VirtualNetworkTapsClient) listAllCreateRequest(ctx context.Context, options *VirtualNetworkTapsClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *VirtualNetworkTapsClient) listAllHandleResponse(resp *http.Response) (VirtualNetworkTapsClientListAllResponse, error) { + result := VirtualNetworkTapsClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTapListResult); err != nil { + return VirtualNetworkTapsClientListAllResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all the VirtualNetworkTaps in a subscription. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualNetworkTapsClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworkTapsClient.ListByResourceGroup +// method. +func (client *VirtualNetworkTapsClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualNetworkTapsClientListByResourceGroupOptions) *runtime.Pager[VirtualNetworkTapsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkTapsClientListByResourceGroupResponse]{ + More: func(page VirtualNetworkTapsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworkTapsClientListByResourceGroupResponse) (VirtualNetworkTapsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualNetworkTapsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkTapsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkTapsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualNetworkTapsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworkTapsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualNetworkTapsClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualNetworkTapsClientListByResourceGroupResponse, error) { + result := VirtualNetworkTapsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTapListResult); err != nil { + return VirtualNetworkTapsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates an VirtualNetworkTap tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// tapName - The name of the tap. +// tapParameters - Parameters supplied to update VirtualNetworkTap tags. +// options - VirtualNetworkTapsClientUpdateTagsOptions contains the optional parameters for the VirtualNetworkTapsClient.UpdateTags +// method. +func (client *VirtualNetworkTapsClient) UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject, options *VirtualNetworkTapsClientUpdateTagsOptions) (VirtualNetworkTapsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, tapName, tapParameters, options) + if err != nil { + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualNetworkTapsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualNetworkTapsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject, options *VirtualNetworkTapsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if tapName == "" { + return nil, errors.New("parameter tapName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tapName}", url.PathEscape(tapName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, tapParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VirtualNetworkTapsClient) updateTagsHandleResponse(resp *http.Response) (VirtualNetworkTapsClientUpdateTagsResponse, error) { + result := VirtualNetworkTapsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTap); err != nil { + return VirtualNetworkTapsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouterpeerings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouterpeerings_client.go new file mode 100644 index 000000000..1be3b657c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouterpeerings_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualRouterPeeringsClient contains the methods for the VirtualRouterPeerings group. +// Don't use this type directly, use NewVirtualRouterPeeringsClient() instead. +type VirtualRouterPeeringsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualRouterPeeringsClient creates a new instance of VirtualRouterPeeringsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualRouterPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualRouterPeeringsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualRouterPeeringsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Virtual Router Peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// peeringName - The name of the Virtual Router Peering. +// parameters - Parameters supplied to the create or update Virtual Router Peering operation. +// options - VirtualRouterPeeringsClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualRouterPeeringsClient.BeginCreateOrUpdate +// method. +func (client *VirtualRouterPeeringsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering, options *VirtualRouterPeeringsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualRouterPeeringsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualRouterName, peeringName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualRouterPeeringsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualRouterPeeringsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Virtual Router Peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualRouterPeeringsClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering, options *VirtualRouterPeeringsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualRouterPeeringsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering, options *VirtualRouterPeeringsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified peering from a Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// peeringName - The name of the peering. +// options - VirtualRouterPeeringsClientBeginDeleteOptions contains the optional parameters for the VirtualRouterPeeringsClient.BeginDelete +// method. +func (client *VirtualRouterPeeringsClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientBeginDeleteOptions) (*runtime.Poller[VirtualRouterPeeringsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualRouterName, peeringName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualRouterPeeringsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualRouterPeeringsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified peering from a Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualRouterPeeringsClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualRouterPeeringsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Virtual Router Peering. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// peeringName - The name of the Virtual Router Peering. +// options - VirtualRouterPeeringsClientGetOptions contains the optional parameters for the VirtualRouterPeeringsClient.Get +// method. +func (client *VirtualRouterPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientGetOptions) (VirtualRouterPeeringsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualRouterName, peeringName, options) + if err != nil { + return VirtualRouterPeeringsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualRouterPeeringsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualRouterPeeringsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualRouterPeeringsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, options *VirtualRouterPeeringsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualRouterPeeringsClient) getHandleResponse(resp *http.Response) (VirtualRouterPeeringsClientGetResponse, error) { + result := VirtualRouterPeeringsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterPeering); err != nil { + return VirtualRouterPeeringsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all Virtual Router Peerings in a Virtual Router resource. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// options - VirtualRouterPeeringsClientListOptions contains the optional parameters for the VirtualRouterPeeringsClient.List +// method. +func (client *VirtualRouterPeeringsClient) NewListPager(resourceGroupName string, virtualRouterName string, options *VirtualRouterPeeringsClientListOptions) *runtime.Pager[VirtualRouterPeeringsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualRouterPeeringsClientListResponse]{ + More: func(page VirtualRouterPeeringsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualRouterPeeringsClientListResponse) (VirtualRouterPeeringsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, virtualRouterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualRouterPeeringsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualRouterPeeringsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualRouterPeeringsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualRouterPeeringsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRouterPeeringsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualRouterPeeringsClient) listHandleResponse(resp *http.Response) (VirtualRouterPeeringsClientListResponse, error) { + result := VirtualRouterPeeringsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterPeeringListResult); err != nil { + return VirtualRouterPeeringsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouters_client.go new file mode 100644 index 000000000..cb730e80f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualrouters_client.go @@ -0,0 +1,369 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualRoutersClient contains the methods for the VirtualRouters group. +// Don't use this type directly, use NewVirtualRoutersClient() instead. +type VirtualRoutersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualRoutersClient creates a new instance of VirtualRoutersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualRoutersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualRoutersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualRoutersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// parameters - Parameters supplied to the create or update Virtual Router. +// options - VirtualRoutersClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualRoutersClient.BeginCreateOrUpdate +// method. +func (client *VirtualRoutersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter, options *VirtualRoutersClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualRoutersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualRouterName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualRoutersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualRoutersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualRoutersClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter, options *VirtualRoutersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualRouterName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualRoutersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter, options *VirtualRoutersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// options - VirtualRoutersClientBeginDeleteOptions contains the optional parameters for the VirtualRoutersClient.BeginDelete +// method. +func (client *VirtualRoutersClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientBeginDeleteOptions) (*runtime.Poller[VirtualRoutersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualRouterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualRoutersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualRoutersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualRoutersClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualRouterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualRoutersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Virtual Router. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// virtualRouterName - The name of the Virtual Router. +// options - VirtualRoutersClientGetOptions contains the optional parameters for the VirtualRoutersClient.Get method. +func (client *VirtualRoutersClient) Get(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientGetOptions) (VirtualRoutersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualRouterName, options) + if err != nil { + return VirtualRoutersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualRoutersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualRoutersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualRoutersClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualRouterName string, options *VirtualRoutersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualRouterName == "" { + return nil, errors.New("parameter virtualRouterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualRouterName}", url.PathEscape(virtualRouterName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualRoutersClient) getHandleResponse(resp *http.Response) (VirtualRoutersClientGetResponse, error) { + result := VirtualRoutersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouter); err != nil { + return VirtualRoutersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the Virtual Routers in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualRoutersClientListOptions contains the optional parameters for the VirtualRoutersClient.List method. +func (client *VirtualRoutersClient) NewListPager(options *VirtualRoutersClientListOptions) *runtime.Pager[VirtualRoutersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualRoutersClientListResponse]{ + More: func(page VirtualRoutersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualRoutersClientListResponse) (VirtualRoutersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualRoutersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualRoutersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualRoutersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualRoutersClient) listCreateRequest(ctx context.Context, options *VirtualRoutersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualRoutersClient) listHandleResponse(resp *http.Response) (VirtualRoutersClientListResponse, error) { + result := VirtualRoutersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterListResult); err != nil { + return VirtualRoutersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all Virtual Routers in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - VirtualRoutersClientListByResourceGroupOptions contains the optional parameters for the VirtualRoutersClient.ListByResourceGroup +// method. +func (client *VirtualRoutersClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualRoutersClientListByResourceGroupOptions) *runtime.Pager[VirtualRoutersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualRoutersClientListByResourceGroupResponse]{ + More: func(page VirtualRoutersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualRoutersClientListByResourceGroupResponse) (VirtualRoutersClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualRoutersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualRoutersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualRoutersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualRoutersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualRoutersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualRoutersClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualRoutersClientListByResourceGroupResponse, error) { + result := VirtualRoutersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterListResult); err != nil { + return VirtualRoutersClientListByResourceGroupResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualwans_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualwans_client.go new file mode 100644 index 000000000..3a0df6b02 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/virtualwans_client.go @@ -0,0 +1,422 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualWansClient contains the methods for the VirtualWans group. +// Don't use this type directly, use NewVirtualWansClient() instead. +type VirtualWansClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVirtualWansClient creates a new instance of VirtualWansClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVirtualWansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualWansClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VirtualWansClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualWan. +// virtualWANName - The name of the VirtualWAN being created or updated. +// wanParameters - Parameters supplied to create or update VirtualWAN. +// options - VirtualWansClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualWansClient.BeginCreateOrUpdate +// method. +func (client *VirtualWansClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters VirtualWAN, options *VirtualWansClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualWansClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualWANName, wanParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualWansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualWansClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualWansClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters VirtualWAN, options *VirtualWansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualWANName, wanParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualWansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters VirtualWAN, options *VirtualWansClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{VirtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, wanParameters) +} + +// BeginDelete - Deletes a VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualWan. +// virtualWANName - The name of the VirtualWAN being deleted. +// options - VirtualWansClientBeginDeleteOptions contains the optional parameters for the VirtualWansClient.BeginDelete method. +func (client *VirtualWansClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientBeginDeleteOptions) (*runtime.Poller[VirtualWansClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualWansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VirtualWansClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VirtualWansClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VirtualWansClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{VirtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a VirtualWAN. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualWan. +// virtualWANName - The name of the VirtualWAN being retrieved. +// options - VirtualWansClientGetOptions contains the optional parameters for the VirtualWansClient.Get method. +func (client *VirtualWansClient) Get(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientGetOptions) (VirtualWansClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return VirtualWansClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualWansClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualWansClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VirtualWansClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, options *VirtualWansClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{VirtualWANName}", url.PathEscape(virtualWANName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VirtualWansClient) getHandleResponse(resp *http.Response) (VirtualWansClientGetResponse, error) { + result := VirtualWansClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWAN); err != nil { + return VirtualWansClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the VirtualWANs in a subscription. +// Generated from API version 2022-05-01 +// options - VirtualWansClientListOptions contains the optional parameters for the VirtualWansClient.List method. +func (client *VirtualWansClient) NewListPager(options *VirtualWansClientListOptions) *runtime.Pager[VirtualWansClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualWansClientListResponse]{ + More: func(page VirtualWansClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualWansClientListResponse) (VirtualWansClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualWansClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualWansClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualWansClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VirtualWansClient) listCreateRequest(ctx context.Context, options *VirtualWansClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VirtualWansClient) listHandleResponse(resp *http.Response) (VirtualWansClientListResponse, error) { + result := VirtualWansClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualWANsResult); err != nil { + return VirtualWansClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the VirtualWANs in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualWan. +// options - VirtualWansClientListByResourceGroupOptions contains the optional parameters for the VirtualWansClient.ListByResourceGroup +// method. +func (client *VirtualWansClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualWansClientListByResourceGroupOptions) *runtime.Pager[VirtualWansClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualWansClientListByResourceGroupResponse]{ + More: func(page VirtualWansClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualWansClientListByResourceGroupResponse) (VirtualWansClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VirtualWansClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualWansClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualWansClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualWansClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualWansClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualWansClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualWansClientListByResourceGroupResponse, error) { + result := VirtualWansClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualWANsResult); err != nil { + return VirtualWansClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates a VirtualWAN tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VirtualWan. +// virtualWANName - The name of the VirtualWAN being updated. +// wanParameters - Parameters supplied to Update VirtualWAN tags. +// options - VirtualWansClientUpdateTagsOptions contains the optional parameters for the VirtualWansClient.UpdateTags method. +func (client *VirtualWansClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters TagsObject, options *VirtualWansClientUpdateTagsOptions) (VirtualWansClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, virtualWANName, wanParameters, options) + if err != nil { + return VirtualWansClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VirtualWansClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualWansClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VirtualWansClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, wanParameters TagsObject, options *VirtualWansClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{VirtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, wanParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VirtualWansClient) updateTagsHandleResponse(resp *http.Response) (VirtualWansClientUpdateTagsResponse, error) { + result := VirtualWansClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWAN); err != nil { + return VirtualWansClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnconnections_client.go new file mode 100644 index 000000000..df2efcc29 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnconnections_client.go @@ -0,0 +1,475 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNConnectionsClient contains the methods for the VPNConnections group. +// Don't use this type directly, use NewVPNConnectionsClient() instead. +type VPNConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNConnectionsClient creates a new instance of VPNConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing +// connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// connectionName - The name of the connection. +// vpnConnectionParameters - Parameters supplied to create or Update a VPN Connection. +// options - VPNConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNConnectionsClient.BeginCreateOrUpdate +// method. +func (client *VPNConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VPNConnection, options *VPNConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VPNConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNConnectionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VPNConnection, options *VPNConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VPNConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VPNConnection, options *VPNConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnConnectionParameters) +} + +// BeginDelete - Deletes a vpn connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// connectionName - The name of the connection. +// options - VPNConnectionsClientBeginDeleteOptions contains the optional parameters for the VPNConnectionsClient.BeginDelete +// method. +func (client *VPNConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientBeginDeleteOptions) (*runtime.Poller[VPNConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, gatewayName, connectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a vpn connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VPNConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a vpn connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// connectionName - The name of the vpn connection. +// options - VPNConnectionsClientGetOptions contains the optional parameters for the VPNConnectionsClient.Get method. +func (client *VPNConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientGetOptions) (VPNConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, options) + if err != nil { + return VPNConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNConnectionsClient) getHandleResponse(resp *http.Response) (VPNConnectionsClientGetResponse, error) { + result := VPNConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNConnection); err != nil { + return VPNConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByVPNGatewayPager - Retrieves all vpn connections for a particular virtual wan vpn gateway. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNConnectionsClientListByVPNGatewayOptions contains the optional parameters for the VPNConnectionsClient.ListByVPNGateway +// method. +func (client *VPNConnectionsClient) NewListByVPNGatewayPager(resourceGroupName string, gatewayName string, options *VPNConnectionsClientListByVPNGatewayOptions) *runtime.Pager[VPNConnectionsClientListByVPNGatewayResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNConnectionsClientListByVPNGatewayResponse]{ + More: func(page VPNConnectionsClientListByVPNGatewayResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNConnectionsClientListByVPNGatewayResponse) (VPNConnectionsClientListByVPNGatewayResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVPNGatewayCreateRequest(ctx, resourceGroupName, gatewayName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNConnectionsClientListByVPNGatewayResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNConnectionsClientListByVPNGatewayResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNConnectionsClientListByVPNGatewayResponse{}, runtime.NewResponseError(resp) + } + return client.listByVPNGatewayHandleResponse(resp) + }, + }) +} + +// listByVPNGatewayCreateRequest creates the ListByVPNGateway request. +func (client *VPNConnectionsClient) listByVPNGatewayCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNConnectionsClientListByVPNGatewayOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVPNGatewayHandleResponse handles the ListByVPNGateway response. +func (client *VPNConnectionsClient) listByVPNGatewayHandleResponse(resp *http.Response) (VPNConnectionsClientListByVPNGatewayResponse, error) { + result := VPNConnectionsClientListByVPNGatewayResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNConnectionsResult); err != nil { + return VPNConnectionsClientListByVPNGatewayResponse{}, err + } + return result, nil +} + +// BeginStartPacketCapture - Starts packet capture on Vpn connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the gateway. +// vpnConnectionName - The name of the vpn connection. +// options - VPNConnectionsClientBeginStartPacketCaptureOptions contains the optional parameters for the VPNConnectionsClient.BeginStartPacketCapture +// method. +func (client *VPNConnectionsClient) BeginStartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStartPacketCaptureOptions) (*runtime.Poller[VPNConnectionsClientStartPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startPacketCapture(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNConnectionsClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientStartPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartPacketCapture - Starts packet capture on Vpn connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNConnectionsClient) startPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStartPacketCaptureOptions) (*http.Response, error) { + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startPacketCaptureCreateRequest creates the StartPacketCapture request. +func (client *VPNConnectionsClient) startPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStartPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if vpnConnectionName == "" { + return nil, errors.New("parameter vpnConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnConnectionName}", url.PathEscape(vpnConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginStopPacketCapture - Stops packet capture on Vpn connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the gateway. +// vpnConnectionName - The name of the vpn connection. +// options - VPNConnectionsClientBeginStopPacketCaptureOptions contains the optional parameters for the VPNConnectionsClient.BeginStopPacketCapture +// method. +func (client *VPNConnectionsClient) BeginStopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStopPacketCaptureOptions) (*runtime.Poller[VPNConnectionsClientStopPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopPacketCapture(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNConnectionsClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNConnectionsClientStopPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StopPacketCapture - Stops packet capture on Vpn connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNConnectionsClient) stopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStopPacketCaptureOptions) (*http.Response, error) { + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, vpnConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopPacketCaptureCreateRequest creates the StopPacketCapture request. +func (client *VPNConnectionsClient) stopPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, options *VPNConnectionsClientBeginStopPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if vpnConnectionName == "" { + return nil, errors.New("parameter vpnConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnConnectionName}", url.PathEscape(vpnConnectionName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpngateways_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpngateways_client.go new file mode 100644 index 000000000..73dbc0970 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpngateways_client.go @@ -0,0 +1,631 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNGatewaysClient contains the methods for the VPNGateways group. +// Don't use this type directly, use NewVPNGatewaysClient() instead. +type VPNGatewaysClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNGatewaysClient creates a new instance of VPNGatewaysClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNGatewaysClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNGatewaysClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// vpnGatewayParameters - Parameters supplied to create or Update a virtual wan vpn gateway. +// options - VPNGatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNGatewaysClient.BeginCreateOrUpdate +// method. +func (client *VPNGatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VPNGateway, options *VPNGatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[VPNGatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VPNGateway, options *VPNGatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VPNGatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VPNGateway, options *VPNGatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnGatewayParameters) +} + +// BeginDelete - Deletes a virtual wan vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNGatewaysClientBeginDeleteOptions contains the optional parameters for the VPNGatewaysClient.BeginDelete method. +func (client *VPNGatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginDeleteOptions) (*runtime.Poller[VPNGatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a virtual wan vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VPNGatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a virtual wan vpn gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNGatewaysClientGetOptions contains the optional parameters for the VPNGatewaysClient.Get method. +func (client *VPNGatewaysClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientGetOptions) (VPNGatewaysClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return VPNGatewaysClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNGatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNGatewaysClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNGatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNGatewaysClient) getHandleResponse(resp *http.Response) (VPNGatewaysClientGetResponse, error) { + result := VPNGatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNGateway); err != nil { + return VPNGatewaysClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the VpnGateways in a subscription. +// Generated from API version 2022-05-01 +// options - VPNGatewaysClientListOptions contains the optional parameters for the VPNGatewaysClient.List method. +func (client *VPNGatewaysClient) NewListPager(options *VPNGatewaysClientListOptions) *runtime.Pager[VPNGatewaysClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNGatewaysClientListResponse]{ + More: func(page VPNGatewaysClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNGatewaysClientListResponse) (VPNGatewaysClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNGatewaysClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNGatewaysClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNGatewaysClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VPNGatewaysClient) listCreateRequest(ctx context.Context, options *VPNGatewaysClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VPNGatewaysClient) listHandleResponse(resp *http.Response) (VPNGatewaysClientListResponse, error) { + result := VPNGatewaysClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewaysResult); err != nil { + return VPNGatewaysClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the VpnGateways in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// options - VPNGatewaysClientListByResourceGroupOptions contains the optional parameters for the VPNGatewaysClient.ListByResourceGroup +// method. +func (client *VPNGatewaysClient) NewListByResourceGroupPager(resourceGroupName string, options *VPNGatewaysClientListByResourceGroupOptions) *runtime.Pager[VPNGatewaysClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNGatewaysClientListByResourceGroupResponse]{ + More: func(page VPNGatewaysClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNGatewaysClientListByResourceGroupResponse) (VPNGatewaysClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNGatewaysClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNGatewaysClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNGatewaysClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VPNGatewaysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VPNGatewaysClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VPNGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNGatewaysClientListByResourceGroupResponse, error) { + result := VPNGatewaysClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewaysResult); err != nil { + return VPNGatewaysClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginReset - Resets the primary of the vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNGatewaysClientBeginResetOptions contains the optional parameters for the VPNGatewaysClient.BeginReset method. +func (client *VPNGatewaysClient) BeginReset(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginResetOptions) (*runtime.Poller[VPNGatewaysClientResetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reset(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientResetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientResetResponse](options.ResumeToken, client.pl, nil) + } +} + +// Reset - Resets the primary of the vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) reset(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginResetOptions) (*http.Response, error) { + req, err := client.resetCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetCreateRequest creates the Reset request. +func (client *VPNGatewaysClient) resetCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginResetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStartPacketCapture - Starts packet capture on vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNGatewaysClientBeginStartPacketCaptureOptions contains the optional parameters for the VPNGatewaysClient.BeginStartPacketCapture +// method. +func (client *VPNGatewaysClient) BeginStartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStartPacketCaptureOptions) (*runtime.Poller[VPNGatewaysClientStartPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startPacketCapture(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientStartPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientStartPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StartPacketCapture - Starts packet capture on vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) startPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStartPacketCaptureOptions) (*http.Response, error) { + req, err := client.startPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startPacketCaptureCreateRequest creates the StartPacketCapture request. +func (client *VPNGatewaysClient) startPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStartPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/startpacketcapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginStopPacketCapture - Stops packet capture on vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// options - VPNGatewaysClientBeginStopPacketCaptureOptions contains the optional parameters for the VPNGatewaysClient.BeginStopPacketCapture +// method. +func (client *VPNGatewaysClient) BeginStopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStopPacketCaptureOptions) (*runtime.Poller[VPNGatewaysClientStopPacketCaptureResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stopPacketCapture(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientStopPacketCaptureResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientStopPacketCaptureResponse](options.ResumeToken, client.pl, nil) + } +} + +// StopPacketCapture - Stops packet capture on vpn gateway in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) stopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStopPacketCaptureOptions) (*http.Response, error) { + req, err := client.stopPacketCaptureCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopPacketCaptureCreateRequest creates the StopPacketCapture request. +func (client *VPNGatewaysClient) stopPacketCaptureCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *VPNGatewaysClientBeginStopPacketCaptureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/stoppacketcapture" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// BeginUpdateTags - Updates virtual wan vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// vpnGatewayParameters - Parameters supplied to update a virtual wan vpn gateway tags. +// options - VPNGatewaysClientBeginUpdateTagsOptions contains the optional parameters for the VPNGatewaysClient.BeginUpdateTags +// method. +func (client *VPNGatewaysClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject, options *VPNGatewaysClientBeginUpdateTagsOptions) (*runtime.Poller[VPNGatewaysClientUpdateTagsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateTags(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNGatewaysClientUpdateTagsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNGatewaysClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateTags - Updates virtual wan vpn gateway tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNGatewaysClient) updateTags(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject, options *VPNGatewaysClientBeginUpdateTagsOptions) (*http.Response, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, gatewayName, vpnGatewayParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VPNGatewaysClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject, options *VPNGatewaysClientBeginUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnGatewayParameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnlinkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnlinkconnections_client.go new file mode 100644 index 000000000..542bd1a21 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnlinkconnections_client.go @@ -0,0 +1,281 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNLinkConnectionsClient contains the methods for the VPNLinkConnections group. +// Don't use this type directly, use NewVPNLinkConnectionsClient() instead. +type VPNLinkConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNLinkConnectionsClient creates a new instance of VPNLinkConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNLinkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNLinkConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNLinkConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginGetIkeSas - Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the gateway. +// connectionName - The name of the vpn connection. +// linkConnectionName - The name of the vpn link connection. +// options - VPNLinkConnectionsClientBeginGetIkeSasOptions contains the optional parameters for the VPNLinkConnectionsClient.BeginGetIkeSas +// method. +func (client *VPNLinkConnectionsClient) BeginGetIkeSas(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginGetIkeSasOptions) (*runtime.Poller[VPNLinkConnectionsClientGetIkeSasResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getIkeSas(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNLinkConnectionsClientGetIkeSasResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNLinkConnectionsClientGetIkeSasResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetIkeSas - Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNLinkConnectionsClient) getIkeSas(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginGetIkeSasOptions) (*http.Response, error) { + req, err := client.getIkeSasCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getIkeSasCreateRequest creates the GetIkeSas request. +func (client *VPNLinkConnectionsClient) getIkeSasCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginGetIkeSasOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if linkConnectionName == "" { + return nil, errors.New("parameter linkConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{linkConnectionName}", url.PathEscape(linkConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByVPNConnectionPager - Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the vpn gateway. +// gatewayName - The name of the gateway. +// connectionName - The name of the vpn connection. +// options - VPNLinkConnectionsClientListByVPNConnectionOptions contains the optional parameters for the VPNLinkConnectionsClient.ListByVPNConnection +// method. +func (client *VPNLinkConnectionsClient) NewListByVPNConnectionPager(resourceGroupName string, gatewayName string, connectionName string, options *VPNLinkConnectionsClientListByVPNConnectionOptions) *runtime.Pager[VPNLinkConnectionsClientListByVPNConnectionResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNLinkConnectionsClientListByVPNConnectionResponse]{ + More: func(page VPNLinkConnectionsClientListByVPNConnectionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNLinkConnectionsClientListByVPNConnectionResponse) (VPNLinkConnectionsClientListByVPNConnectionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVPNConnectionCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNLinkConnectionsClientListByVPNConnectionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNLinkConnectionsClientListByVPNConnectionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNLinkConnectionsClientListByVPNConnectionResponse{}, runtime.NewResponseError(resp) + } + return client.listByVPNConnectionHandleResponse(resp) + }, + }) +} + +// listByVPNConnectionCreateRequest creates the ListByVPNConnection request. +func (client *VPNLinkConnectionsClient) listByVPNConnectionCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, options *VPNLinkConnectionsClientListByVPNConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVPNConnectionHandleResponse handles the ListByVPNConnection response. +func (client *VPNLinkConnectionsClient) listByVPNConnectionHandleResponse(resp *http.Response) (VPNLinkConnectionsClientListByVPNConnectionResponse, error) { + result := VPNLinkConnectionsClientListByVPNConnectionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSiteLinkConnectionsResult); err != nil { + return VPNLinkConnectionsClientListByVPNConnectionResponse{}, err + } + return result, nil +} + +// BeginResetConnection - Resets the VpnLink connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// gatewayName - The name of the gateway. +// connectionName - The name of the vpn connection. +// linkConnectionName - The name of the vpn link connection. +// options - VPNLinkConnectionsClientBeginResetConnectionOptions contains the optional parameters for the VPNLinkConnectionsClient.BeginResetConnection +// method. +func (client *VPNLinkConnectionsClient) BeginResetConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginResetConnectionOptions) (*runtime.Poller[VPNLinkConnectionsClientResetConnectionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetConnection(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNLinkConnectionsClientResetConnectionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNLinkConnectionsClientResetConnectionResponse](options.ResumeToken, client.pl, nil) + } +} + +// ResetConnection - Resets the VpnLink connection specified. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNLinkConnectionsClient) resetConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginResetConnectionOptions) (*http.Response, error) { + req, err := client.resetConnectionCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// resetConnectionCreateRequest creates the ResetConnection request. +func (client *VPNLinkConnectionsClient) resetConnectionCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNLinkConnectionsClientBeginResetConnectionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if linkConnectionName == "" { + return nil, errors.New("parameter linkConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{linkConnectionName}", url.PathEscape(linkConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurations_client.go new file mode 100644 index 000000000..49fb89535 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurations_client.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNServerConfigurationsClient contains the methods for the VPNServerConfigurations group. +// Don't use this type directly, use NewVPNServerConfigurationsClient() instead. +type VPNServerConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNServerConfigurationsClient creates a new instance of VPNServerConfigurationsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNServerConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNServerConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNServerConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration being created or updated. +// vpnServerConfigurationParameters - Parameters supplied to create or update VpnServerConfiguration. +// options - VPNServerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginCreateOrUpdate +// method. +func (client *VPNServerConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[VPNServerConfigurationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNServerConfigurationsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNServerConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VPNServerConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VPNServerConfiguration, options *VPNServerConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnServerConfigurationParameters) +} + +// BeginDelete - Deletes a VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration being deleted. +// options - VPNServerConfigurationsClientBeginDeleteOptions contains the optional parameters for the VPNServerConfigurationsClient.BeginDelete +// method. +func (client *VPNServerConfigurationsClient) BeginDelete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*runtime.Poller[VPNServerConfigurationsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vpnServerConfigurationName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNServerConfigurationsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNServerConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VPNServerConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a VpnServerConfiguration. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration being retrieved. +// options - VPNServerConfigurationsClientGetOptions contains the optional parameters for the VPNServerConfigurationsClient.Get +// method. +func (client *VPNServerConfigurationsClient) Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientGetOptions) (VPNServerConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, options) + if err != nil { + return VPNServerConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNServerConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNServerConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNServerConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, options *VPNServerConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNServerConfigurationsClient) getHandleResponse(resp *http.Response) (VPNServerConfigurationsClientGetResponse, error) { + result := VPNServerConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil { + return VPNServerConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the VpnServerConfigurations in a subscription. +// Generated from API version 2022-05-01 +// options - VPNServerConfigurationsClientListOptions contains the optional parameters for the VPNServerConfigurationsClient.List +// method. +func (client *VPNServerConfigurationsClient) NewListPager(options *VPNServerConfigurationsClientListOptions) *runtime.Pager[VPNServerConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNServerConfigurationsClientListResponse]{ + More: func(page VPNServerConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNServerConfigurationsClientListResponse) (VPNServerConfigurationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNServerConfigurationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNServerConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNServerConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VPNServerConfigurationsClient) listCreateRequest(ctx context.Context, options *VPNServerConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VPNServerConfigurationsClient) listHandleResponse(resp *http.Response) (VPNServerConfigurationsClientListResponse, error) { + result := VPNServerConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil { + return VPNServerConfigurationsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the vpnServerConfigurations in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// options - VPNServerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the VPNServerConfigurationsClient.ListByResourceGroup +// method. +func (client *VPNServerConfigurationsClient) NewListByResourceGroupPager(resourceGroupName string, options *VPNServerConfigurationsClientListByResourceGroupOptions) *runtime.Pager[VPNServerConfigurationsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNServerConfigurationsClientListByResourceGroupResponse]{ + More: func(page VPNServerConfigurationsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNServerConfigurationsClientListByResourceGroupResponse) (VPNServerConfigurationsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNServerConfigurationsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNServerConfigurationsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNServerConfigurationsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VPNServerConfigurationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VPNServerConfigurationsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VPNServerConfigurationsClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNServerConfigurationsClientListByResourceGroupResponse, error) { + result := VPNServerConfigurationsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil { + return VPNServerConfigurationsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates VpnServerConfiguration tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - The name of the VpnServerConfiguration being updated. +// vpnServerConfigurationParameters - Parameters supplied to update VpnServerConfiguration tags. +// options - VPNServerConfigurationsClientUpdateTagsOptions contains the optional parameters for the VPNServerConfigurationsClient.UpdateTags +// method. +func (client *VPNServerConfigurationsClient) UpdateTags(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject, options *VPNServerConfigurationsClientUpdateTagsOptions) (VPNServerConfigurationsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters, options) + if err != nil { + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNServerConfigurationsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VPNServerConfigurationsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject, options *VPNServerConfigurationsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnServerConfigurationName == "" { + return nil, errors.New("parameter vpnServerConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnServerConfigurationName}", url.PathEscape(vpnServerConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnServerConfigurationParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VPNServerConfigurationsClient) updateTagsHandleResponse(resp *http.Response) (VPNServerConfigurationsClientUpdateTagsResponse, error) { + result := VPNServerConfigurationsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil { + return VPNServerConfigurationsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurationsassociatedwithvirtualwan_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurationsassociatedwithvirtualwan_client.go new file mode 100644 index 000000000..f33ea85d0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnserverconfigurationsassociatedwithvirtualwan_client.go @@ -0,0 +1,122 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNServerConfigurationsAssociatedWithVirtualWanClient contains the methods for the VPNServerConfigurationsAssociatedWithVirtualWan group. +// Don't use this type directly, use NewVPNServerConfigurationsAssociatedWithVirtualWanClient() instead. +type VPNServerConfigurationsAssociatedWithVirtualWanClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNServerConfigurationsAssociatedWithVirtualWanClient creates a new instance of VPNServerConfigurationsAssociatedWithVirtualWanClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNServerConfigurationsAssociatedWithVirtualWanClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNServerConfigurationsAssociatedWithVirtualWanClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNServerConfigurationsAssociatedWithVirtualWanClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginList - Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name. +// virtualWANName - The name of the VirtualWAN whose associated VpnServerConfigurations is needed. +// options - VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions contains the optional parameters for the +// VPNServerConfigurationsAssociatedWithVirtualWanClient.BeginList method. +func (client *VPNServerConfigurationsAssociatedWithVirtualWanClient) BeginList(ctx context.Context, resourceGroupName string, virtualWANName string, options *VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions) (*runtime.Poller[VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listOperation(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNServerConfigurationsAssociatedWithVirtualWanClientListResponse](options.ResumeToken, client.pl, nil) + } +} + +// List - Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNServerConfigurationsAssociatedWithVirtualWanClient) listOperation(ctx context.Context, resourceGroupName string, virtualWANName string, options *VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions) (*http.Response, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualWANName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listCreateRequest creates the List request. +func (client *VPNServerConfigurationsAssociatedWithVirtualWanClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, options *VPNServerConfigurationsAssociatedWithVirtualWanClientBeginListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinkconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinkconnections_client.go new file mode 100644 index 000000000..72e9404f0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinkconnections_client.go @@ -0,0 +1,124 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNSiteLinkConnectionsClient contains the methods for the VPNSiteLinkConnections group. +// Don't use this type directly, use NewVPNSiteLinkConnectionsClient() instead. +type VPNSiteLinkConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNSiteLinkConnectionsClient creates a new instance of VPNSiteLinkConnectionsClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNSiteLinkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNSiteLinkConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNSiteLinkConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Retrieves the details of a vpn site link connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnGateway. +// gatewayName - The name of the gateway. +// connectionName - The name of the vpn connection. +// linkConnectionName - The name of the vpn connection. +// options - VPNSiteLinkConnectionsClientGetOptions contains the optional parameters for the VPNSiteLinkConnectionsClient.Get +// method. +func (client *VPNSiteLinkConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNSiteLinkConnectionsClientGetOptions) (VPNSiteLinkConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName, options) + if err != nil { + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSiteLinkConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNSiteLinkConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string, options *VPNSiteLinkConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + if linkConnectionName == "" { + return nil, errors.New("parameter linkConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{linkConnectionName}", url.PathEscape(linkConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNSiteLinkConnectionsClient) getHandleResponse(resp *http.Response) (VPNSiteLinkConnectionsClientGetResponse, error) { + result := VPNSiteLinkConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNSiteLinkConnection); err != nil { + return VPNSiteLinkConnectionsClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinks_client.go new file mode 100644 index 000000000..39634a0ad --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitelinks_client.go @@ -0,0 +1,187 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNSiteLinksClient contains the methods for the VPNSiteLinks group. +// Don't use this type directly, use NewVPNSiteLinksClient() instead. +type VPNSiteLinksClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNSiteLinksClient creates a new instance of VPNSiteLinksClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNSiteLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNSiteLinksClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNSiteLinksClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Retrieves the details of a VPN site link. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite. +// vpnSiteLinkName - The name of the VpnSiteLink being retrieved. +// options - VPNSiteLinksClientGetOptions contains the optional parameters for the VPNSiteLinksClient.Get method. +func (client *VPNSiteLinksClient) Get(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteLinkName string, options *VPNSiteLinksClientGetOptions) (VPNSiteLinksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteLinkName, options) + if err != nil { + return VPNSiteLinksClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSiteLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSiteLinksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNSiteLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteLinkName string, options *VPNSiteLinksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + if vpnSiteLinkName == "" { + return nil, errors.New("parameter vpnSiteLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteLinkName}", url.PathEscape(vpnSiteLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNSiteLinksClient) getHandleResponse(resp *http.Response) (VPNSiteLinksClientGetResponse, error) { + result := VPNSiteLinksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNSiteLink); err != nil { + return VPNSiteLinksClientGetResponse{}, err + } + return result, nil +} + +// NewListByVPNSitePager - Lists all the vpnSiteLinks in a resource group for a vpn site. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite. +// options - VPNSiteLinksClientListByVPNSiteOptions contains the optional parameters for the VPNSiteLinksClient.ListByVPNSite +// method. +func (client *VPNSiteLinksClient) NewListByVPNSitePager(resourceGroupName string, vpnSiteName string, options *VPNSiteLinksClientListByVPNSiteOptions) *runtime.Pager[VPNSiteLinksClientListByVPNSiteResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNSiteLinksClientListByVPNSiteResponse]{ + More: func(page VPNSiteLinksClientListByVPNSiteResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNSiteLinksClientListByVPNSiteResponse) (VPNSiteLinksClientListByVPNSiteResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByVPNSiteCreateRequest(ctx, resourceGroupName, vpnSiteName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNSiteLinksClientListByVPNSiteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSiteLinksClientListByVPNSiteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSiteLinksClientListByVPNSiteResponse{}, runtime.NewResponseError(resp) + } + return client.listByVPNSiteHandleResponse(resp) + }, + }) +} + +// listByVPNSiteCreateRequest creates the ListByVPNSite request. +func (client *VPNSiteLinksClient) listByVPNSiteCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSiteLinksClientListByVPNSiteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVPNSiteHandleResponse handles the ListByVPNSite response. +func (client *VPNSiteLinksClient) listByVPNSiteHandleResponse(resp *http.Response) (VPNSiteLinksClientListByVPNSiteResponse, error) { + result := VPNSiteLinksClientListByVPNSiteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSiteLinksResult); err != nil { + return VPNSiteLinksClientListByVPNSiteResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsites_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsites_client.go new file mode 100644 index 000000000..39089558a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsites_client.go @@ -0,0 +1,422 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNSitesClient contains the methods for the VPNSites group. +// Don't use this type directly, use NewVPNSitesClient() instead. +type VPNSitesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNSitesClient creates a new instance of VPNSitesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNSitesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNSitesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite being created or updated. +// vpnSiteParameters - Parameters supplied to create or update VpnSite. +// options - VPNSitesClientBeginCreateOrUpdateOptions contains the optional parameters for the VPNSitesClient.BeginCreateOrUpdate +// method. +func (client *VPNSitesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VPNSite, options *VPNSitesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VPNSitesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNSitesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNSitesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNSitesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VPNSite, options *VPNSitesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VPNSitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VPNSite, options *VPNSitesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnSiteParameters) +} + +// BeginDelete - Deletes a VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite being deleted. +// options - VPNSitesClientBeginDeleteOptions contains the optional parameters for the VPNSitesClient.BeginDelete method. +func (client *VPNSitesClient) BeginDelete(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientBeginDeleteOptions) (*runtime.Poller[VPNSitesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vpnSiteName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNSitesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNSitesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a VpnSite. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNSitesClient) deleteOperation(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vpnSiteName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VPNSitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the details of a VPN site. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite being retrieved. +// options - VPNSitesClientGetOptions contains the optional parameters for the VPNSitesClient.Get method. +func (client *VPNSitesClient) Get(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientGetOptions) (VPNSitesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, vpnSiteName, options) + if err != nil { + return VPNSitesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSitesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSitesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VPNSitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, options *VPNSitesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VPNSitesClient) getHandleResponse(resp *http.Response) (VPNSitesClientGetResponse, error) { + result := VPNSitesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNSite); err != nil { + return VPNSitesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the VpnSites in a subscription. +// Generated from API version 2022-05-01 +// options - VPNSitesClientListOptions contains the optional parameters for the VPNSitesClient.List method. +func (client *VPNSitesClient) NewListPager(options *VPNSitesClientListOptions) *runtime.Pager[VPNSitesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNSitesClientListResponse]{ + More: func(page VPNSitesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNSitesClientListResponse) (VPNSitesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNSitesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSitesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSitesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *VPNSitesClient) listCreateRequest(ctx context.Context, options *VPNSitesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VPNSitesClient) listHandleResponse(resp *http.Response) (VPNSitesClientListResponse, error) { + result := VPNSitesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSitesResult); err != nil { + return VPNSitesClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all the vpnSites in a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// options - VPNSitesClientListByResourceGroupOptions contains the optional parameters for the VPNSitesClient.ListByResourceGroup +// method. +func (client *VPNSitesClient) NewListByResourceGroupPager(resourceGroupName string, options *VPNSitesClientListByResourceGroupOptions) *runtime.Pager[VPNSitesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VPNSitesClientListByResourceGroupResponse]{ + More: func(page VPNSitesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VPNSitesClientListByResourceGroupResponse) (VPNSitesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VPNSitesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSitesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSitesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VPNSitesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VPNSitesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VPNSitesClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNSitesClientListByResourceGroupResponse, error) { + result := VPNSitesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSitesResult); err != nil { + return VPNSitesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates VpnSite tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name of the VpnSite. +// vpnSiteName - The name of the VpnSite being updated. +// vpnSiteParameters - Parameters supplied to update VpnSite tags. +// options - VPNSitesClientUpdateTagsOptions contains the optional parameters for the VPNSitesClient.UpdateTags method. +func (client *VPNSitesClient) UpdateTags(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters TagsObject, options *VPNSitesClientUpdateTagsOptions) (VPNSitesClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters, options) + if err != nil { + return VPNSitesClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VPNSitesClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VPNSitesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *VPNSitesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters TagsObject, options *VPNSitesClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vpnSiteName == "" { + return nil, errors.New("parameter vpnSiteName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vpnSiteName}", url.PathEscape(vpnSiteName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, vpnSiteParameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *VPNSitesClient) updateTagsHandleResponse(resp *http.Response) (VPNSitesClientUpdateTagsResponse, error) { + result := VPNSitesClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VPNSite); err != nil { + return VPNSitesClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitesconfiguration_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitesconfiguration_client.go new file mode 100644 index 000000000..d29751dfa --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/vpnsitesconfiguration_client.go @@ -0,0 +1,123 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VPNSitesConfigurationClient contains the methods for the VPNSitesConfiguration group. +// Don't use this type directly, use NewVPNSitesConfigurationClient() instead. +type VPNSitesConfigurationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVPNSitesConfigurationClient creates a new instance of VPNSitesConfigurationClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVPNSitesConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VPNSitesConfigurationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VPNSitesConfigurationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginDownload - Gives the sas-url to download the configurations for vpn-sites in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The resource group name. +// virtualWANName - The name of the VirtualWAN for which configuration of all vpn-sites is needed. +// request - Parameters supplied to download vpn-sites configuration. +// options - VPNSitesConfigurationClientBeginDownloadOptions contains the optional parameters for the VPNSitesConfigurationClient.BeginDownload +// method. +func (client *VPNSitesConfigurationClient) BeginDownload(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVPNSitesConfigurationRequest, options *VPNSitesConfigurationClientBeginDownloadOptions) (*runtime.Poller[VPNSitesConfigurationClientDownloadResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.download(ctx, resourceGroupName, virtualWANName, request, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VPNSitesConfigurationClientDownloadResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[VPNSitesConfigurationClientDownloadResponse](options.ResumeToken, client.pl, nil) + } +} + +// Download - Gives the sas-url to download the configurations for vpn-sites in a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *VPNSitesConfigurationClient) download(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVPNSitesConfigurationRequest, options *VPNSitesConfigurationClientBeginDownloadOptions) (*http.Response, error) { + req, err := client.downloadCreateRequest(ctx, resourceGroupName, virtualWANName, request, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// downloadCreateRequest creates the Download request. +func (client *VPNSitesConfigurationClient) downloadCreateRequest(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVPNSitesConfigurationRequest, options *VPNSitesConfigurationClientBeginDownloadOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnConfiguration" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualWANName == "" { + return nil, errors.New("parameter virtualWANName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualWANName}", url.PathEscape(virtualWANName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/watchers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/watchers_client.go new file mode 100644 index 000000000..e454cc054 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/watchers_client.go @@ -0,0 +1,1197 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WatchersClient contains the methods for the NetworkWatchers group. +// Don't use this type directly, use NewWatchersClient() instead. +type WatchersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewWatchersClient creates a new instance of WatchersClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewWatchersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WatchersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &WatchersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCheckConnectivity - Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given +// endpoint including another VM or an arbitrary remote server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the network watcher resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that determine how the connectivity check will be performed. +// options - WatchersClientBeginCheckConnectivityOptions contains the optional parameters for the WatchersClient.BeginCheckConnectivity +// method. +func (client *WatchersClient) BeginCheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters, options *WatchersClientBeginCheckConnectivityOptions) (*runtime.Poller[WatchersClientCheckConnectivityResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.checkConnectivity(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientCheckConnectivityResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientCheckConnectivityResponse](options.ResumeToken, client.pl, nil) + } +} + +// CheckConnectivity - Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given +// endpoint including another VM or an arbitrary remote server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) checkConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters, options *WatchersClientBeginCheckConnectivityOptions) (*http.Response, error) { + req, err := client.checkConnectivityCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// checkConnectivityCreateRequest creates the CheckConnectivity request. +func (client *WatchersClient) checkConnectivityCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters, options *WatchersClientBeginCheckConnectivityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// CreateOrUpdate - Creates or updates a network watcher in the specified resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters that define the network watcher resource. +// options - WatchersClientCreateOrUpdateOptions contains the optional parameters for the WatchersClient.CreateOrUpdate method. +func (client *WatchersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher, options *WatchersClientCreateOrUpdateOptions) (WatchersClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WatchersClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WatchersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher, options *WatchersClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WatchersClient) createOrUpdateHandleResponse(resp *http.Response) (WatchersClientCreateOrUpdateResponse, error) { + result := WatchersClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { + return WatchersClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified network watcher resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// options - WatchersClientBeginDeleteOptions contains the optional parameters for the WatchersClient.BeginDelete method. +func (client *WatchersClient) BeginDelete(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientBeginDeleteOptions) (*runtime.Poller[WatchersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes the specified network watcher resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) deleteOperation(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WatchersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified network watcher by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// options - WatchersClientGetOptions contains the optional parameters for the WatchersClient.Get method. +func (client *WatchersClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientGetOptions) (WatchersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, networkWatcherName, options) + if err != nil { + return WatchersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WatchersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WatchersClient) getCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, options *WatchersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WatchersClient) getHandleResponse(resp *http.Response) (WatchersClientGetResponse, error) { + result := WatchersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { + return WatchersClientGetResponse{}, err + } + return result, nil +} + +// BeginGetAzureReachabilityReport - NOTE: This feature is currently in preview and still being tested for stability. Gets +// the relative latency score for internet service providers from a specified location to Azure regions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the network watcher resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that determine Azure reachability report configuration. +// options - WatchersClientBeginGetAzureReachabilityReportOptions contains the optional parameters for the WatchersClient.BeginGetAzureReachabilityReport +// method. +func (client *WatchersClient) BeginGetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters, options *WatchersClientBeginGetAzureReachabilityReportOptions) (*runtime.Poller[WatchersClientGetAzureReachabilityReportResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getAzureReachabilityReport(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetAzureReachabilityReportResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetAzureReachabilityReportResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetAzureReachabilityReport - NOTE: This feature is currently in preview and still being tested for stability. Gets the +// relative latency score for internet service providers from a specified location to Azure regions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters, options *WatchersClientBeginGetAzureReachabilityReportOptions) (*http.Response, error) { + req, err := client.getAzureReachabilityReportCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getAzureReachabilityReportCreateRequest creates the GetAzureReachabilityReport request. +func (client *WatchersClient) getAzureReachabilityReportCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters, options *WatchersClientBeginGetAzureReachabilityReportOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetFlowLogStatus - Queries status of flow log and traffic analytics (optional) on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the network watcher resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that define a resource to query flow log and traffic analytics (optional) status. +// options - WatchersClientBeginGetFlowLogStatusOptions contains the optional parameters for the WatchersClient.BeginGetFlowLogStatus +// method. +func (client *WatchersClient) BeginGetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, options *WatchersClientBeginGetFlowLogStatusOptions) (*runtime.Poller[WatchersClientGetFlowLogStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getFlowLogStatus(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetFlowLogStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetFlowLogStatusResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetFlowLogStatus - Queries status of flow log and traffic analytics (optional) on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, options *WatchersClientBeginGetFlowLogStatusOptions) (*http.Response, error) { + req, err := client.getFlowLogStatusCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getFlowLogStatusCreateRequest creates the GetFlowLogStatus request. +func (client *WatchersClient) getFlowLogStatusCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, options *WatchersClientBeginGetFlowLogStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetNetworkConfigurationDiagnostic - Gets Network Configuration Diagnostic data to help customers understand and debug +// network behavior. It provides detailed information on what security rules were applied to a specified traffic flow and +// the result of evaluating these rules. Customers must provide details of a flow like source, destination, protocol, etc. +// The API returns whether traffic was allowed or denied, the rules evaluated for +// the specified flow and the evaluation results. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters to get network configuration diagnostic. +// options - WatchersClientBeginGetNetworkConfigurationDiagnosticOptions contains the optional parameters for the WatchersClient.BeginGetNetworkConfigurationDiagnostic +// method. +func (client *WatchersClient) BeginGetNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters, options *WatchersClientBeginGetNetworkConfigurationDiagnosticOptions) (*runtime.Poller[WatchersClientGetNetworkConfigurationDiagnosticResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getNetworkConfigurationDiagnostic(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetNetworkConfigurationDiagnosticResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetNetworkConfigurationDiagnosticResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetNetworkConfigurationDiagnostic - Gets Network Configuration Diagnostic data to help customers understand and debug network +// behavior. It provides detailed information on what security rules were applied to a specified traffic flow and +// the result of evaluating these rules. Customers must provide details of a flow like source, destination, protocol, etc. +// The API returns whether traffic was allowed or denied, the rules evaluated for +// the specified flow and the evaluation results. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters, options *WatchersClientBeginGetNetworkConfigurationDiagnosticOptions) (*http.Response, error) { + req, err := client.getNetworkConfigurationDiagnosticCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getNetworkConfigurationDiagnosticCreateRequest creates the GetNetworkConfigurationDiagnostic request. +func (client *WatchersClient) getNetworkConfigurationDiagnosticCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters, options *WatchersClientBeginGetNetworkConfigurationDiagnosticOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetNextHop - Gets the next hop from the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters that define the source and destination endpoint. +// options - WatchersClientBeginGetNextHopOptions contains the optional parameters for the WatchersClient.BeginGetNextHop +// method. +func (client *WatchersClient) BeginGetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters, options *WatchersClientBeginGetNextHopOptions) (*runtime.Poller[WatchersClientGetNextHopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getNextHop(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetNextHopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetNextHopResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetNextHop - Gets the next hop from the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters, options *WatchersClientBeginGetNextHopOptions) (*http.Response, error) { + req, err := client.getNextHopCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getNextHopCreateRequest creates the GetNextHop request. +func (client *WatchersClient) getNextHopCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters, options *WatchersClientBeginGetNextHopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// GetTopology - Gets the current network topology by resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters that define the representation of topology. +// options - WatchersClientGetTopologyOptions contains the optional parameters for the WatchersClient.GetTopology method. +func (client *WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters, options *WatchersClientGetTopologyOptions) (WatchersClientGetTopologyResponse, error) { + req, err := client.getTopologyCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientGetTopologyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientGetTopologyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WatchersClientGetTopologyResponse{}, runtime.NewResponseError(resp) + } + return client.getTopologyHandleResponse(resp) +} + +// getTopologyCreateRequest creates the GetTopology request. +func (client *WatchersClient) getTopologyCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters, options *WatchersClientGetTopologyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// getTopologyHandleResponse handles the GetTopology response. +func (client *WatchersClient) getTopologyHandleResponse(resp *http.Response) (WatchersClientGetTopologyResponse, error) { + result := WatchersClientGetTopologyResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Topology); err != nil { + return WatchersClientGetTopologyResponse{}, err + } + return result, nil +} + +// BeginGetTroubleshooting - Initiate troubleshooting on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that define the resource to troubleshoot. +// options - WatchersClientBeginGetTroubleshootingOptions contains the optional parameters for the WatchersClient.BeginGetTroubleshooting +// method. +func (client *WatchersClient) BeginGetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingOptions) (*runtime.Poller[WatchersClientGetTroubleshootingResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getTroubleshooting(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetTroubleshootingResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetTroubleshootingResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetTroubleshooting - Initiate troubleshooting on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingOptions) (*http.Response, error) { + req, err := client.getTroubleshootingCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getTroubleshootingCreateRequest creates the GetTroubleshooting request. +func (client *WatchersClient) getTroubleshootingCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetTroubleshootingResult - Get the last completed troubleshooting result on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that define the resource to query the troubleshooting result. +// options - WatchersClientBeginGetTroubleshootingResultOptions contains the optional parameters for the WatchersClient.BeginGetTroubleshootingResult +// method. +func (client *WatchersClient) BeginGetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingResultOptions) (*runtime.Poller[WatchersClientGetTroubleshootingResultResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getTroubleshootingResult(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetTroubleshootingResultResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetTroubleshootingResultResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetTroubleshootingResult - Get the last completed troubleshooting result on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingResultOptions) (*http.Response, error) { + req, err := client.getTroubleshootingResultCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getTroubleshootingResultCreateRequest creates the GetTroubleshootingResult request. +func (client *WatchersClient) getTroubleshootingResultCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, options *WatchersClientBeginGetTroubleshootingResultOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginGetVMSecurityRules - Gets the configured and effective security group rules on the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters that define the VM to check security groups for. +// options - WatchersClientBeginGetVMSecurityRulesOptions contains the optional parameters for the WatchersClient.BeginGetVMSecurityRules +// method. +func (client *WatchersClient) BeginGetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, options *WatchersClientBeginGetVMSecurityRulesOptions) (*runtime.Poller[WatchersClientGetVMSecurityRulesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.getVMSecurityRules(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientGetVMSecurityRulesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientGetVMSecurityRulesResponse](options.ResumeToken, client.pl, nil) + } +} + +// GetVMSecurityRules - Gets the configured and effective security group rules on the specified VM. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) getVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, options *WatchersClientBeginGetVMSecurityRulesOptions) (*http.Response, error) { + req, err := client.getVMSecurityRulesCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getVMSecurityRulesCreateRequest creates the GetVMSecurityRules request. +func (client *WatchersClient) getVMSecurityRulesCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, options *WatchersClientBeginGetVMSecurityRulesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// NewListPager - Gets all network watchers by resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - WatchersClientListOptions contains the optional parameters for the WatchersClient.List method. +func (client *WatchersClient) NewListPager(resourceGroupName string, options *WatchersClientListOptions) *runtime.Pager[WatchersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WatchersClientListResponse]{ + More: func(page WatchersClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *WatchersClientListResponse) (WatchersClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return WatchersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WatchersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *WatchersClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *WatchersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WatchersClient) listHandleResponse(resp *http.Response) (WatchersClientListResponse, error) { + result := WatchersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WatcherListResult); err != nil { + return WatchersClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all network watchers by subscription. +// Generated from API version 2022-05-01 +// options - WatchersClientListAllOptions contains the optional parameters for the WatchersClient.ListAll method. +func (client *WatchersClient) NewListAllPager(options *WatchersClientListAllOptions) *runtime.Pager[WatchersClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[WatchersClientListAllResponse]{ + More: func(page WatchersClientListAllResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *WatchersClientListAllResponse) (WatchersClientListAllResponse, error) { + req, err := client.listAllCreateRequest(ctx, options) + if err != nil { + return WatchersClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WatchersClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *WatchersClient) listAllCreateRequest(ctx context.Context, options *WatchersClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *WatchersClient) listAllHandleResponse(resp *http.Response) (WatchersClientListAllResponse, error) { + result := WatchersClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WatcherListResult); err != nil { + return WatchersClientListAllResponse{}, err + } + return result, nil +} + +// BeginListAvailableProviders - NOTE: This feature is currently in preview and still being tested for stability. Lists all +// available internet service providers for a specified Azure region. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the network watcher resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that scope the list of available providers. +// options - WatchersClientBeginListAvailableProvidersOptions contains the optional parameters for the WatchersClient.BeginListAvailableProviders +// method. +func (client *WatchersClient) BeginListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters, options *WatchersClientBeginListAvailableProvidersOptions) (*runtime.Poller[WatchersClientListAvailableProvidersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listAvailableProviders(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientListAvailableProvidersResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientListAvailableProvidersResponse](options.ResumeToken, client.pl, nil) + } +} + +// ListAvailableProviders - NOTE: This feature is currently in preview and still being tested for stability. Lists all available +// internet service providers for a specified Azure region. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) listAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters, options *WatchersClientBeginListAvailableProvidersOptions) (*http.Response, error) { + req, err := client.listAvailableProvidersCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// listAvailableProvidersCreateRequest creates the ListAvailableProviders request. +func (client *WatchersClient) listAvailableProvidersCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters, options *WatchersClientBeginListAvailableProvidersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginSetFlowLogConfiguration - Configures flow log and traffic analytics (optional) on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the network watcher resource group. +// networkWatcherName - The name of the network watcher resource. +// parameters - Parameters that define the configuration of flow log. +// options - WatchersClientBeginSetFlowLogConfigurationOptions contains the optional parameters for the WatchersClient.BeginSetFlowLogConfiguration +// method. +func (client *WatchersClient) BeginSetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, options *WatchersClientBeginSetFlowLogConfigurationOptions) (*runtime.Poller[WatchersClientSetFlowLogConfigurationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.setFlowLogConfiguration(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientSetFlowLogConfigurationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientSetFlowLogConfigurationResponse](options.ResumeToken, client.pl, nil) + } +} + +// SetFlowLogConfiguration - Configures flow log and traffic analytics (optional) on a specified resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) setFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, options *WatchersClientBeginSetFlowLogConfigurationOptions) (*http.Response, error) { + req, err := client.setFlowLogConfigurationCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// setFlowLogConfigurationCreateRequest creates the SetFlowLogConfiguration request. +func (client *WatchersClient) setFlowLogConfigurationCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, options *WatchersClientBeginSetFlowLogConfigurationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// UpdateTags - Updates a network watcher tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters supplied to update network watcher tags. +// options - WatchersClientUpdateTagsOptions contains the optional parameters for the WatchersClient.UpdateTags method. +func (client *WatchersClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject, options *WatchersClientUpdateTagsOptions) (WatchersClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return WatchersClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WatchersClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WatchersClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *WatchersClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject, options *WatchersClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *WatchersClient) updateTagsHandleResponse(resp *http.Response) (WatchersClientUpdateTagsResponse, error) { + result := WatchersClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { + return WatchersClientUpdateTagsResponse{}, err + } + return result, nil +} + +// BeginVerifyIPFlow - Verify IP flow from the specified VM to a location given the currently configured NSG rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// networkWatcherName - The name of the network watcher. +// parameters - Parameters that define the IP flow to be verified. +// options - WatchersClientBeginVerifyIPFlowOptions contains the optional parameters for the WatchersClient.BeginVerifyIPFlow +// method. +func (client *WatchersClient) BeginVerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, options *WatchersClientBeginVerifyIPFlowOptions) (*runtime.Poller[WatchersClientVerifyIPFlowResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.verifyIPFlow(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WatchersClientVerifyIPFlowResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WatchersClientVerifyIPFlowResponse](options.ResumeToken, client.pl, nil) + } +} + +// VerifyIPFlow - Verify IP flow from the specified VM to a location given the currently configured NSG rules. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WatchersClient) verifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, options *WatchersClientBeginVerifyIPFlowOptions) (*http.Response, error) { + req, err := client.verifyIPFlowCreateRequest(ctx, resourceGroupName, networkWatcherName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// verifyIPFlowCreateRequest creates the VerifyIPFlow request. +func (client *WatchersClient) verifyIPFlowCreateRequest(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, options *WatchersClientBeginVerifyIPFlowOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if networkWatcherName == "" { + return nil, errors.New("parameter networkWatcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkWatcherName}", url.PathEscape(networkWatcherName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webapplicationfirewallpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webapplicationfirewallpolicies_client.go new file mode 100644 index 000000000..2634b65ea --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webapplicationfirewallpolicies_client.go @@ -0,0 +1,360 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebApplicationFirewallPoliciesClient contains the methods for the WebApplicationFirewallPolicies group. +// Don't use this type directly, use NewWebApplicationFirewallPoliciesClient() instead. +type WebApplicationFirewallPoliciesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewWebApplicationFirewallPoliciesClient creates a new instance of WebApplicationFirewallPoliciesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewWebApplicationFirewallPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebApplicationFirewallPoliciesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &WebApplicationFirewallPoliciesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update policy with specified rule set name within a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// policyName - The name of the policy. +// parameters - Policy to be created. +// options - WebApplicationFirewallPoliciesClientCreateOrUpdateOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.CreateOrUpdate +// method. +func (client *WebApplicationFirewallPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy, options *WebApplicationFirewallPoliciesClientCreateOrUpdateOptions) (WebApplicationFirewallPoliciesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, policyName, parameters, options) + if err != nil { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WebApplicationFirewallPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy, options *WebApplicationFirewallPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if policyName == "" { + return nil, errors.New("parameter policyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WebApplicationFirewallPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesClientCreateOrUpdateResponse, error) { + result := WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicy); err != nil { + return WebApplicationFirewallPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// policyName - The name of the policy. +// options - WebApplicationFirewallPoliciesClientBeginDeleteOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.BeginDelete +// method. +func (client *WebApplicationFirewallPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientBeginDeleteOptions) (*runtime.Poller[WebApplicationFirewallPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, policyName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[WebApplicationFirewallPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[WebApplicationFirewallPoliciesClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes Policy. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *WebApplicationFirewallPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, policyName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WebApplicationFirewallPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if policyName == "" { + return nil, errors.New("parameter policyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieve protection policy with specified name within a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// policyName - The name of the policy. +// options - WebApplicationFirewallPoliciesClientGetOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.Get +// method. +func (client *WebApplicationFirewallPoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientGetOptions) (WebApplicationFirewallPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, policyName, options) + if err != nil { + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebApplicationFirewallPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebApplicationFirewallPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, policyName string, options *WebApplicationFirewallPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if policyName == "" { + return nil, errors.New("parameter policyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebApplicationFirewallPoliciesClient) getHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesClientGetResponse, error) { + result := WebApplicationFirewallPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicy); err != nil { + return WebApplicationFirewallPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the protection policies within a resource group. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// options - WebApplicationFirewallPoliciesClientListOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.List +// method. +func (client *WebApplicationFirewallPoliciesClient) NewListPager(resourceGroupName string, options *WebApplicationFirewallPoliciesClientListOptions) *runtime.Pager[WebApplicationFirewallPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WebApplicationFirewallPoliciesClientListResponse]{ + More: func(page WebApplicationFirewallPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebApplicationFirewallPoliciesClientListResponse) (WebApplicationFirewallPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WebApplicationFirewallPoliciesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebApplicationFirewallPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *WebApplicationFirewallPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *WebApplicationFirewallPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WebApplicationFirewallPoliciesClient) listHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesClientListResponse, error) { + result := WebApplicationFirewallPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicyListResult); err != nil { + return WebApplicationFirewallPoliciesClientListResponse{}, err + } + return result, nil +} + +// NewListAllPager - Gets all the WAF policies in a subscription. +// Generated from API version 2022-05-01 +// options - WebApplicationFirewallPoliciesClientListAllOptions contains the optional parameters for the WebApplicationFirewallPoliciesClient.ListAll +// method. +func (client *WebApplicationFirewallPoliciesClient) NewListAllPager(options *WebApplicationFirewallPoliciesClientListAllOptions) *runtime.Pager[WebApplicationFirewallPoliciesClientListAllResponse] { + return runtime.NewPager(runtime.PagingHandler[WebApplicationFirewallPoliciesClientListAllResponse]{ + More: func(page WebApplicationFirewallPoliciesClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebApplicationFirewallPoliciesClientListAllResponse) (WebApplicationFirewallPoliciesClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WebApplicationFirewallPoliciesClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebApplicationFirewallPoliciesClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebApplicationFirewallPoliciesClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) + }, + }) +} + +// listAllCreateRequest creates the ListAll request. +func (client *WebApplicationFirewallPoliciesClient) listAllCreateRequest(ctx context.Context, options *WebApplicationFirewallPoliciesClientListAllOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllHandleResponse handles the ListAll response. +func (client *WebApplicationFirewallPoliciesClient) listAllHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesClientListAllResponse, error) { + result := WebApplicationFirewallPoliciesClientListAllResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicyListResult); err != nil { + return WebApplicationFirewallPoliciesClientListAllResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webcategories_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webcategories_client.go new file mode 100644 index 000000000..61fcf1f65 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2/webcategories_client.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armnetwork + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WebCategoriesClient contains the methods for the WebCategories group. +// Don't use this type directly, use NewWebCategoriesClient() instead. +type WebCategoriesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewWebCategoriesClient creates a new instance of WebCategoriesClient with the specified values. +// subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription +// ID forms part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewWebCategoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WebCategoriesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &WebCategoriesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified Azure Web Category. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// name - The name of the azureWebCategory. +// options - WebCategoriesClientGetOptions contains the optional parameters for the WebCategoriesClient.Get method. +func (client *WebCategoriesClient) Get(ctx context.Context, name string, options *WebCategoriesClientGetOptions) (WebCategoriesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, name, options) + if err != nil { + return WebCategoriesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebCategoriesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebCategoriesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *WebCategoriesClient) getCreateRequest(ctx context.Context, name string, options *WebCategoriesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WebCategoriesClient) getHandleResponse(resp *http.Response) (WebCategoriesClientGetResponse, error) { + result := WebCategoriesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureWebCategory); err != nil { + return WebCategoriesClientGetResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets all the Azure Web Categories in a subscription. +// Generated from API version 2022-05-01 +// options - WebCategoriesClientListBySubscriptionOptions contains the optional parameters for the WebCategoriesClient.ListBySubscription +// method. +func (client *WebCategoriesClient) NewListBySubscriptionPager(options *WebCategoriesClientListBySubscriptionOptions) *runtime.Pager[WebCategoriesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[WebCategoriesClientListBySubscriptionResponse]{ + More: func(page WebCategoriesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WebCategoriesClientListBySubscriptionResponse) (WebCategoriesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WebCategoriesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WebCategoriesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WebCategoriesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *WebCategoriesClient) listBySubscriptionCreateRequest(ctx context.Context, options *WebCategoriesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *WebCategoriesClient) listBySubscriptionHandleResponse(resp *http.Response) (WebCategoriesClientListBySubscriptionResponse, error) { + result := WebCategoriesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureWebCategoryListResult); err != nil { + return WebCategoriesClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md new file mode 100644 index 000000000..00f0f3e97 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/CHANGELOG.md @@ -0,0 +1,2247 @@ +# Release History + +## 1.0.0 (2022-05-16) +### Breaking Changes + +- Function `*DeploymentsClient.BeginDeleteAtSubscriptionScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientDeleteAtSubscriptionScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientDeleteAtSubscriptionScopeResponse], error)` +- Function `*Client.BeginDeleteByID` return value(s) have been changed from `(*armruntime.Poller[ClientDeleteByIDResponse], error)` to `(*runtime.Poller[ClientDeleteByIDResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtManagementGroupScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientDeleteAtManagementGroupScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientDeleteAtManagementGroupScopeResponse], error)` +- Function `*Client.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[ClientDeleteResponse], error)` to `(*runtime.Poller[ClientDeleteResponse], error)` +- Function `*ResourceGroupsClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[ResourceGroupsClientDeleteResponse], error)` to `(*runtime.Poller[ResourceGroupsClientDeleteResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientDeleteAtScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientDeleteAtScopeResponse], error)` +- Function `*DeploymentsClient.BeginWhatIfAtManagementGroupScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientWhatIfAtManagementGroupScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientWhatIfAtManagementGroupScopeResponse], error)` +- Function `*Client.BeginUpdate` return value(s) have been changed from `(*armruntime.Poller[ClientUpdateResponse], error)` to `(*runtime.Poller[ClientUpdateResponse], error)` +- Function `*DeploymentsClient.BeginWhatIfAtTenantScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientWhatIfAtTenantScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientWhatIfAtTenantScopeResponse], error)` +- Function `*Client.BeginCreateOrUpdate` return value(s) have been changed from `(*armruntime.Poller[ClientCreateOrUpdateResponse], error)` to `(*runtime.Poller[ClientCreateOrUpdateResponse], error)` +- Function `*Client.BeginValidateMoveResources` return value(s) have been changed from `(*armruntime.Poller[ClientValidateMoveResourcesResponse], error)` to `(*runtime.Poller[ClientValidateMoveResourcesResponse], error)` +- Function `*DeploymentsClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientDeleteResponse], error)` to `(*runtime.Poller[DeploymentsClientDeleteResponse], error)` +- Function `*DeploymentsClient.BeginValidate` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientValidateResponse], error)` to `(*runtime.Poller[DeploymentsClientValidateResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtManagementGroupScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientValidateAtManagementGroupScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientValidateAtManagementGroupScopeResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtSubscriptionScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientValidateAtSubscriptionScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientValidateAtSubscriptionScopeResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientValidateAtScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientValidateAtScopeResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtTenantScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientValidateAtTenantScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientValidateAtTenantScopeResponse], error)` +- Function `*Client.BeginCreateOrUpdateByID` return value(s) have been changed from `(*armruntime.Poller[ClientCreateOrUpdateByIDResponse], error)` to `(*runtime.Poller[ClientCreateOrUpdateByIDResponse], error)` +- Function `*Client.BeginMoveResources` return value(s) have been changed from `(*armruntime.Poller[ClientMoveResourcesResponse], error)` to `(*runtime.Poller[ClientMoveResourcesResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtTenantScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientDeleteAtTenantScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientDeleteAtTenantScopeResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse], error)` +- Function `*Client.BeginUpdateByID` return value(s) have been changed from `(*armruntime.Poller[ClientUpdateByIDResponse], error)` to `(*runtime.Poller[ClientUpdateByIDResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtTenantScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientCreateOrUpdateAtScopeResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse], error)` +- Function `*ResourceGroupsClient.BeginExportTemplate` return value(s) have been changed from `(*armruntime.Poller[ResourceGroupsClientExportTemplateResponse], error)` to `(*runtime.Poller[ResourceGroupsClientExportTemplateResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdate` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientCreateOrUpdateResponse], error)` to `(*runtime.Poller[DeploymentsClientCreateOrUpdateResponse], error)` +- Function `*DeploymentsClient.BeginWhatIfAtSubscriptionScope` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientWhatIfAtSubscriptionScopeResponse], error)` to `(*runtime.Poller[DeploymentsClientWhatIfAtSubscriptionScopeResponse], error)` +- Function `*DeploymentsClient.BeginWhatIf` return value(s) have been changed from `(*armruntime.Poller[DeploymentsClientWhatIfResponse], error)` to `(*runtime.Poller[DeploymentsClientWhatIfResponse], error)` +- Function `DeploymentPropertiesExtended.MarshalJSON` has been removed +- Function `TagsListResult.MarshalJSON` has been removed +- Function `Permission.MarshalJSON` has been removed +- Function `ProviderExtendedLocation.MarshalJSON` has been removed +- Function `Provider.MarshalJSON` has been removed +- Function `Dependency.MarshalJSON` has been removed +- Function `OperationListResult.MarshalJSON` has been removed +- Function `ProviderResourceType.MarshalJSON` has been removed +- Function `WhatIfChange.MarshalJSON` has been removed +- Function `DeploymentListResult.MarshalJSON` has been removed +- Function `ResourceGroupListResult.MarshalJSON` has been removed +- Function `ErrorResponse.MarshalJSON` has been removed +- Function `Alias.MarshalJSON` has been removed +- Function `ProviderPermissionListResult.MarshalJSON` has been removed +- Function `RoleDefinition.MarshalJSON` has been removed +- Function `ZoneMapping.MarshalJSON` has been removed +- Function `ProviderResourceTypeListResult.MarshalJSON` has been removed +- Function `ProviderListResult.MarshalJSON` has been removed +- Function `AliasPath.MarshalJSON` has been removed +- Function `DeploymentOperationsListResult.MarshalJSON` has been removed +- Function `WhatIfPropertyChange.MarshalJSON` has been removed +- Function `WhatIfOperationProperties.MarshalJSON` has been removed +- Function `TagDetails.MarshalJSON` has been removed +- Function `ResourceListResult.MarshalJSON` has been removed +- Function `DeploymentOperationProperties.MarshalJSON` has been removed +- Function `DeploymentExtended.MarshalJSON` has been removed + + +## 0.5.0 (2022-04-18) +### Breaking Changes + +- Function `*OperationsClient.List` has been removed +- Function `*DeploymentOperationsClient.ListAtTenantScope` has been removed +- Function `*DeploymentsClient.ListAtSubscriptionScope` has been removed +- Function `*DeploymentsClient.ListByResourceGroup` has been removed +- Function `*ResourceGroupsClient.List` has been removed +- Function `*DeploymentsClient.ListAtTenantScope` has been removed +- Function `*DeploymentsClient.ListAtScope` has been removed +- Function `*Client.List` has been removed +- Function `*DeploymentOperationsClient.List` has been removed +- Function `*DeploymentOperationsClient.ListAtManagementGroupScope` has been removed +- Function `*DeploymentOperationsClient.ListAtSubscriptionScope` has been removed +- Function `*ProvidersClient.List` has been removed +- Function `*ProvidersClient.ListAtTenantScope` has been removed +- Function `*DeploymentsClient.ListAtManagementGroupScope` has been removed +- Function `*DeploymentOperationsClient.ListAtScope` has been removed +- Function `*TagsClient.List` has been removed +- Function `*Client.ListByResourceGroup` has been removed + +### Features Added + +- New function `*Client.NewListByResourceGroupPager(string, *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse]` +- New function `*DeploymentsClient.NewListAtSubscriptionScopePager(*DeploymentsClientListAtSubscriptionScopeOptions) *runtime.Pager[DeploymentsClientListAtSubscriptionScopeResponse]` +- New function `*DeploymentOperationsClient.NewListPager(string, string, *DeploymentOperationsClientListOptions) *runtime.Pager[DeploymentOperationsClientListResponse]` +- New function `*ProvidersClient.NewListAtTenantScopePager(*ProvidersClientListAtTenantScopeOptions) *runtime.Pager[ProvidersClientListAtTenantScopeResponse]` +- New function `*DeploymentsClient.NewListAtScopePager(string, *DeploymentsClientListAtScopeOptions) *runtime.Pager[DeploymentsClientListAtScopeResponse]` +- New function `*TagsClient.NewListPager(*TagsClientListOptions) *runtime.Pager[TagsClientListResponse]` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `*DeploymentOperationsClient.NewListAtScopePager(string, string, *DeploymentOperationsClientListAtScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtScopeResponse]` +- New function `*DeploymentOperationsClient.NewListAtTenantScopePager(string, *DeploymentOperationsClientListAtTenantScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtTenantScopeResponse]` +- New function `*ProvidersClient.NewListPager(*ProvidersClientListOptions) *runtime.Pager[ProvidersClientListResponse]` +- New function `*DeploymentOperationsClient.NewListAtManagementGroupScopePager(string, string, *DeploymentOperationsClientListAtManagementGroupScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtManagementGroupScopeResponse]` +- New function `*DeploymentOperationsClient.NewListAtSubscriptionScopePager(string, *DeploymentOperationsClientListAtSubscriptionScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtSubscriptionScopeResponse]` +- New function `*DeploymentsClient.NewListByResourceGroupPager(string, *DeploymentsClientListByResourceGroupOptions) *runtime.Pager[DeploymentsClientListByResourceGroupResponse]` +- New function `*DeploymentsClient.NewListAtTenantScopePager(*DeploymentsClientListAtTenantScopeOptions) *runtime.Pager[DeploymentsClientListAtTenantScopeResponse]` +- New function `*Client.NewListPager(*ClientListOptions) *runtime.Pager[ClientListResponse]` +- New function `*ResourceGroupsClient.NewListPager(*ResourceGroupsClientListOptions) *runtime.Pager[ResourceGroupsClientListResponse]` +- New function `*DeploymentsClient.NewListAtManagementGroupScopePager(string, *DeploymentsClientListAtManagementGroupScopeOptions) *runtime.Pager[DeploymentsClientListAtManagementGroupScopeResponse]` + + +## 0.4.0 (2022-04-08) +### Breaking Changes + +- Function `*Client.BeginMoveResources` return value(s) have been changed from `(ClientMoveResourcesPollerResponse, error)` to `(*armruntime.Poller[ClientMoveResourcesResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope` return value(s) have been changed from `(DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse], error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `NewDeploymentsClient` return value(s) have been changed from `(*DeploymentsClient)` to `(*DeploymentsClient, error)` +- Function `*DeploymentsClient.CalculateTemplateHash` parameter(s) have been changed from `(context.Context, map[string]interface{}, *DeploymentsClientCalculateTemplateHashOptions)` to `(context.Context, interface{}, *DeploymentsClientCalculateTemplateHashOptions)` +- Function `*DeploymentsClient.BeginValidateAtTenantScope` return value(s) have been changed from `(DeploymentsClientValidateAtTenantScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientValidateAtTenantScopeResponse], error)` +- Function `*Client.BeginCreateOrUpdate` return value(s) have been changed from `(ClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[ClientCreateOrUpdateResponse], error)` +- Function `*ProvidersClient.ListAtTenantScope` return value(s) have been changed from `(*ProvidersClientListAtTenantScopePager)` to `(*runtime.Pager[ProvidersClientListAtTenantScopeResponse])` +- Function `*DeploymentsClient.BeginDelete` return value(s) have been changed from `(DeploymentsClientDeletePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientDeleteResponse], error)` +- Function `*DeploymentOperationsClient.ListAtManagementGroupScope` return value(s) have been changed from `(*DeploymentOperationsClientListAtManagementGroupScopePager)` to `(*runtime.Pager[DeploymentOperationsClientListAtManagementGroupScopeResponse])` +- Function `*Client.BeginUpdateByID` return value(s) have been changed from `(ClientUpdateByIDPollerResponse, error)` to `(*armruntime.Poller[ClientUpdateByIDResponse], error)` +- Function `*DeploymentsClient.BeginValidate` return value(s) have been changed from `(DeploymentsClientValidatePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientValidateResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtManagementGroupScope` return value(s) have been changed from `(DeploymentsClientValidateAtManagementGroupScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientValidateAtManagementGroupScopeResponse], error)` +- Function `*ResourceGroupsClient.BeginExportTemplate` return value(s) have been changed from `(ResourceGroupsClientExportTemplatePollerResponse, error)` to `(*armruntime.Poller[ResourceGroupsClientExportTemplateResponse], error)` +- Function `NewProvidersClient` return value(s) have been changed from `(*ProvidersClient)` to `(*ProvidersClient, error)` +- Function `*DeploymentsClient.BeginValidateAtSubscriptionScope` return value(s) have been changed from `(DeploymentsClientValidateAtSubscriptionScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientValidateAtSubscriptionScopeResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtScope` return value(s) have been changed from `(DeploymentsClientDeleteAtScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientDeleteAtScopeResponse], error)` +- Function `*DeploymentsClient.ListAtManagementGroupScope` return value(s) have been changed from `(*DeploymentsClientListAtManagementGroupScopePager)` to `(*runtime.Pager[DeploymentsClientListAtManagementGroupScopeResponse])` +- Function `NewTagsClient` return value(s) have been changed from `(*TagsClient)` to `(*TagsClient, error)` +- Function `*DeploymentsClient.BeginWhatIfAtTenantScope` return value(s) have been changed from `(DeploymentsClientWhatIfAtTenantScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientWhatIfAtTenantScopeResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtTenantScope` return value(s) have been changed from `(DeploymentsClientDeleteAtTenantScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientDeleteAtTenantScopeResponse], error)` +- Function `NewDeploymentOperationsClient` return value(s) have been changed from `(*DeploymentOperationsClient)` to `(*DeploymentOperationsClient, error)` +- Function `*ResourceGroupsClient.List` return value(s) have been changed from `(*ResourceGroupsClientListPager)` to `(*runtime.Pager[ResourceGroupsClientListResponse])` +- Function `*DeploymentOperationsClient.ListAtTenantScope` return value(s) have been changed from `(*DeploymentOperationsClientListAtTenantScopePager)` to `(*runtime.Pager[DeploymentOperationsClientListAtTenantScopeResponse])` +- Function `*DeploymentsClient.BeginWhatIf` return value(s) have been changed from `(DeploymentsClientWhatIfPollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientWhatIfResponse], error)` +- Function `*ResourceGroupsClient.BeginDelete` return value(s) have been changed from `(ResourceGroupsClientDeletePollerResponse, error)` to `(*armruntime.Poller[ResourceGroupsClientDeleteResponse], error)` +- Function `*DeploymentsClient.BeginWhatIfAtSubscriptionScope` return value(s) have been changed from `(DeploymentsClientWhatIfAtSubscriptionScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientWhatIfAtSubscriptionScopeResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdate` return value(s) have been changed from `(DeploymentsClientCreateOrUpdatePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientCreateOrUpdateResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtManagementGroupScope` return value(s) have been changed from `(DeploymentsClientDeleteAtManagementGroupScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientDeleteAtManagementGroupScopeResponse], error)` +- Function `*DeploymentsClient.ListByResourceGroup` return value(s) have been changed from `(*DeploymentsClientListByResourceGroupPager)` to `(*runtime.Pager[DeploymentsClientListByResourceGroupResponse])` +- Function `*ProvidersClient.List` return value(s) have been changed from `(*ProvidersClientListPager)` to `(*runtime.Pager[ProvidersClientListResponse])` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope` return value(s) have been changed from `(DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse], error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtTenantScope` return value(s) have been changed from `(DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse], error)` +- Function `*DeploymentsClient.ListAtScope` return value(s) have been changed from `(*DeploymentsClientListAtScopePager)` to `(*runtime.Pager[DeploymentsClientListAtScopeResponse])` +- Function `*Client.List` return value(s) have been changed from `(*ClientListPager)` to `(*runtime.Pager[ClientListResponse])` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtScope` return value(s) have been changed from `(DeploymentsClientCreateOrUpdateAtScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientCreateOrUpdateAtScopeResponse], error)` +- Function `*DeploymentOperationsClient.List` return value(s) have been changed from `(*DeploymentOperationsClientListPager)` to `(*runtime.Pager[DeploymentOperationsClientListResponse])` +- Function `*DeploymentOperationsClient.ListAtScope` return value(s) have been changed from `(*DeploymentOperationsClientListAtScopePager)` to `(*runtime.Pager[DeploymentOperationsClientListAtScopeResponse])` +- Function `NewOperationsClient` return value(s) have been changed from `(*OperationsClient)` to `(*OperationsClient, error)` +- Function `NewProviderResourceTypesClient` return value(s) have been changed from `(*ProviderResourceTypesClient)` to `(*ProviderResourceTypesClient, error)` +- Function `*Client.BeginCreateOrUpdateByID` return value(s) have been changed from `(ClientCreateOrUpdateByIDPollerResponse, error)` to `(*armruntime.Poller[ClientCreateOrUpdateByIDResponse], error)` +- Function `*Client.BeginUpdate` return value(s) have been changed from `(ClientUpdatePollerResponse, error)` to `(*armruntime.Poller[ClientUpdateResponse], error)` +- Function `*DeploymentsClient.BeginWhatIfAtManagementGroupScope` return value(s) have been changed from `(DeploymentsClientWhatIfAtManagementGroupScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientWhatIfAtManagementGroupScopeResponse], error)` +- Function `*Client.BeginDelete` return value(s) have been changed from `(ClientDeletePollerResponse, error)` to `(*armruntime.Poller[ClientDeleteResponse], error)` +- Function `*DeploymentsClient.ListAtSubscriptionScope` return value(s) have been changed from `(*DeploymentsClientListAtSubscriptionScopePager)` to `(*runtime.Pager[DeploymentsClientListAtSubscriptionScopeResponse])` +- Function `*DeploymentsClient.ListAtTenantScope` return value(s) have been changed from `(*DeploymentsClientListAtTenantScopePager)` to `(*runtime.Pager[DeploymentsClientListAtTenantScopeResponse])` +- Function `*DeploymentOperationsClient.ListAtSubscriptionScope` return value(s) have been changed from `(*DeploymentOperationsClientListAtSubscriptionScopePager)` to `(*runtime.Pager[DeploymentOperationsClientListAtSubscriptionScopeResponse])` +- Function `*Client.ListByResourceGroup` return value(s) have been changed from `(*ClientListByResourceGroupPager)` to `(*runtime.Pager[ClientListByResourceGroupResponse])` +- Function `NewResourceGroupsClient` return value(s) have been changed from `(*ResourceGroupsClient)` to `(*ResourceGroupsClient, error)` +- Function `*TagsClient.List` return value(s) have been changed from `(*TagsClientListPager)` to `(*runtime.Pager[TagsClientListResponse])` +- Function `*Client.BeginValidateMoveResources` return value(s) have been changed from `(ClientValidateMoveResourcesPollerResponse, error)` to `(*armruntime.Poller[ClientValidateMoveResourcesResponse], error)` +- Function `*DeploymentsClient.BeginValidateAtScope` return value(s) have been changed from `(DeploymentsClientValidateAtScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientValidateAtScopeResponse], error)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsClientListPager)` to `(*runtime.Pager[OperationsClientListResponse])` +- Function `*Client.BeginDeleteByID` return value(s) have been changed from `(ClientDeleteByIDPollerResponse, error)` to `(*armruntime.Poller[ClientDeleteByIDResponse], error)` +- Function `*DeploymentsClient.BeginDeleteAtSubscriptionScope` return value(s) have been changed from `(DeploymentsClientDeleteAtSubscriptionScopePollerResponse, error)` to `(*armruntime.Poller[DeploymentsClientDeleteAtSubscriptionScopeResponse], error)` +- Type of `DeploymentProperties.Parameters` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentProperties.Template` has been changed from `map[string]interface{}` to `interface{}` +- Type of `WhatIfChange.After` has been changed from `map[string]interface{}` to `interface{}` +- Type of `WhatIfChange.Before` has been changed from `map[string]interface{}` to `interface{}` +- Type of `ErrorAdditionalInfo.Info` has been changed from `map[string]interface{}` to `interface{}` +- Type of `WhatIfPropertyChange.After` has been changed from `map[string]interface{}` to `interface{}` +- Type of `WhatIfPropertyChange.Before` has been changed from `map[string]interface{}` to `interface{}` +- Type of `GenericResource.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentPropertiesExtended.Outputs` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentPropertiesExtended.Parameters` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentWhatIfProperties.Parameters` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentWhatIfProperties.Template` has been changed from `map[string]interface{}` to `interface{}` +- Type of `HTTPMessage.Content` has been changed from `map[string]interface{}` to `interface{}` +- Type of `DeploymentExportResult.Template` has been changed from `map[string]interface{}` to `interface{}` +- Type of `ResourceGroupExportResult.Template` has been changed from `map[string]interface{}` to `interface{}` +- Type of `GenericResourceExpanded.Properties` has been changed from `map[string]interface{}` to `interface{}` +- Function `ProvisioningOperation.ToPtr` has been removed +- Function `*DeploymentsClientValidateAtSubscriptionScopePoller.Done` has been removed +- Function `*ProvidersClientListAtTenantScopePager.PageResponse` has been removed +- Function `*OperationsClientListPager.Err` has been removed +- Function `*DeploymentsClientValidateAtScopePoller.Poll` has been removed +- Function `ProvisioningState.ToPtr` has been removed +- Function `*ClientListByResourceGroupPager.Err` has been removed +- Function `*ClientDeleteByIDPoller.FinalResponse` has been removed +- Function `*ProvidersClientListPager.PageResponse` has been removed +- Function `*DeploymentsClientValidateAtScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientListAtScopePager.Err` has been removed +- Function `*ClientListPager.NextPage` has been removed +- Function `*DeploymentsClientListAtTenantScopePager.Err` has been removed +- Function `ResourceIdentityType.ToPtr` has been removed +- Function `ExtendedLocationType.ToPtr` has been removed +- Function `*DeploymentsClientDeleteAtScopePoller.Done` has been removed +- Function `*ResourceGroupsClientDeletePoller.Done` has been removed +- Function `*ClientListPager.Err` has been removed +- Function `*ClientCreateOrUpdateByIDPollerResponse.Resume` has been removed +- Function `*ClientCreateOrUpdateByIDPoller.ResumeToken` has been removed +- Function `*DeploymentsClientDeleteAtManagementGroupScopePoller.Poll` has been removed +- Function `*DeploymentsClientDeleteAtTenantScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientDeletePoller.ResumeToken` has been removed +- Function `*DeploymentOperationsClientListAtScopePager.NextPage` has been removed +- Function `*ClientValidateMoveResourcesPollerResponse.Resume` has been removed +- Function `ClientMoveResourcesPollerResponse.PollUntilDone` has been removed +- Function `*ResourceGroupsClientExportTemplatePoller.FinalResponse` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtScopePoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ClientDeletePollerResponse.Resume` has been removed +- Function `*DeploymentsClientValidateAtSubscriptionScopePoller.Poll` has been removed +- Function `*ClientListByResourceGroupPager.NextPage` has been removed +- Function `*DeploymentsClientDeleteAtTenantScopePollerResponse.Resume` has been removed +- Function `*ProvidersClientListPager.Err` has been removed +- Function `*OperationsClientListPager.NextPage` has been removed +- Function `DeploymentsClientValidateAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*ClientListPager.PageResponse` has been removed +- Function `*ClientDeletePoller.FinalResponse` has been removed +- Function `*DeploymentsClientWhatIfPollerResponse.Resume` has been removed +- Function `*DeploymentsClientListAtManagementGroupScopePager.PageResponse` has been removed +- Function `*DeploymentOperationsClientListAtSubscriptionScopePager.Err` has been removed +- Function `*DeploymentsClientWhatIfPoller.Done` has been removed +- Function `DeploymentsClientValidateAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*ClientUpdatePoller.Poll` has been removed +- Function `*ClientDeletePoller.Done` has been removed +- Function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientListAtSubscriptionScopePager.Err` has been removed +- Function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.Poll` has been removed +- Function `*DeploymentsClientWhatIfPoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientWhatIfPoller.ResumeToken` has been removed +- Function `*ClientMoveResourcesPoller.Done` has been removed +- Function `*DeploymentsClientDeleteAtSubscriptionScopePoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.Done` has been removed +- Function `*TagsClientListPager.Err` has been removed +- Function `*DeploymentsClientDeleteAtTenantScopePoller.Poll` has been removed +- Function `*ClientMoveResourcesPoller.ResumeToken` has been removed +- Function `*ResourceGroupsClientExportTemplatePoller.Poll` has been removed +- Function `*DeploymentsClientValidateAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `DeploymentsClientDeleteAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*ClientListByResourceGroupPager.PageResponse` has been removed +- Function `DeploymentsClientValidateAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `DeploymentMode.ToPtr` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*DeploymentsClientWhatIfAtTenantScopePoller.Poll` has been removed +- Function `*ProvidersClientListAtTenantScopePager.NextPage` has been removed +- Function `*DeploymentsClientValidateAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientValidateAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientValidatePollerResponse.Resume` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtScopePoller.Done` has been removed +- Function `ChangeType.ToPtr` has been removed +- Function `DeploymentsClientWhatIfAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentOperationsClientListAtTenantScopePager.NextPage` has been removed +- Function `*DeploymentsClientDeleteAtSubscriptionScopePoller.Done` has been removed +- Function `*DeploymentsClientValidateAtManagementGroupScopePoller.Poll` has been removed +- Function `*ResourceGroupsClientListPager.Err` has been removed +- Function `*ResourceGroupsClientExportTemplatePoller.ResumeToken` has been removed +- Function `DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ClientCreateOrUpdateByIDPoller.Done` has been removed +- Function `*DeploymentsClientWhatIfAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*DeploymentsClientValidateAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentOperationsClientListAtSubscriptionScopePager.NextPage` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtScopePollerResponse.Resume` has been removed +- Function `*DeploymentsClientDeletePoller.Poll` has been removed +- Function `*ClientDeleteByIDPoller.Poll` has been removed +- Function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `ClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientDeletePoller.Done` has been removed +- Function `*DeploymentsClientListAtManagementGroupScopePager.Err` has been removed +- Function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.Poll` has been removed +- Function `*ClientValidateMoveResourcesPoller.FinalResponse` has been removed +- Function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.Poll` has been removed +- Function `AliasPatternType.ToPtr` has been removed +- Function `*ClientUpdateByIDPoller.ResumeToken` has been removed +- Function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.Done` has been removed +- Function `*DeploymentsClientValidateAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientWhatIfAtTenantScopePoller.Done` has been removed +- Function `*DeploymentsClientListAtScopePager.NextPage` has been removed +- Function `ClientValidateMoveResourcesPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientDeletePollerResponse.Resume` has been removed +- Function `ExpressionEvaluationOptionsScopeType.ToPtr` has been removed +- Function `*DeploymentsClientDeleteAtTenantScopePoller.Done` has been removed +- Function `WhatIfResultFormat.ToPtr` has been removed +- Function `*ClientValidateMoveResourcesPoller.Done` has been removed +- Function `*DeploymentsClientDeleteAtScopePoller.Poll` has been removed +- Function `*ResourceGroupsClientExportTemplatePollerResponse.Resume` has been removed +- Function `*DeploymentsClientDeleteAtTenantScopePoller.ResumeToken` has been removed +- Function `*ClientUpdatePollerResponse.Resume` has been removed +- Function `*DeploymentsClientWhatIfAtTenantScopePoller.FinalResponse` has been removed +- Function `*OperationsClientListPager.PageResponse` has been removed +- Function `*DeploymentsClientDeleteAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `*DeploymentOperationsClientListPager.Err` has been removed +- Function `*ClientMoveResourcesPoller.FinalResponse` has been removed +- Function `*DeploymentsClientValidateAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `AliasPathTokenType.ToPtr` has been removed +- Function `*TagsClientListPager.NextPage` has been removed +- Function `*ResourceGroupsClientListPager.NextPage` has been removed +- Function `*DeploymentsClientValidateAtTenantScopePoller.Done` has been removed +- Function `*DeploymentsClientValidatePoller.Poll` has been removed +- Function `*ProvidersClientListPager.NextPage` has been removed +- Function `DeploymentsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*ClientValidateMoveResourcesPoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*ClientCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*DeploymentsClientCreateOrUpdatePoller.Poll` has been removed +- Function `*ResourceGroupsClientDeletePoller.FinalResponse` has been removed +- Function `*DeploymentsClientListAtTenantScopePager.PageResponse` has been removed +- Function `*ClientUpdateByIDPollerResponse.Resume` has been removed +- Function `*DeploymentsClientValidateAtTenantScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtScopePoller.ResumeToken` has been removed +- Function `*ResourceGroupsClientDeletePollerResponse.Resume` has been removed +- Function `*ClientCreateOrUpdatePoller.Done` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*ClientCreateOrUpdateByIDPoller.FinalResponse` has been removed +- Function `*DeploymentOperationsClientListAtTenantScopePager.Err` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentsClientValidateAtTenantScopePollerResponse.Resume` has been removed +- Function `PropertyChangeType.ToPtr` has been removed +- Function `*DeploymentOperationsClientListAtSubscriptionScopePager.PageResponse` has been removed +- Function `*DeploymentsClientValidateAtScopePoller.FinalResponse` has been removed +- Function `DeploymentsClientValidateAtScopePollerResponse.PollUntilDone` has been removed +- Function `DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourceGroupsClientDeletePoller.Poll` has been removed +- Function `*DeploymentsClientValidateAtScopePollerResponse.Resume` has been removed +- Function `*DeploymentOperationsClientListAtManagementGroupScopePager.Err` has been removed +- Function `*ProvidersClientListAtTenantScopePager.Err` has been removed +- Function `*DeploymentOperationsClientListAtManagementGroupScopePager.PageResponse` has been removed +- Function `*DeploymentsClientDeleteAtScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentsClientDeleteAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientDeleteAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*ClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ClientUpdateByIDPoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse.Resume` has been removed +- Function `*ClientUpdatePoller.FinalResponse` has been removed +- Function `*DeploymentsClientListAtManagementGroupScopePager.NextPage` has been removed +- Function `DeploymentsClientWhatIfPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientWhatIfAtTenantScopePoller.ResumeToken` has been removed +- Function `DeploymentsClientValidatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientDeleteAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*ClientCreateOrUpdateByIDPoller.Poll` has been removed +- Function `*ClientDeleteByIDPollerResponse.Resume` has been removed +- Function `*DeploymentsClientWhatIfAtTenantScopePollerResponse.Resume` has been removed +- Function `DeploymentsClientCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientListAtTenantScopePager.NextPage` has been removed +- Function `*ClientDeletePoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.Done` has been removed +- Function `*DeploymentsClientListByResourceGroupPager.PageResponse` has been removed +- Function `DeploymentsClientDeleteAtScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientWhatIfAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `*ClientUpdateByIDPoller.FinalResponse` has been removed +- Function `*DeploymentsClientValidatePoller.ResumeToken` has been removed +- Function `*ClientMoveResourcesPollerResponse.Resume` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.ResumeToken` has been removed +- Function `*ClientDeleteByIDPoller.Done` has been removed +- Function `*ResourceGroupsClientDeletePoller.ResumeToken` has been removed +- Function `*ClientCreateOrUpdatePoller.ResumeToken` has been removed +- Function `DeploymentsClientCreateOrUpdateAtScopePollerResponse.PollUntilDone` has been removed +- Function `ProviderAuthorizationConsentState.ToPtr` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.Poll` has been removed +- Function `*TagsClientListPager.PageResponse` has been removed +- Function `TagsPatchOperation.ToPtr` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `*ClientUpdatePoller.ResumeToken` has been removed +- Function `*DeploymentsClientWhatIfPoller.FinalResponse` has been removed +- Function `DeploymentsClientWhatIfAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientListAtScopePager.PageResponse` has been removed +- Function `*DeploymentsClientDeleteAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentOperationsClientListAtScopePager.PageResponse` has been removed +- Function `DeploymentsClientDeleteAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ClientDeleteByIDPoller.ResumeToken` has been removed +- Function `AliasPathAttributes.ToPtr` has been removed +- Function `ClientCreateOrUpdateByIDPollerResponse.PollUntilDone` has been removed +- Function `ResourceGroupsClientExportTemplatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentOperationsClientListAtScopePager.Err` has been removed +- Function `*ClientUpdatePoller.Done` has been removed +- Function `*DeploymentsClientListAtSubscriptionScopePager.PageResponse` has been removed +- Function `ClientDeletePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientCreateOrUpdatePoller.Done` has been removed +- Function `*DeploymentOperationsClientListAtTenantScopePager.PageResponse` has been removed +- Function `*DeploymentsClientValidateAtScopePoller.Done` has been removed +- Function `*DeploymentsClientDeleteAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `*ClientCreateOrUpdatePoller.Poll` has been removed +- Function `*DeploymentsClientValidateAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsClientValidateAtTenantScopePoller.Poll` has been removed +- Function `*DeploymentsClientCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*DeploymentsClientDeleteAtScopePoller.ResumeToken` has been removed +- Function `ClientDeleteByIDPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientListByResourceGroupPager.NextPage` has been removed +- Function `*ClientDeletePoller.ResumeToken` has been removed +- Function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtScopePoller.FinalResponse` has been removed +- Function `*DeploymentsClientValidatePoller.FinalResponse` has been removed +- Function `DeploymentsClientWhatIfAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentOperationsClientListAtManagementGroupScopePager.NextPage` has been removed +- Function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.Poll` has been removed +- Function `*DeploymentsClientDeletePoller.FinalResponse` has been removed +- Function `*DeploymentOperationsClientListPager.NextPage` has been removed +- Function `*ClientUpdateByIDPoller.Done` has been removed +- Function `*DeploymentsClientValidateAtTenantScopePoller.ResumeToken` has been removed +- Function `AliasType.ToPtr` has been removed +- Function `*DeploymentsClientDeleteAtScopePollerResponse.Resume` has been removed +- Function `OnErrorDeploymentType.ToPtr` has been removed +- Function `*DeploymentsClientListAtSubscriptionScopePager.NextPage` has been removed +- Function `*ClientMoveResourcesPoller.Poll` has been removed +- Function `*ResourceGroupsClientExportTemplatePoller.Done` has been removed +- Function `ClientUpdateByIDPollerResponse.PollUntilDone` has been removed +- Function `*ClientValidateMoveResourcesPoller.ResumeToken` has been removed +- Function `*DeploymentsClientDeleteAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*ResourceGroupsClientListPager.PageResponse` has been removed +- Function `ClientUpdatePollerResponse.PollUntilDone` has been removed +- Function `ResourceGroupsClientDeletePollerResponse.PollUntilDone` has been removed +- Function `DeploymentsClientDeleteAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsClientValidatePoller.Done` has been removed +- Function `*DeploymentOperationsClientListPager.PageResponse` has been removed +- Function `*DeploymentsClientListByResourceGroupPager.Err` has been removed +- Struct `ClientCheckExistenceByIDResult` has been removed +- Struct `ClientCheckExistenceResult` has been removed +- Struct `ClientCreateOrUpdateByIDPoller` has been removed +- Struct `ClientCreateOrUpdateByIDPollerResponse` has been removed +- Struct `ClientCreateOrUpdateByIDResult` has been removed +- Struct `ClientCreateOrUpdatePoller` has been removed +- Struct `ClientCreateOrUpdatePollerResponse` has been removed +- Struct `ClientCreateOrUpdateResult` has been removed +- Struct `ClientDeleteByIDPoller` has been removed +- Struct `ClientDeleteByIDPollerResponse` has been removed +- Struct `ClientDeletePoller` has been removed +- Struct `ClientDeletePollerResponse` has been removed +- Struct `ClientGetByIDResult` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListByResourceGroupPager` has been removed +- Struct `ClientListByResourceGroupResult` has been removed +- Struct `ClientListPager` has been removed +- Struct `ClientListResult` has been removed +- Struct `ClientMoveResourcesPoller` has been removed +- Struct `ClientMoveResourcesPollerResponse` has been removed +- Struct `ClientUpdateByIDPoller` has been removed +- Struct `ClientUpdateByIDPollerResponse` has been removed +- Struct `ClientUpdateByIDResult` has been removed +- Struct `ClientUpdatePoller` has been removed +- Struct `ClientUpdatePollerResponse` has been removed +- Struct `ClientUpdateResult` has been removed +- Struct `ClientValidateMoveResourcesPoller` has been removed +- Struct `ClientValidateMoveResourcesPollerResponse` has been removed +- Struct `DeploymentOperationsClientGetAtManagementGroupScopeResult` has been removed +- Struct `DeploymentOperationsClientGetAtScopeResult` has been removed +- Struct `DeploymentOperationsClientGetAtSubscriptionScopeResult` has been removed +- Struct `DeploymentOperationsClientGetAtTenantScopeResult` has been removed +- Struct `DeploymentOperationsClientGetResult` has been removed +- Struct `DeploymentOperationsClientListAtManagementGroupScopePager` has been removed +- Struct `DeploymentOperationsClientListAtManagementGroupScopeResult` has been removed +- Struct `DeploymentOperationsClientListAtScopePager` has been removed +- Struct `DeploymentOperationsClientListAtScopeResult` has been removed +- Struct `DeploymentOperationsClientListAtSubscriptionScopePager` has been removed +- Struct `DeploymentOperationsClientListAtSubscriptionScopeResult` has been removed +- Struct `DeploymentOperationsClientListAtTenantScopePager` has been removed +- Struct `DeploymentOperationsClientListAtTenantScopeResult` has been removed +- Struct `DeploymentOperationsClientListPager` has been removed +- Struct `DeploymentOperationsClientListResult` has been removed +- Struct `DeploymentsClientCalculateTemplateHashResult` has been removed +- Struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientCheckExistenceAtScopeResult` has been removed +- Struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientCheckExistenceAtTenantScopeResult` has been removed +- Struct `DeploymentsClientCheckExistenceResult` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtScopePoller` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtScopePollerResponse` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtScopeResult` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtTenantScopePoller` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsClientCreateOrUpdateAtTenantScopeResult` has been removed +- Struct `DeploymentsClientCreateOrUpdatePoller` has been removed +- Struct `DeploymentsClientCreateOrUpdatePollerResponse` has been removed +- Struct `DeploymentsClientCreateOrUpdateResult` has been removed +- Struct `DeploymentsClientDeleteAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsClientDeleteAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsClientDeleteAtScopePoller` has been removed +- Struct `DeploymentsClientDeleteAtScopePollerResponse` has been removed +- Struct `DeploymentsClientDeleteAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsClientDeleteAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsClientDeleteAtTenantScopePoller` has been removed +- Struct `DeploymentsClientDeleteAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsClientDeletePoller` has been removed +- Struct `DeploymentsClientDeletePollerResponse` has been removed +- Struct `DeploymentsClientExportTemplateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientExportTemplateAtScopeResult` has been removed +- Struct `DeploymentsClientExportTemplateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientExportTemplateAtTenantScopeResult` has been removed +- Struct `DeploymentsClientExportTemplateResult` has been removed +- Struct `DeploymentsClientGetAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientGetAtScopeResult` has been removed +- Struct `DeploymentsClientGetAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientGetAtTenantScopeResult` has been removed +- Struct `DeploymentsClientGetResult` has been removed +- Struct `DeploymentsClientListAtManagementGroupScopePager` has been removed +- Struct `DeploymentsClientListAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientListAtScopePager` has been removed +- Struct `DeploymentsClientListAtScopeResult` has been removed +- Struct `DeploymentsClientListAtSubscriptionScopePager` has been removed +- Struct `DeploymentsClientListAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientListAtTenantScopePager` has been removed +- Struct `DeploymentsClientListAtTenantScopeResult` has been removed +- Struct `DeploymentsClientListByResourceGroupPager` has been removed +- Struct `DeploymentsClientListByResourceGroupResult` has been removed +- Struct `DeploymentsClientValidateAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsClientValidateAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsClientValidateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientValidateAtScopePoller` has been removed +- Struct `DeploymentsClientValidateAtScopePollerResponse` has been removed +- Struct `DeploymentsClientValidateAtScopeResult` has been removed +- Struct `DeploymentsClientValidateAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsClientValidateAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsClientValidateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientValidateAtTenantScopePoller` has been removed +- Struct `DeploymentsClientValidateAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsClientValidateAtTenantScopeResult` has been removed +- Struct `DeploymentsClientValidatePoller` has been removed +- Struct `DeploymentsClientValidatePollerResponse` has been removed +- Struct `DeploymentsClientValidateResult` has been removed +- Struct `DeploymentsClientWhatIfAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsClientWhatIfAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsClientWhatIfAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsClientWhatIfAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsClientWhatIfAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsClientWhatIfAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsClientWhatIfAtTenantScopePoller` has been removed +- Struct `DeploymentsClientWhatIfAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsClientWhatIfAtTenantScopeResult` has been removed +- Struct `DeploymentsClientWhatIfPoller` has been removed +- Struct `DeploymentsClientWhatIfPollerResponse` has been removed +- Struct `DeploymentsClientWhatIfResult` has been removed +- Struct `OperationsClientListPager` has been removed +- Struct `OperationsClientListResult` has been removed +- Struct `ProviderResourceTypesClientListResult` has been removed +- Struct `ProvidersClientGetAtTenantScopeResult` has been removed +- Struct `ProvidersClientGetResult` has been removed +- Struct `ProvidersClientListAtTenantScopePager` has been removed +- Struct `ProvidersClientListAtTenantScopeResult` has been removed +- Struct `ProvidersClientListPager` has been removed +- Struct `ProvidersClientListResult` has been removed +- Struct `ProvidersClientProviderPermissionsResult` has been removed +- Struct `ProvidersClientRegisterResult` has been removed +- Struct `ProvidersClientUnregisterResult` has been removed +- Struct `ResourceGroupsClientCheckExistenceResult` has been removed +- Struct `ResourceGroupsClientCreateOrUpdateResult` has been removed +- Struct `ResourceGroupsClientDeletePoller` has been removed +- Struct `ResourceGroupsClientDeletePollerResponse` has been removed +- Struct `ResourceGroupsClientExportTemplatePoller` has been removed +- Struct `ResourceGroupsClientExportTemplatePollerResponse` has been removed +- Struct `ResourceGroupsClientExportTemplateResult` has been removed +- Struct `ResourceGroupsClientGetResult` has been removed +- Struct `ResourceGroupsClientListPager` has been removed +- Struct `ResourceGroupsClientListResult` has been removed +- Struct `ResourceGroupsClientUpdateResult` has been removed +- Struct `TagsClientCreateOrUpdateAtScopeResult` has been removed +- Struct `TagsClientCreateOrUpdateResult` has been removed +- Struct `TagsClientCreateOrUpdateValueResult` has been removed +- Struct `TagsClientGetAtScopeResult` has been removed +- Struct `TagsClientListPager` has been removed +- Struct `TagsClientListResult` has been removed +- Struct `TagsClientUpdateAtScopeResult` has been removed +- Field `DeploymentOperationsClientGetAtSubscriptionScopeResult` of struct `DeploymentOperationsClientGetAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientGetAtSubscriptionScopeResponse` has been removed +- Field `TagsClientCreateOrUpdateResult` of struct `TagsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `TagsClientCreateOrUpdateResponse` has been removed +- Field `DeploymentsClientExportTemplateAtManagementGroupScopeResult` of struct `DeploymentsClientExportTemplateAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientExportTemplateAtManagementGroupScopeResponse` has been removed +- Field `DeploymentsClientValidateAtSubscriptionScopeResult` of struct `DeploymentsClientValidateAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientValidateAtSubscriptionScopeResponse` has been removed +- Field `ClientCreateOrUpdateResult` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientCreateOrUpdateResponse` has been removed +- Field `DeploymentsClientListAtManagementGroupScopeResult` of struct `DeploymentsClientListAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientListAtManagementGroupScopeResponse` has been removed +- Field `DeploymentsClientValidateAtManagementGroupScopeResult` of struct `DeploymentsClientValidateAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientValidateAtManagementGroupScopeResponse` has been removed +- Field `ClientUpdateByIDResult` of struct `ClientUpdateByIDResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateByIDResponse` has been removed +- Field `DeploymentOperationsClientListAtSubscriptionScopeResult` of struct `DeploymentOperationsClientListAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientListAtSubscriptionScopeResponse` has been removed +- Field `DeploymentsClientGetAtSubscriptionScopeResult` of struct `DeploymentsClientGetAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientGetAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientDeleteAtTenantScopeResponse` has been removed +- Field `DeploymentsClientWhatIfResult` of struct `DeploymentsClientWhatIfResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientWhatIfResponse` has been removed +- Field `ProvidersClientGetAtTenantScopeResult` of struct `ProvidersClientGetAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientGetAtTenantScopeResponse` has been removed +- Field `DeploymentOperationsClientListResult` of struct `DeploymentOperationsClientListResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientListResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientDeleteResponse` has been removed +- Field `DeploymentsClientCheckExistenceAtScopeResult` of struct `DeploymentsClientCheckExistenceAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCheckExistenceAtScopeResponse` has been removed +- Field `ResourceGroupsClientGetResult` of struct `ResourceGroupsClientGetResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientGetResponse` has been removed +- Field `ResourceGroupsClientListResult` of struct `ResourceGroupsClientListResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientListResponse` has been removed +- Field `ClientCheckExistenceResult` of struct `ClientCheckExistenceResponse` has been removed +- Field `RawResponse` of struct `ClientCheckExistenceResponse` has been removed +- Field `DeploymentsClientExportTemplateAtSubscriptionScopeResult` of struct `DeploymentsClientExportTemplateAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientExportTemplateAtSubscriptionScopeResponse` has been removed +- Field `TagsClientCreateOrUpdateValueResult` of struct `TagsClientCreateOrUpdateValueResponse` has been removed +- Field `RawResponse` of struct `TagsClientCreateOrUpdateValueResponse` has been removed +- Field `DeploymentsClientGetResult` of struct `DeploymentsClientGetResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientGetResponse` has been removed +- Field `DeploymentOperationsClientListAtScopeResult` of struct `DeploymentOperationsClientListAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientListAtScopeResponse` has been removed +- Field `DeploymentOperationsClientGetAtTenantScopeResult` of struct `DeploymentOperationsClientGetAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientGetAtTenantScopeResponse` has been removed +- Field `DeploymentsClientCreateOrUpdateAtTenantScopeResult` of struct `DeploymentsClientCreateOrUpdateAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCreateOrUpdateAtTenantScopeResponse` has been removed +- Field `DeploymentOperationsClientGetResult` of struct `DeploymentOperationsClientGetResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientGetResponse` has been removed +- Field `DeploymentsClientGetAtManagementGroupScopeResult` of struct `DeploymentsClientGetAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientGetAtManagementGroupScopeResponse` has been removed +- Field `DeploymentsClientGetAtScopeResult` of struct `DeploymentsClientGetAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientGetAtScopeResponse` has been removed +- Field `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResult` of struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse` has been removed +- Field `ClientListResult` of struct `ClientListResponse` has been removed +- Field `RawResponse` of struct `ClientListResponse` has been removed +- Field `ProvidersClientRegisterResult` of struct `ProvidersClientRegisterResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientRegisterResponse` has been removed +- Field `TagsClientGetAtScopeResult` of struct `TagsClientGetAtScopeResponse` has been removed +- Field `RawResponse` of struct `TagsClientGetAtScopeResponse` has been removed +- Field `DeploymentOperationsClientGetAtScopeResult` of struct `DeploymentOperationsClientGetAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientGetAtScopeResponse` has been removed +- Field `DeploymentsClientListAtScopeResult` of struct `DeploymentsClientListAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientListAtScopeResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCancelAtTenantScopeResponse` has been removed +- Field `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResult` of struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCancelResponse` has been removed +- Field `RawResponse` of struct `ClientMoveResourcesResponse` has been removed +- Field `DeploymentsClientCheckExistenceResult` of struct `DeploymentsClientCheckExistenceResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCheckExistenceResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientDeleteAtScopeResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientRegisterAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCancelAtSubscriptionScopeResponse` has been removed +- Field `ClientGetByIDResult` of struct `ClientGetByIDResponse` has been removed +- Field `RawResponse` of struct `ClientGetByIDResponse` has been removed +- Field `ClientUpdateResult` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateResponse` has been removed +- Field `DeploymentsClientCheckExistenceAtTenantScopeResult` of struct `DeploymentsClientCheckExistenceAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCheckExistenceAtTenantScopeResponse` has been removed +- Field `DeploymentsClientWhatIfAtSubscriptionScopeResult` of struct `DeploymentsClientWhatIfAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientWhatIfAtSubscriptionScopeResponse` has been removed +- Field `DeploymentsClientGetAtTenantScopeResult` of struct `DeploymentsClientGetAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientGetAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCancelAtScopeResponse` has been removed +- Field `DeploymentsClientCheckExistenceAtManagementGroupScopeResult` of struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResponse` has been removed +- Field `ProvidersClientProviderPermissionsResult` of struct `ProvidersClientProviderPermissionsResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientProviderPermissionsResponse` has been removed +- Field `DeploymentsClientListByResourceGroupResult` of struct `DeploymentsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteByIDResponse` has been removed +- Field `DeploymentsClientWhatIfAtTenantScopeResult` of struct `DeploymentsClientWhatIfAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientWhatIfAtTenantScopeResponse` has been removed +- Field `ProviderResourceTypesClientListResult` of struct `ProviderResourceTypesClientListResponse` has been removed +- Field `RawResponse` of struct `ProviderResourceTypesClientListResponse` has been removed +- Field `DeploymentsClientCreateOrUpdateResult` of struct `DeploymentsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCreateOrUpdateResponse` has been removed +- Field `DeploymentsClientValidateAtScopeResult` of struct `DeploymentsClientValidateAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientValidateAtScopeResponse` has been removed +- Field `ProvidersClientListAtTenantScopeResult` of struct `ProvidersClientListAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientListAtTenantScopeResponse` has been removed +- Field `DeploymentsClientWhatIfAtManagementGroupScopeResult` of struct `DeploymentsClientWhatIfAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientWhatIfAtManagementGroupScopeResponse` has been removed +- Field `DeploymentsClientListAtSubscriptionScopeResult` of struct `DeploymentsClientListAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientListAtSubscriptionScopeResponse` has been removed +- Field `DeploymentsClientExportTemplateAtScopeResult` of struct `DeploymentsClientExportTemplateAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientExportTemplateAtScopeResponse` has been removed +- Field `DeploymentOperationsClientListAtTenantScopeResult` of struct `DeploymentOperationsClientListAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientListAtTenantScopeResponse` has been removed +- Field `DeploymentsClientCreateOrUpdateAtScopeResult` of struct `DeploymentsClientCreateOrUpdateAtScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCreateOrUpdateAtScopeResponse` has been removed +- Field `RawResponse` of struct `TagsClientDeleteValueResponse` has been removed +- Field `DeploymentsClientCheckExistenceAtSubscriptionScopeResult` of struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientDeleteResponse` has been removed +- Field `TagsClientUpdateAtScopeResult` of struct `TagsClientUpdateAtScopeResponse` has been removed +- Field `RawResponse` of struct `TagsClientUpdateAtScopeResponse` has been removed +- Field `DeploymentsClientExportTemplateResult` of struct `DeploymentsClientExportTemplateResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientExportTemplateResponse` has been removed +- Field `ProvidersClientUnregisterResult` of struct `ProvidersClientUnregisterResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientUnregisterResponse` has been removed +- Field `ClientListByResourceGroupResult` of struct `ClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ClientListByResourceGroupResponse` has been removed +- Field `DeploymentsClientValidateAtTenantScopeResult` of struct `DeploymentsClientValidateAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientValidateAtTenantScopeResponse` has been removed +- Field `OperationsClientListResult` of struct `OperationsClientListResponse` has been removed +- Field `RawResponse` of struct `OperationsClientListResponse` has been removed +- Field `ResourceGroupsClientCreateOrUpdateResult` of struct `ResourceGroupsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientCreateOrUpdateResponse` has been removed +- Field `ClientCreateOrUpdateByIDResult` of struct `ClientCreateOrUpdateByIDResponse` has been removed +- Field `RawResponse` of struct `ClientCreateOrUpdateByIDResponse` has been removed +- Field `RawResponse` of struct `TagsClientDeleteAtScopeResponse` has been removed +- Field `ClientCheckExistenceByIDResult` of struct `ClientCheckExistenceByIDResponse` has been removed +- Field `RawResponse` of struct `ClientCheckExistenceByIDResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientDeleteAtSubscriptionScopeResponse` has been removed +- Field `ProvidersClientListResult` of struct `ProvidersClientListResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientListResponse` has been removed +- Field `TagsClientListResult` of struct `TagsClientListResponse` has been removed +- Field `RawResponse` of struct `TagsClientListResponse` has been removed +- Field `ResourceGroupsClientUpdateResult` of struct `ResourceGroupsClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientUpdateResponse` has been removed +- Field `DeploymentOperationsClientGetAtManagementGroupScopeResult` of struct `DeploymentOperationsClientGetAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientGetAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `TagsClientDeleteResponse` has been removed +- Field `ResourceGroupsClientCheckExistenceResult` of struct `ResourceGroupsClientCheckExistenceResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientCheckExistenceResponse` has been removed +- Field `ProvidersClientGetResult` of struct `ProvidersClientGetResponse` has been removed +- Field `RawResponse` of struct `ProvidersClientGetResponse` has been removed +- Field `DeploymentsClientCalculateTemplateHashResult` of struct `DeploymentsClientCalculateTemplateHashResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCalculateTemplateHashResponse` has been removed +- Field `DeploymentsClientValidateResult` of struct `DeploymentsClientValidateResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientValidateResponse` has been removed +- Field `ResourceGroupsClientExportTemplateResult` of struct `ResourceGroupsClientExportTemplateResponse` has been removed +- Field `RawResponse` of struct `ResourceGroupsClientExportTemplateResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientCancelAtManagementGroupScopeResponse` has been removed +- Field `TagsClientCreateOrUpdateAtScopeResult` of struct `TagsClientCreateOrUpdateAtScopeResponse` has been removed +- Field `RawResponse` of struct `TagsClientCreateOrUpdateAtScopeResponse` has been removed +- Field `DeploymentsClientListAtTenantScopeResult` of struct `DeploymentsClientListAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientListAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `ClientValidateMoveResourcesResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientDeleteAtManagementGroupScopeResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `DeploymentsClientExportTemplateAtTenantScopeResult` of struct `DeploymentsClientExportTemplateAtTenantScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentsClientExportTemplateAtTenantScopeResponse` has been removed +- Field `DeploymentOperationsClientListAtManagementGroupScopeResult` of struct `DeploymentOperationsClientListAtManagementGroupScopeResponse` has been removed +- Field `RawResponse` of struct `DeploymentOperationsClientListAtManagementGroupScopeResponse` has been removed + +### Features Added + +- New anonymous field `GenericResource` in struct `ClientUpdateByIDResponse` +- New anonymous field `GenericResource` in struct `ClientGetResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions` +- New field `Success` in struct `DeploymentsClientCheckExistenceAtTenantScopeResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse` +- New anonymous field `TagValue` in struct `TagsClientCreateOrUpdateValueResponse` +- New anonymous field `Provider` in struct `ProvidersClientGetResponse` +- New anonymous field `DeploymentExportResult` in struct `DeploymentsClientExportTemplateAtManagementGroupScopeResponse` +- New anonymous field `DeploymentListResult` in struct `DeploymentsClientListAtManagementGroupScopeResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientCreateOrUpdateAtScopeResponse` +- New anonymous field `WhatIfOperationResult` in struct `DeploymentsClientWhatIfAtManagementGroupScopeResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientGetResponse` +- New anonymous field `DeploymentExportResult` in struct `DeploymentsClientExportTemplateResponse` +- New anonymous field `Provider` in struct `ProvidersClientGetAtTenantScopeResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientGetAtScopeResponse` +- New field `Success` in struct `DeploymentsClientCheckExistenceResponse` +- New anonymous field `WhatIfOperationResult` in struct `DeploymentsClientWhatIfAtTenantScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions` +- New anonymous field `GenericResource` in struct `ClientUpdateResponse` +- New anonymous field `DeploymentOperationsListResult` in struct `DeploymentOperationsClientListAtTenantScopeResponse` +- New anonymous field `TagsListResult` in struct `TagsClientListResponse` +- New anonymous field `WhatIfOperationResult` in struct `DeploymentsClientWhatIfAtSubscriptionScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions` +- New field `ResumeToken` in struct `ResourceGroupsClientBeginDeleteOptions` +- New anonymous field `DeploymentExportResult` in struct `DeploymentsClientExportTemplateAtSubscriptionScopeResponse` +- New anonymous field `ProviderResourceTypeListResult` in struct `ProviderResourceTypesClientListResponse` +- New anonymous field `TagsResource` in struct `TagsClientUpdateAtScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginValidateAtScopeOptions` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New anonymous field `DeploymentOperation` in struct `DeploymentOperationsClientGetAtScopeResponse` +- New field `ResumeToken` in struct `ClientBeginDeleteOptions` +- New anonymous field `Provider` in struct `ProvidersClientRegisterResponse` +- New field `Success` in struct `ClientCheckExistenceResponse` +- New anonymous field `ResourceGroupExportResult` in struct `ResourceGroupsClientExportTemplateResponse` +- New field `ResumeToken` in struct `ClientBeginCreateOrUpdateOptions` +- New field `ResumeToken` in struct `ResourceGroupsClientBeginExportTemplateOptions` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientGetAtTenantScopeResponse` +- New anonymous field `GenericResource` in struct `ClientGetByIDResponse` +- New anonymous field `ResourceListResult` in struct `ClientListResponse` +- New anonymous field `DeploymentOperation` in struct `DeploymentOperationsClientGetAtManagementGroupScopeResponse` +- New field `ResumeToken` in struct `ClientBeginUpdateOptions` +- New field `ResumeToken` in struct `ClientBeginValidateMoveResourcesOptions` +- New field `Success` in struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginWhatIfOptions` +- New field `Success` in struct `ResourceGroupsClientCheckExistenceResponse` +- New anonymous field `ResourceListResult` in struct `ClientListByResourceGroupResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions` +- New anonymous field `ResourceGroup` in struct `ResourceGroupsClientUpdateResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientCreateOrUpdateResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginCreateOrUpdateOptions` +- New field `Success` in struct `ClientCheckExistenceByIDResponse` +- New anonymous field `DeploymentExportResult` in struct `DeploymentsClientExportTemplateAtTenantScopeResponse` +- New anonymous field `DeploymentOperation` in struct `DeploymentOperationsClientGetAtTenantScopeResponse` +- New anonymous field `DeploymentValidateResult` in struct `DeploymentsClientValidateAtScopeResponse` +- New field `ResumeToken` in struct `ClientBeginCreateOrUpdateByIDOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginValidateAtSubscriptionScopeOptions` +- New field `ResumeToken` in struct `ClientBeginMoveResourcesOptions` +- New anonymous field `DeploymentValidateResult` in struct `DeploymentsClientValidateAtTenantScopeResponse` +- New anonymous field `DeploymentOperationsListResult` in struct `DeploymentOperationsClientListAtScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginValidateOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginValidateAtTenantScopeOptions` +- New field `ResumeToken` in struct `ClientBeginDeleteByIDOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginDeleteOptions` +- New field `ResumeToken` in struct `ClientBeginUpdateByIDOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginDeleteAtSubscriptionScopeOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions` +- New field `Success` in struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResponse` +- New anonymous field `Provider` in struct `ProvidersClientUnregisterResponse` +- New anonymous field `DeploymentListResult` in struct `DeploymentsClientListAtSubscriptionScopeResponse` +- New anonymous field `DeploymentValidateResult` in struct `DeploymentsClientValidateAtManagementGroupScopeResponse` +- New field `Success` in struct `DeploymentsClientCheckExistenceAtScopeResponse` +- New anonymous field `ResourceGroup` in struct `ResourceGroupsClientGetResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientCreateOrUpdateAtTenantScopeResponse` +- New anonymous field `DeploymentOperationsListResult` in struct `DeploymentOperationsClientListAtSubscriptionScopeResponse` +- New anonymous field `DeploymentExportResult` in struct `DeploymentsClientExportTemplateAtScopeResponse` +- New anonymous field `DeploymentOperation` in struct `DeploymentOperationsClientGetResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginDeleteAtManagementGroupScopeOptions` +- New anonymous field `TagsResource` in struct `TagsClientGetAtScopeResponse` +- New anonymous field `DeploymentValidateResult` in struct `DeploymentsClientValidateAtSubscriptionScopeResponse` +- New anonymous field `GenericResource` in struct `ClientCreateOrUpdateByIDResponse` +- New anonymous field `TemplateHashResult` in struct `DeploymentsClientCalculateTemplateHashResponse` +- New anonymous field `DeploymentOperationsListResult` in struct `DeploymentOperationsClientListResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientGetAtManagementGroupScopeResponse` +- New anonymous field `DeploymentOperationsListResult` in struct `DeploymentOperationsClientListAtManagementGroupScopeResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginDeleteAtTenantScopeOptions` +- New anonymous field `TagsResource` in struct `TagsClientCreateOrUpdateAtScopeResponse` +- New anonymous field `GenericResource` in struct `ClientCreateOrUpdateResponse` +- New anonymous field `ResourceGroup` in struct `ResourceGroupsClientCreateOrUpdateResponse` +- New anonymous field `DeploymentListResult` in struct `DeploymentsClientListAtTenantScopeResponse` +- New anonymous field `DeploymentExtended` in struct `DeploymentsClientGetAtSubscriptionScopeResponse` +- New anonymous field `ProviderPermissionListResult` in struct `ProvidersClientProviderPermissionsResponse` +- New anonymous field `ProviderListResult` in struct `ProvidersClientListAtTenantScopeResponse` +- New anonymous field `DeploymentValidateResult` in struct `DeploymentsClientValidateResponse` +- New anonymous field `DeploymentOperation` in struct `DeploymentOperationsClientGetAtSubscriptionScopeResponse` +- New anonymous field `ProviderListResult` in struct `ProvidersClientListResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginDeleteAtScopeOptions` +- New anonymous field `DeploymentListResult` in struct `DeploymentsClientListByResourceGroupResponse` +- New field `ResumeToken` in struct `DeploymentsClientBeginWhatIfAtTenantScopeOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginCreateOrUpdateAtScopeOptions` +- New field `ResumeToken` in struct `DeploymentsClientBeginValidateAtManagementGroupScopeOptions` +- New anonymous field `WhatIfOperationResult` in struct `DeploymentsClientWhatIfResponse` +- New anonymous field `TagDetails` in struct `TagsClientCreateOrUpdateResponse` +- New anonymous field `ResourceGroupListResult` in struct `ResourceGroupsClientListResponse` +- New anonymous field `DeploymentListResult` in struct `DeploymentsClientListAtScopeResponse` + + +## 0.3.1 (2022-02-22) + +### Other Changes + +- Remove the go_mod_tidy_hack.go file. + +## 0.3.0 (2022-01-13) +### Breaking Changes + +- Function `*DeploymentsClient.BeginDeleteAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsBeginDeleteAtSubscriptionScopeOptions)` to `(context.Context, string, *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.BeginDeleteAtSubscriptionScope` return value(s) have been changed from `(DeploymentsDeleteAtSubscriptionScopePollerResponse, error)` to `(DeploymentsClientDeleteAtSubscriptionScopePollerResponse, error)` +- Function `*DeploymentsClient.CalculateTemplateHash` parameter(s) have been changed from `(context.Context, map[string]interface{}, *DeploymentsCalculateTemplateHashOptions)` to `(context.Context, map[string]interface{}, *DeploymentsClientCalculateTemplateHashOptions)` +- Function `*DeploymentsClient.CalculateTemplateHash` return value(s) have been changed from `(DeploymentsCalculateTemplateHashResponse, error)` to `(DeploymentsClientCalculateTemplateHashResponse, error)` +- Function `*DeploymentsClient.ExportTemplateAtScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsExportTemplateAtScopeOptions)` to `(context.Context, string, string, *DeploymentsClientExportTemplateAtScopeOptions)` +- Function `*DeploymentsClient.ExportTemplateAtScope` return value(s) have been changed from `(DeploymentsExportTemplateAtScopeResponse, error)` to `(DeploymentsClientExportTemplateAtScopeResponse, error)` +- Function `*DeploymentsClient.ExportTemplateAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsExportTemplateAtManagementGroupScopeOptions)` to `(context.Context, string, string, *DeploymentsClientExportTemplateAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.ExportTemplateAtManagementGroupScope` return value(s) have been changed from `(DeploymentsExportTemplateAtManagementGroupScopeResponse, error)` to `(DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error)` +- Function `*TagsClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, *TagsCreateOrUpdateOptions)` to `(context.Context, string, *TagsClientCreateOrUpdateOptions)` +- Function `*TagsClient.CreateOrUpdate` return value(s) have been changed from `(TagsCreateOrUpdateResponse, error)` to `(TagsClientCreateOrUpdateResponse, error)` +- Function `*DeploymentsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, Deployment, *DeploymentsBeginCreateOrUpdateOptions)` to `(context.Context, string, string, Deployment, *DeploymentsClientBeginCreateOrUpdateOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdate` return value(s) have been changed from `(DeploymentsCreateOrUpdatePollerResponse, error)` to `(DeploymentsClientCreateOrUpdatePollerResponse, error)` +- Function `*DeploymentsClient.BeginDeleteAtScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsBeginDeleteAtScopeOptions)` to `(context.Context, string, string, *DeploymentsClientBeginDeleteAtScopeOptions)` +- Function `*DeploymentsClient.BeginDeleteAtScope` return value(s) have been changed from `(DeploymentsDeleteAtScopePollerResponse, error)` to `(DeploymentsClientDeleteAtScopePollerResponse, error)` +- Function `*DeploymentsClient.ListByResourceGroup` parameter(s) have been changed from `(string, *DeploymentsListByResourceGroupOptions)` to `(string, *DeploymentsClientListByResourceGroupOptions)` +- Function `*DeploymentsClient.ListByResourceGroup` return value(s) have been changed from `(*DeploymentsListByResourceGroupPager)` to `(*DeploymentsClientListByResourceGroupPager)` +- Function `*DeploymentsClient.ExportTemplateAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsExportTemplateAtSubscriptionScopeOptions)` to `(context.Context, string, *DeploymentsClientExportTemplateAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.ExportTemplateAtSubscriptionScope` return value(s) have been changed from `(DeploymentsExportTemplateAtSubscriptionScopeResponse, error)` to `(DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error)` +- Function `*DeploymentsClient.BeginWhatIfAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, DeploymentWhatIf, *DeploymentsBeginWhatIfAtSubscriptionScopeOptions)` to `(context.Context, string, DeploymentWhatIf, *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.BeginWhatIfAtSubscriptionScope` return value(s) have been changed from `(DeploymentsWhatIfAtSubscriptionScopePollerResponse, error)` to `(DeploymentsClientWhatIfAtSubscriptionScopePollerResponse, error)` +- Function `*DeploymentsClient.ExportTemplate` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsExportTemplateOptions)` to `(context.Context, string, string, *DeploymentsClientExportTemplateOptions)` +- Function `*DeploymentsClient.ExportTemplate` return value(s) have been changed from `(DeploymentsExportTemplateResponse, error)` to `(DeploymentsClientExportTemplateResponse, error)` +- Function `*DeploymentsClient.GetAtTenantScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsGetAtTenantScopeOptions)` to `(context.Context, string, *DeploymentsClientGetAtTenantScopeOptions)` +- Function `*DeploymentsClient.GetAtTenantScope` return value(s) have been changed from `(DeploymentsGetAtTenantScopeResponse, error)` to `(DeploymentsClientGetAtTenantScopeResponse, error)` +- Function `*TagsClient.CreateOrUpdateAtScope` parameter(s) have been changed from `(context.Context, string, TagsResource, *TagsCreateOrUpdateAtScopeOptions)` to `(context.Context, string, TagsResource, *TagsClientCreateOrUpdateAtScopeOptions)` +- Function `*TagsClient.CreateOrUpdateAtScope` return value(s) have been changed from `(TagsCreateOrUpdateAtScopeResponse, error)` to `(TagsClientCreateOrUpdateAtScopeResponse, error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtScope` parameter(s) have been changed from `(context.Context, string, string, Deployment, *DeploymentsBeginCreateOrUpdateAtScopeOptions)` to `(context.Context, string, string, Deployment, *DeploymentsClientBeginCreateOrUpdateAtScopeOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtScope` return value(s) have been changed from `(DeploymentsCreateOrUpdateAtScopePollerResponse, error)` to `(DeploymentsClientCreateOrUpdateAtScopePollerResponse, error)` +- Function `*DeploymentsClient.CancelAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCancelAtManagementGroupScopeOptions)` to `(context.Context, string, string, *DeploymentsClientCancelAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.CancelAtManagementGroupScope` return value(s) have been changed from `(DeploymentsCancelAtManagementGroupScopeResponse, error)` to `(DeploymentsClientCancelAtManagementGroupScopeResponse, error)` +- Function `*TagsClient.DeleteAtScope` parameter(s) have been changed from `(context.Context, string, *TagsDeleteAtScopeOptions)` to `(context.Context, string, *TagsClientDeleteAtScopeOptions)` +- Function `*TagsClient.DeleteAtScope` return value(s) have been changed from `(TagsDeleteAtScopeResponse, error)` to `(TagsClientDeleteAtScopeResponse, error)` +- Function `*DeploymentsClient.GetAtScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsGetAtScopeOptions)` to `(context.Context, string, string, *DeploymentsClientGetAtScopeOptions)` +- Function `*DeploymentsClient.GetAtScope` return value(s) have been changed from `(DeploymentsGetAtScopeResponse, error)` to `(DeploymentsClientGetAtScopeResponse, error)` +- Function `*ResourceGroupsClient.List` parameter(s) have been changed from `(*ResourceGroupsListOptions)` to `(*ResourceGroupsClientListOptions)` +- Function `*ResourceGroupsClient.List` return value(s) have been changed from `(*ResourceGroupsListPager)` to `(*ResourceGroupsClientListPager)` +- Function `*DeploymentOperationsClient.ListAtManagementGroupScope` parameter(s) have been changed from `(string, string, *DeploymentOperationsListAtManagementGroupScopeOptions)` to `(string, string, *DeploymentOperationsClientListAtManagementGroupScopeOptions)` +- Function `*DeploymentOperationsClient.ListAtManagementGroupScope` return value(s) have been changed from `(*DeploymentOperationsListAtManagementGroupScopePager)` to `(*DeploymentOperationsClientListAtManagementGroupScopePager)` +- Function `*DeploymentsClient.BeginDeleteAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsBeginDeleteAtManagementGroupScopeOptions)` to `(context.Context, string, string, *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.BeginDeleteAtManagementGroupScope` return value(s) have been changed from `(DeploymentsDeleteAtManagementGroupScopePollerResponse, error)` to `(DeploymentsClientDeleteAtManagementGroupScopePollerResponse, error)` +- Function `*DeploymentsClient.BeginValidateAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, ScopedDeployment, *DeploymentsBeginValidateAtManagementGroupScopeOptions)` to `(context.Context, string, string, ScopedDeployment, *DeploymentsClientBeginValidateAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.BeginValidateAtManagementGroupScope` return value(s) have been changed from `(DeploymentsValidateAtManagementGroupScopePollerResponse, error)` to `(DeploymentsClientValidateAtManagementGroupScopePollerResponse, error)` +- Function `*TagsClient.List` parameter(s) have been changed from `(*TagsListOptions)` to `(*TagsClientListOptions)` +- Function `*TagsClient.List` return value(s) have been changed from `(*TagsListPager)` to `(*TagsClientListPager)` +- Function `*DeploymentsClient.BeginValidateAtScope` parameter(s) have been changed from `(context.Context, string, string, Deployment, *DeploymentsBeginValidateAtScopeOptions)` to `(context.Context, string, string, Deployment, *DeploymentsClientBeginValidateAtScopeOptions)` +- Function `*DeploymentsClient.BeginValidateAtScope` return value(s) have been changed from `(DeploymentsValidateAtScopePollerResponse, error)` to `(DeploymentsClientValidateAtScopePollerResponse, error)` +- Function `*DeploymentsClient.ListAtManagementGroupScope` parameter(s) have been changed from `(string, *DeploymentsListAtManagementGroupScopeOptions)` to `(string, *DeploymentsClientListAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.ListAtManagementGroupScope` return value(s) have been changed from `(*DeploymentsListAtManagementGroupScopePager)` to `(*DeploymentsClientListAtManagementGroupScopePager)` +- Function `*DeploymentsClient.CheckExistenceAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCheckExistenceAtManagementGroupScopeOptions)` to `(context.Context, string, string, *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.CheckExistenceAtManagementGroupScope` return value(s) have been changed from `(DeploymentsCheckExistenceAtManagementGroupScopeResponse, error)` to `(DeploymentsClientCheckExistenceAtManagementGroupScopeResponse, error)` +- Function `*DeploymentsClient.BeginWhatIf` parameter(s) have been changed from `(context.Context, string, string, DeploymentWhatIf, *DeploymentsBeginWhatIfOptions)` to `(context.Context, string, string, DeploymentWhatIf, *DeploymentsClientBeginWhatIfOptions)` +- Function `*DeploymentsClient.BeginWhatIf` return value(s) have been changed from `(DeploymentsWhatIfPollerResponse, error)` to `(DeploymentsClientWhatIfPollerResponse, error)` +- Function `*ProviderResourceTypesClient.List` parameter(s) have been changed from `(context.Context, string, *ProviderResourceTypesListOptions)` to `(context.Context, string, *ProviderResourceTypesClientListOptions)` +- Function `*ProviderResourceTypesClient.List` return value(s) have been changed from `(ProviderResourceTypesListResponse, error)` to `(ProviderResourceTypesClientListResponse, error)` +- Function `*DeploymentsClient.GetAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsGetAtSubscriptionScopeOptions)` to `(context.Context, string, *DeploymentsClientGetAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.GetAtSubscriptionScope` return value(s) have been changed from `(DeploymentsGetAtSubscriptionScopeResponse, error)` to `(DeploymentsClientGetAtSubscriptionScopeResponse, error)` +- Function `*DeploymentsClient.CancelAtScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCancelAtScopeOptions)` to `(context.Context, string, string, *DeploymentsClientCancelAtScopeOptions)` +- Function `*DeploymentsClient.CancelAtScope` return value(s) have been changed from `(DeploymentsCancelAtScopeResponse, error)` to `(DeploymentsClientCancelAtScopeResponse, error)` +- Function `*DeploymentOperationsClient.ListAtSubscriptionScope` parameter(s) have been changed from `(string, *DeploymentOperationsListAtSubscriptionScopeOptions)` to `(string, *DeploymentOperationsClientListAtSubscriptionScopeOptions)` +- Function `*DeploymentOperationsClient.ListAtSubscriptionScope` return value(s) have been changed from `(*DeploymentOperationsListAtSubscriptionScopePager)` to `(*DeploymentOperationsClientListAtSubscriptionScopePager)` +- Function `*DeploymentsClient.BeginWhatIfAtTenantScope` parameter(s) have been changed from `(context.Context, string, ScopedDeploymentWhatIf, *DeploymentsBeginWhatIfAtTenantScopeOptions)` to `(context.Context, string, ScopedDeploymentWhatIf, *DeploymentsClientBeginWhatIfAtTenantScopeOptions)` +- Function `*DeploymentsClient.BeginWhatIfAtTenantScope` return value(s) have been changed from `(DeploymentsWhatIfAtTenantScopePollerResponse, error)` to `(DeploymentsClientWhatIfAtTenantScopePollerResponse, error)` +- Function `*DeploymentOperationsClient.GetAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, string, *DeploymentOperationsGetAtManagementGroupScopeOptions)` to `(context.Context, string, string, string, *DeploymentOperationsClientGetAtManagementGroupScopeOptions)` +- Function `*DeploymentOperationsClient.GetAtManagementGroupScope` return value(s) have been changed from `(DeploymentOperationsGetAtManagementGroupScopeResponse, error)` to `(DeploymentOperationsClientGetAtManagementGroupScopeResponse, error)` +- Function `*DeploymentsClient.BeginValidateAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, Deployment, *DeploymentsBeginValidateAtSubscriptionScopeOptions)` to `(context.Context, string, Deployment, *DeploymentsClientBeginValidateAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.BeginValidateAtSubscriptionScope` return value(s) have been changed from `(DeploymentsValidateAtSubscriptionScopePollerResponse, error)` to `(DeploymentsClientValidateAtSubscriptionScopePollerResponse, error)` +- Function `*DeploymentsClient.BeginValidate` parameter(s) have been changed from `(context.Context, string, string, Deployment, *DeploymentsBeginValidateOptions)` to `(context.Context, string, string, Deployment, *DeploymentsClientBeginValidateOptions)` +- Function `*DeploymentsClient.BeginValidate` return value(s) have been changed from `(DeploymentsValidatePollerResponse, error)` to `(DeploymentsClientValidatePollerResponse, error)` +- Function `*TagsClient.DeleteValue` parameter(s) have been changed from `(context.Context, string, string, *TagsDeleteValueOptions)` to `(context.Context, string, string, *TagsClientDeleteValueOptions)` +- Function `*TagsClient.DeleteValue` return value(s) have been changed from `(TagsDeleteValueResponse, error)` to `(TagsClientDeleteValueResponse, error)` +- Function `*DeploymentsClient.CheckExistenceAtScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCheckExistenceAtScopeOptions)` to `(context.Context, string, string, *DeploymentsClientCheckExistenceAtScopeOptions)` +- Function `*DeploymentsClient.CheckExistenceAtScope` return value(s) have been changed from `(DeploymentsCheckExistenceAtScopeResponse, error)` to `(DeploymentsClientCheckExistenceAtScopeResponse, error)` +- Function `*DeploymentsClient.BeginValidateAtTenantScope` parameter(s) have been changed from `(context.Context, string, ScopedDeployment, *DeploymentsBeginValidateAtTenantScopeOptions)` to `(context.Context, string, ScopedDeployment, *DeploymentsClientBeginValidateAtTenantScopeOptions)` +- Function `*DeploymentsClient.BeginValidateAtTenantScope` return value(s) have been changed from `(DeploymentsValidateAtTenantScopePollerResponse, error)` to `(DeploymentsClientValidateAtTenantScopePollerResponse, error)` +- Function `*OperationsClient.List` parameter(s) have been changed from `(*OperationsListOptions)` to `(*OperationsClientListOptions)` +- Function `*OperationsClient.List` return value(s) have been changed from `(*OperationsListPager)` to `(*OperationsClientListPager)` +- Function `*DeploymentsClient.ListAtScope` parameter(s) have been changed from `(string, *DeploymentsListAtScopeOptions)` to `(string, *DeploymentsClientListAtScopeOptions)` +- Function `*DeploymentsClient.ListAtScope` return value(s) have been changed from `(*DeploymentsListAtScopePager)` to `(*DeploymentsClientListAtScopePager)` +- Function `*ProvidersClient.Unregister` parameter(s) have been changed from `(context.Context, string, *ProvidersUnregisterOptions)` to `(context.Context, string, *ProvidersClientUnregisterOptions)` +- Function `*ProvidersClient.Unregister` return value(s) have been changed from `(ProvidersUnregisterResponse, error)` to `(ProvidersClientUnregisterResponse, error)` +- Function `*DeploymentsClient.ListAtSubscriptionScope` parameter(s) have been changed from `(*DeploymentsListAtSubscriptionScopeOptions)` to `(*DeploymentsClientListAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.ListAtSubscriptionScope` return value(s) have been changed from `(*DeploymentsListAtSubscriptionScopePager)` to `(*DeploymentsClientListAtSubscriptionScopePager)` +- Function `*DeploymentOperationsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *DeploymentOperationsGetOptions)` to `(context.Context, string, string, string, *DeploymentOperationsClientGetOptions)` +- Function `*DeploymentOperationsClient.Get` return value(s) have been changed from `(DeploymentOperationsGetResponse, error)` to `(DeploymentOperationsClientGetResponse, error)` +- Function `*DeploymentsClient.CheckExistence` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCheckExistenceOptions)` to `(context.Context, string, string, *DeploymentsClientCheckExistenceOptions)` +- Function `*DeploymentsClient.CheckExistence` return value(s) have been changed from `(DeploymentsCheckExistenceResponse, error)` to `(DeploymentsClientCheckExistenceResponse, error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, ScopedDeployment, *DeploymentsBeginCreateOrUpdateAtManagementGroupScopeOptions)` to `(context.Context, string, string, ScopedDeployment, *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope` return value(s) have been changed from `(DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse, error)` to `(DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse, error)` +- Function `*ResourceGroupsClient.Update` parameter(s) have been changed from `(context.Context, string, ResourceGroupPatchable, *ResourceGroupsUpdateOptions)` to `(context.Context, string, ResourceGroupPatchable, *ResourceGroupsClientUpdateOptions)` +- Function `*ResourceGroupsClient.Update` return value(s) have been changed from `(ResourceGroupsUpdateResponse, error)` to `(ResourceGroupsClientUpdateResponse, error)` +- Function `*DeploymentOperationsClient.GetAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentOperationsGetAtSubscriptionScopeOptions)` to `(context.Context, string, string, *DeploymentOperationsClientGetAtSubscriptionScopeOptions)` +- Function `*DeploymentOperationsClient.GetAtSubscriptionScope` return value(s) have been changed from `(DeploymentOperationsGetAtSubscriptionScopeResponse, error)` to `(DeploymentOperationsClientGetAtSubscriptionScopeResponse, error)` +- Function `*TagsClient.GetAtScope` parameter(s) have been changed from `(context.Context, string, *TagsGetAtScopeOptions)` to `(context.Context, string, *TagsClientGetAtScopeOptions)` +- Function `*TagsClient.GetAtScope` return value(s) have been changed from `(TagsGetAtScopeResponse, error)` to `(TagsClientGetAtScopeResponse, error)` +- Function `*ResourceGroupsClient.BeginExportTemplate` parameter(s) have been changed from `(context.Context, string, ExportTemplateRequest, *ResourceGroupsBeginExportTemplateOptions)` to `(context.Context, string, ExportTemplateRequest, *ResourceGroupsClientBeginExportTemplateOptions)` +- Function `*ResourceGroupsClient.BeginExportTemplate` return value(s) have been changed from `(ResourceGroupsExportTemplatePollerResponse, error)` to `(ResourceGroupsClientExportTemplatePollerResponse, error)` +- Function `*DeploymentOperationsClient.GetAtTenantScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentOperationsGetAtTenantScopeOptions)` to `(context.Context, string, string, *DeploymentOperationsClientGetAtTenantScopeOptions)` +- Function `*DeploymentOperationsClient.GetAtTenantScope` return value(s) have been changed from `(DeploymentOperationsGetAtTenantScopeResponse, error)` to `(DeploymentOperationsClientGetAtTenantScopeResponse, error)` +- Function `*ProvidersClient.Register` parameter(s) have been changed from `(context.Context, string, *ProvidersRegisterOptions)` to `(context.Context, string, *ProvidersClientRegisterOptions)` +- Function `*ProvidersClient.Register` return value(s) have been changed from `(ProvidersRegisterResponse, error)` to `(ProvidersClientRegisterResponse, error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, Deployment, *DeploymentsBeginCreateOrUpdateAtSubscriptionScopeOptions)` to `(context.Context, string, Deployment, *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope` return value(s) have been changed from `(DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse, error)` to `(DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse, error)` +- Function `*DeploymentsClient.GetAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsGetAtManagementGroupScopeOptions)` to `(context.Context, string, string, *DeploymentsClientGetAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.GetAtManagementGroupScope` return value(s) have been changed from `(DeploymentsGetAtManagementGroupScopeResponse, error)` to `(DeploymentsClientGetAtManagementGroupScopeResponse, error)` +- Function `*DeploymentsClient.CheckExistenceAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsCheckExistenceAtSubscriptionScopeOptions)` to `(context.Context, string, *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.CheckExistenceAtSubscriptionScope` return value(s) have been changed from `(DeploymentsCheckExistenceAtSubscriptionScopeResponse, error)` to `(DeploymentsClientCheckExistenceAtSubscriptionScopeResponse, error)` +- Function `*ProvidersClient.GetAtTenantScope` parameter(s) have been changed from `(context.Context, string, *ProvidersGetAtTenantScopeOptions)` to `(context.Context, string, *ProvidersClientGetAtTenantScopeOptions)` +- Function `*ProvidersClient.GetAtTenantScope` return value(s) have been changed from `(ProvidersGetAtTenantScopeResponse, error)` to `(ProvidersClientGetAtTenantScopeResponse, error)` +- Function `*TagsClient.UpdateAtScope` parameter(s) have been changed from `(context.Context, string, TagsPatchResource, *TagsUpdateAtScopeOptions)` to `(context.Context, string, TagsPatchResource, *TagsClientUpdateAtScopeOptions)` +- Function `*TagsClient.UpdateAtScope` return value(s) have been changed from `(TagsUpdateAtScopeResponse, error)` to `(TagsClientUpdateAtScopeResponse, error)` +- Function `*DeploymentsClient.CancelAtSubscriptionScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsCancelAtSubscriptionScopeOptions)` to `(context.Context, string, *DeploymentsClientCancelAtSubscriptionScopeOptions)` +- Function `*DeploymentsClient.CancelAtSubscriptionScope` return value(s) have been changed from `(DeploymentsCancelAtSubscriptionScopeResponse, error)` to `(DeploymentsClientCancelAtSubscriptionScopeResponse, error)` +- Function `*ProvidersClient.Get` parameter(s) have been changed from `(context.Context, string, *ProvidersGetOptions)` to `(context.Context, string, *ProvidersClientGetOptions)` +- Function `*ProvidersClient.Get` return value(s) have been changed from `(ProvidersGetResponse, error)` to `(ProvidersClientGetResponse, error)` +- Function `*ProvidersClient.RegisterAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, *ProvidersRegisterAtManagementGroupScopeOptions)` to `(context.Context, string, string, *ProvidersClientRegisterAtManagementGroupScopeOptions)` +- Function `*ProvidersClient.RegisterAtManagementGroupScope` return value(s) have been changed from `(ProvidersRegisterAtManagementGroupScopeResponse, error)` to `(ProvidersClientRegisterAtManagementGroupScopeResponse, error)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtTenantScope` parameter(s) have been changed from `(context.Context, string, ScopedDeployment, *DeploymentsBeginCreateOrUpdateAtTenantScopeOptions)` to `(context.Context, string, ScopedDeployment, *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions)` +- Function `*DeploymentsClient.BeginCreateOrUpdateAtTenantScope` return value(s) have been changed from `(DeploymentsCreateOrUpdateAtTenantScopePollerResponse, error)` to `(DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse, error)` +- Function `*ProvidersClient.List` parameter(s) have been changed from `(*ProvidersListOptions)` to `(*ProvidersClientListOptions)` +- Function `*ProvidersClient.List` return value(s) have been changed from `(*ProvidersListPager)` to `(*ProvidersClientListPager)` +- Function `*ProvidersClient.ListAtTenantScope` parameter(s) have been changed from `(*ProvidersListAtTenantScopeOptions)` to `(*ProvidersClientListAtTenantScopeOptions)` +- Function `*ProvidersClient.ListAtTenantScope` return value(s) have been changed from `(*ProvidersListAtTenantScopePager)` to `(*ProvidersClientListAtTenantScopePager)` +- Function `*DeploymentsClient.ListAtTenantScope` parameter(s) have been changed from `(*DeploymentsListAtTenantScopeOptions)` to `(*DeploymentsClientListAtTenantScopeOptions)` +- Function `*DeploymentsClient.ListAtTenantScope` return value(s) have been changed from `(*DeploymentsListAtTenantScopePager)` to `(*DeploymentsClientListAtTenantScopePager)` +- Function `*TagsClient.CreateOrUpdateValue` parameter(s) have been changed from `(context.Context, string, string, *TagsCreateOrUpdateValueOptions)` to `(context.Context, string, string, *TagsClientCreateOrUpdateValueOptions)` +- Function `*TagsClient.CreateOrUpdateValue` return value(s) have been changed from `(TagsCreateOrUpdateValueResponse, error)` to `(TagsClientCreateOrUpdateValueResponse, error)` +- Function `*DeploymentsClient.Cancel` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsCancelOptions)` to `(context.Context, string, string, *DeploymentsClientCancelOptions)` +- Function `*DeploymentsClient.Cancel` return value(s) have been changed from `(DeploymentsCancelResponse, error)` to `(DeploymentsClientCancelResponse, error)` +- Function `*DeploymentsClient.ExportTemplateAtTenantScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsExportTemplateAtTenantScopeOptions)` to `(context.Context, string, *DeploymentsClientExportTemplateAtTenantScopeOptions)` +- Function `*DeploymentsClient.ExportTemplateAtTenantScope` return value(s) have been changed from `(DeploymentsExportTemplateAtTenantScopeResponse, error)` to `(DeploymentsClientExportTemplateAtTenantScopeResponse, error)` +- Function `*TagsClient.Delete` parameter(s) have been changed from `(context.Context, string, *TagsDeleteOptions)` to `(context.Context, string, *TagsClientDeleteOptions)` +- Function `*TagsClient.Delete` return value(s) have been changed from `(TagsDeleteResponse, error)` to `(TagsClientDeleteResponse, error)` +- Function `*DeploymentsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsBeginDeleteOptions)` to `(context.Context, string, string, *DeploymentsClientBeginDeleteOptions)` +- Function `*DeploymentsClient.BeginDelete` return value(s) have been changed from `(DeploymentsDeletePollerResponse, error)` to `(DeploymentsClientDeletePollerResponse, error)` +- Function `*DeploymentOperationsClient.GetAtScope` parameter(s) have been changed from `(context.Context, string, string, string, *DeploymentOperationsGetAtScopeOptions)` to `(context.Context, string, string, string, *DeploymentOperationsClientGetAtScopeOptions)` +- Function `*DeploymentOperationsClient.GetAtScope` return value(s) have been changed from `(DeploymentOperationsGetAtScopeResponse, error)` to `(DeploymentOperationsClientGetAtScopeResponse, error)` +- Function `*DeploymentOperationsClient.ListAtScope` parameter(s) have been changed from `(string, string, *DeploymentOperationsListAtScopeOptions)` to `(string, string, *DeploymentOperationsClientListAtScopeOptions)` +- Function `*DeploymentOperationsClient.ListAtScope` return value(s) have been changed from `(*DeploymentOperationsListAtScopePager)` to `(*DeploymentOperationsClientListAtScopePager)` +- Function `*DeploymentsClient.CheckExistenceAtTenantScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsCheckExistenceAtTenantScopeOptions)` to `(context.Context, string, *DeploymentsClientCheckExistenceAtTenantScopeOptions)` +- Function `*DeploymentsClient.CheckExistenceAtTenantScope` return value(s) have been changed from `(DeploymentsCheckExistenceAtTenantScopeResponse, error)` to `(DeploymentsClientCheckExistenceAtTenantScopeResponse, error)` +- Function `*DeploymentsClient.BeginWhatIfAtManagementGroupScope` parameter(s) have been changed from `(context.Context, string, string, ScopedDeploymentWhatIf, *DeploymentsBeginWhatIfAtManagementGroupScopeOptions)` to `(context.Context, string, string, ScopedDeploymentWhatIf, *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions)` +- Function `*DeploymentsClient.BeginWhatIfAtManagementGroupScope` return value(s) have been changed from `(DeploymentsWhatIfAtManagementGroupScopePollerResponse, error)` to `(DeploymentsClientWhatIfAtManagementGroupScopePollerResponse, error)` +- Function `*DeploymentOperationsClient.List` parameter(s) have been changed from `(string, string, *DeploymentOperationsListOptions)` to `(string, string, *DeploymentOperationsClientListOptions)` +- Function `*DeploymentOperationsClient.List` return value(s) have been changed from `(*DeploymentOperationsListPager)` to `(*DeploymentOperationsClientListPager)` +- Function `*ProvidersClient.ProviderPermissions` parameter(s) have been changed from `(context.Context, string, *ProvidersProviderPermissionsOptions)` to `(context.Context, string, *ProvidersClientProviderPermissionsOptions)` +- Function `*ProvidersClient.ProviderPermissions` return value(s) have been changed from `(ProvidersProviderPermissionsResponse, error)` to `(ProvidersClientProviderPermissionsResponse, error)` +- Function `*DeploymentsClient.CancelAtTenantScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsCancelAtTenantScopeOptions)` to `(context.Context, string, *DeploymentsClientCancelAtTenantScopeOptions)` +- Function `*DeploymentsClient.CancelAtTenantScope` return value(s) have been changed from `(DeploymentsCancelAtTenantScopeResponse, error)` to `(DeploymentsClientCancelAtTenantScopeResponse, error)` +- Function `*DeploymentsClient.Get` parameter(s) have been changed from `(context.Context, string, string, *DeploymentsGetOptions)` to `(context.Context, string, string, *DeploymentsClientGetOptions)` +- Function `*DeploymentsClient.Get` return value(s) have been changed from `(DeploymentsGetResponse, error)` to `(DeploymentsClientGetResponse, error)` +- Function `*DeploymentOperationsClient.ListAtTenantScope` parameter(s) have been changed from `(string, *DeploymentOperationsListAtTenantScopeOptions)` to `(string, *DeploymentOperationsClientListAtTenantScopeOptions)` +- Function `*DeploymentOperationsClient.ListAtTenantScope` return value(s) have been changed from `(*DeploymentOperationsListAtTenantScopePager)` to `(*DeploymentOperationsClientListAtTenantScopePager)` +- Function `*ResourceGroupsClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, ResourceGroup, *ResourceGroupsCreateOrUpdateOptions)` to `(context.Context, string, ResourceGroup, *ResourceGroupsClientCreateOrUpdateOptions)` +- Function `*ResourceGroupsClient.CreateOrUpdate` return value(s) have been changed from `(ResourceGroupsCreateOrUpdateResponse, error)` to `(ResourceGroupsClientCreateOrUpdateResponse, error)` +- Function `*ResourceGroupsClient.CheckExistence` parameter(s) have been changed from `(context.Context, string, *ResourceGroupsCheckExistenceOptions)` to `(context.Context, string, *ResourceGroupsClientCheckExistenceOptions)` +- Function `*ResourceGroupsClient.CheckExistence` return value(s) have been changed from `(ResourceGroupsCheckExistenceResponse, error)` to `(ResourceGroupsClientCheckExistenceResponse, error)` +- Function `*ResourceGroupsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, *ResourceGroupsBeginDeleteOptions)` to `(context.Context, string, *ResourceGroupsClientBeginDeleteOptions)` +- Function `*ResourceGroupsClient.BeginDelete` return value(s) have been changed from `(ResourceGroupsDeletePollerResponse, error)` to `(ResourceGroupsClientDeletePollerResponse, error)` +- Function `*DeploymentsClient.BeginDeleteAtTenantScope` parameter(s) have been changed from `(context.Context, string, *DeploymentsBeginDeleteAtTenantScopeOptions)` to `(context.Context, string, *DeploymentsClientBeginDeleteAtTenantScopeOptions)` +- Function `*DeploymentsClient.BeginDeleteAtTenantScope` return value(s) have been changed from `(DeploymentsDeleteAtTenantScopePollerResponse, error)` to `(DeploymentsClientDeleteAtTenantScopePollerResponse, error)` +- Function `*ResourceGroupsClient.Get` parameter(s) have been changed from `(context.Context, string, *ResourceGroupsGetOptions)` to `(context.Context, string, *ResourceGroupsClientGetOptions)` +- Function `*ResourceGroupsClient.Get` return value(s) have been changed from `(ResourceGroupsGetResponse, error)` to `(ResourceGroupsClientGetResponse, error)` +- Function `*DeploymentsListAtScopePager.Err` has been removed +- Function `*DeploymentsListAtTenantScopePager.PageResponse` has been removed +- Function `*DeploymentsValidateAtTenantScopePoller.Poll` has been removed +- Function `*DeploymentsValidatePollerResponse.Resume` has been removed +- Function `*ProvidersListPager.NextPage` has been removed +- Function `ResourcesCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsWhatIfAtTenantScopePoller.FinalResponse` has been removed +- Function `ResourcesDeletePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsDeleteAtSubscriptionScopePoller.Done` has been removed +- Function `*ResourcesCreateOrUpdatePoller.Poll` has been removed +- Function `ResourceGroupsDeletePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsCreateOrUpdateAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `ResourceGroupsExportTemplatePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesMoveResourcesPoller.Poll` has been removed +- Function `*ResourcesValidateMoveResourcesPollerResponse.Resume` has been removed +- Function `*DeploymentsValidateAtScopePoller.Done` has been removed +- Function `*DeploymentsWhatIfPollerResponse.Resume` has been removed +- Function `*ResourcesClient.List` has been removed +- Function `*DeploymentsDeleteAtTenantScopePoller.Done` has been removed +- Function `*GenericResource.UnmarshalJSON` has been removed +- Function `*DeploymentsValidateAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `ResourcesMoveInfo.MarshalJSON` has been removed +- Function `*DeploymentOperationsListAtManagementGroupScopePager.NextPage` has been removed +- Function `*Resource.UnmarshalJSON` has been removed +- Function `*DeploymentsDeletePoller.FinalResponse` has been removed +- Function `*DeploymentsListAtManagementGroupScopePager.Err` has been removed +- Function `*DeploymentsDeletePollerResponse.Resume` has been removed +- Function `*DeploymentsListByResourceGroupPager.PageResponse` has been removed +- Function `*ResourceGroupsExportTemplatePoller.FinalResponse` has been removed +- Function `*DeploymentsListByResourceGroupPager.Err` has been removed +- Function `*DeploymentsValidateAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsDeleteAtScopePoller.FinalResponse` has been removed +- Function `*ProvidersListPager.PageResponse` has been removed +- Function `*ResourcesClient.BeginDelete` has been removed +- Function `*ResourcesMoveResourcesPoller.FinalResponse` has been removed +- Function `*DeploymentsDeletePoller.Done` has been removed +- Function `*DeploymentsListAtSubscriptionScopePager.PageResponse` has been removed +- Function `*ResourcesCreateOrUpdateByIDPollerResponse.Resume` has been removed +- Function `*DeploymentsCreateOrUpdateAtScopePollerResponse.Resume` has been removed +- Function `*DeploymentsDeleteAtScopePoller.Poll` has been removed +- Function `*ResourcesDeletePoller.ResumeToken` has been removed +- Function `*ResourcesListByResourceGroupPager.Err` has been removed +- Function `*DeploymentsCreateOrUpdateAtTenantScopePoller.Done` has been removed +- Function `*ResourcesMoveResourcesPollerResponse.Resume` has been removed +- Function `*ResourceGroupsExportTemplatePollerResponse.Resume` has been removed +- Function `CloudError.Error` has been removed +- Function `*DeploymentOperationsListAtTenantScopePager.NextPage` has been removed +- Function `*DeploymentsCreateOrUpdateAtScopePoller.FinalResponse` has been removed +- Function `*DeploymentsDeleteAtTenantScopePollerResponse.Resume` has been removed +- Function `*ResourcesCreateOrUpdatePoller.ResumeToken` has been removed +- Function `NewResourcesClient` has been removed +- Function `*OperationsListPager.NextPage` has been removed +- Function `*ResourcesClient.ListByResourceGroup` has been removed +- Function `*TagsListPager.NextPage` has been removed +- Function `*DeploymentsCreateOrUpdatePoller.Poll` has been removed +- Function `*DeploymentsWhatIfAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `*DeploymentsDeleteAtManagementGroupScopePoller.Poll` has been removed +- Function `*ResourcesListPager.PageResponse` has been removed +- Function `*ProvidersListAtTenantScopePager.NextPage` has been removed +- Function `*ResourcesUpdatePoller.Done` has been removed +- Function `*ResourcesDeleteByIDPoller.Poll` has been removed +- Function `*ResourcesClient.BeginCreateOrUpdate` has been removed +- Function `*DeploymentsDeleteAtScopePoller.ResumeToken` has been removed +- Function `*DeploymentsValidateAtScopePollerResponse.Resume` has been removed +- Function `*ResourcesDeleteByIDPollerResponse.Resume` has been removed +- Function `*DeploymentsListAtTenantScopePager.Err` has been removed +- Function `*ResourcesClient.BeginUpdate` has been removed +- Function `ResourcesMoveResourcesPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsDeleteAtTenantScopePoller.ResumeToken` has been removed +- Function `*ResourcesValidateMoveResourcesPoller.ResumeToken` has been removed +- Function `*DeploymentsListAtManagementGroupScopePager.NextPage` has been removed +- Function `*DeploymentsValidateAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*ResourcesDeleteByIDPoller.Done` has been removed +- Function `DeploymentsWhatIfAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesClient.CheckExistence` has been removed +- Function `ResourcesUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ProvidersListAtTenantScopePager.PageResponse` has been removed +- Function `*ResourcesUpdateByIDPoller.ResumeToken` has been removed +- Function `*DeploymentsCreateOrUpdateAtTenantScopePollerResponse.Resume` has been removed +- Function `*ResourceGroupsDeletePoller.ResumeToken` has been removed +- Function `*ResourcesDeletePoller.Poll` has been removed +- Function `*DeploymentsDeleteAtScopePoller.Done` has been removed +- Function `*DeploymentOperationsListAtSubscriptionScopePager.Err` has been removed +- Function `*DeploymentsWhatIfPoller.FinalResponse` has been removed +- Function `*DeploymentOperationsListPager.NextPage` has been removed +- Function `*ResourcesClient.CheckExistenceByID` has been removed +- Function `*ResourceGroupsExportTemplatePoller.Done` has been removed +- Function `*DeploymentsDeletePoller.Poll` has been removed +- Function `*DeploymentsValidateAtManagementGroupScopePoller.Poll` has been removed +- Function `*DeploymentOperationsListAtTenantScopePager.Err` has been removed +- Function `*ResourcesDeletePollerResponse.Resume` has been removed +- Function `*DeploymentsWhatIfAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `DeploymentsDeleteAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `ResourcesValidateMoveResourcesPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsWhatIfAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentsCreateOrUpdateAtTenantScopePoller.ResumeToken` has been removed +- Function `DeploymentsWhatIfAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsCreateOrUpdateAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*DeploymentOperationsListAtSubscriptionScopePager.NextPage` has been removed +- Function `*DeploymentsValidateAtTenantScopePoller.FinalResponse` has been removed +- Function `*DeploymentsListAtScopePager.PageResponse` has been removed +- Function `*DeploymentsValidateAtScopePoller.ResumeToken` has been removed +- Function `*ProvidersListAtTenantScopePager.Err` has been removed +- Function `*ResourcesCreateOrUpdateByIDPoller.Done` has been removed +- Function `*DeploymentsCreateOrUpdateAtManagementGroupScopePoller.Poll` has been removed +- Function `*TagsListPager.PageResponse` has been removed +- Function `*DeploymentsCreateOrUpdateAtManagementGroupScopePoller.Done` has been removed +- Function `*ResourcesValidateMoveResourcesPoller.FinalResponse` has been removed +- Function `DeploymentsValidateAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesClient.BeginMoveResources` has been removed +- Function `*DeploymentsWhatIfPoller.ResumeToken` has been removed +- Function `ResourcesCreateOrUpdateByIDPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsCreateOrUpdateAtTenantScopePoller.FinalResponse` has been removed +- Function `DeploymentsCreateOrUpdateAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentOperationsListAtScopePager.PageResponse` has been removed +- Function `*ResourcesDeletePoller.FinalResponse` has been removed +- Function `DeploymentsWhatIfPollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsValidateAtSubscriptionScopePoller.Done` has been removed +- Function `DeploymentsValidateAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsCreateOrUpdatePoller.Done` has been removed +- Function `DeploymentsDeleteAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `ResourcesUpdateByIDPollerResponse.PollUntilDone` has been removed +- Function `*ResourceGroupsDeletePoller.Done` has been removed +- Function `*DeploymentsWhatIfAtTenantScopePoller.Done` has been removed +- Function `*DeploymentsCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*ResourcesUpdatePoller.FinalResponse` has been removed +- Function `*DeploymentsValidateAtTenantScopePoller.ResumeToken` has been removed +- Function `*DeploymentsCreateOrUpdateAtSubscriptionScopePoller.Poll` has been removed +- Function `*ResourcesUpdatePollerResponse.Resume` has been removed +- Function `*DeploymentsCreateOrUpdateAtSubscriptionScopePoller.Done` has been removed +- Function `*DeploymentsValidateAtScopePoller.FinalResponse` has been removed +- Function `*DeploymentOperationsListAtManagementGroupScopePager.PageResponse` has been removed +- Function `*DeploymentsWhatIfAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*DeploymentsListAtManagementGroupScopePager.PageResponse` has been removed +- Function `*ResourceGroupsDeletePollerResponse.Resume` has been removed +- Function `*ResourcesDeleteByIDPoller.FinalResponse` has been removed +- Function `*ResourcesListByResourceGroupPager.PageResponse` has been removed +- Function `DeploymentsDeleteAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourceGroupsListPager.PageResponse` has been removed +- Function `*DeploymentsDeleteAtSubscriptionScopePoller.Poll` has been removed +- Function `*DeploymentsValidateAtTenantScopePoller.Done` has been removed +- Function `DeploymentsCreateOrUpdatePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesListByResourceGroupPager.NextPage` has been removed +- Function `*ResourceGroupsExportTemplatePoller.ResumeToken` has been removed +- Function `*ResourcesClient.BeginUpdateByID` has been removed +- Function `*DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `*DeploymentsDeleteAtSubscriptionScopePollerResponse.Resume` has been removed +- Function `*ResourcesUpdatePoller.ResumeToken` has been removed +- Function `*DeploymentsValidatePoller.Poll` has been removed +- Function `*ResourceGroupsDeletePoller.FinalResponse` has been removed +- Function `*OperationsListPager.Err` has been removed +- Function `*ResourcesUpdatePoller.Poll` has been removed +- Function `*DeploymentsListAtSubscriptionScopePager.NextPage` has been removed +- Function `*DeploymentsValidatePoller.ResumeToken` has been removed +- Function `*ResourceGroupsListPager.NextPage` has been removed +- Function `DeploymentsCreateOrUpdateAtScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesClient.BeginCreateOrUpdateByID` has been removed +- Function `*DeploymentsCreateOrUpdateAtTenantScopePoller.Poll` has been removed +- Function `*DeploymentOperationsListAtManagementGroupScopePager.Err` has been removed +- Function `DeploymentsValidateAtScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsWhatIfPoller.Done` has been removed +- Function `*DeploymentsDeleteAtManagementGroupScopePoller.Done` has been removed +- Function `*ResourcesListPager.Err` has been removed +- Function `*DeploymentsDeleteAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsDeleteAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*DeploymentsWhatIfAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `DeploymentsDeleteAtScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesListPager.NextPage` has been removed +- Function `DeploymentsWhatIfAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `ResourcesDeleteByIDPollerResponse.PollUntilDone` has been removed +- Function `*ResourcesClient.BeginDeleteByID` has been removed +- Function `*DeploymentsCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*DeploymentsValidateAtManagementGroupScopePoller.Done` has been removed +- Function `*DeploymentsValidatePoller.Done` has been removed +- Function `*ResourcesCreateOrUpdatePoller.Done` has been removed +- Function `DeploymentsValidatePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsWhatIfAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*ResourceGroupsListPager.Err` has been removed +- Function `*DeploymentsCreateOrUpdateAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsCreateOrUpdateAtScopePoller.Done` has been removed +- Function `*ResourcesDeletePoller.Done` has been removed +- Function `*ResourcesUpdateByIDPoller.Poll` has been removed +- Function `*DeploymentsValidateAtTenantScopePollerResponse.Resume` has been removed +- Function `DeploymentsDeletePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsWhatIfAtTenantScopePoller.Poll` has been removed +- Function `*DeploymentOperationsListPager.PageResponse` has been removed +- Function `*ResourcesClient.GetByID` has been removed +- Function `DeploymentsValidateAtTenantScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentOperationsListAtTenantScopePager.PageResponse` has been removed +- Function `*DeploymentsCreateOrUpdateAtManagementGroupScopePoller.ResumeToken` has been removed +- Function `*DeploymentsListAtScopePager.NextPage` has been removed +- Function `*ResourcesCreateOrUpdatePollerResponse.Resume` has been removed +- Function `*ResourcesUpdateByIDPollerResponse.Resume` has been removed +- Function `*DeploymentsDeleteAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsWhatIfAtSubscriptionScopePoller.Poll` has been removed +- Function `*DeploymentsValidateAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `*DeploymentsCreateOrUpdatePoller.ResumeToken` has been removed +- Function `*ResourcesClient.BeginValidateMoveResources` has been removed +- Function `*DeploymentsCreateOrUpdateAtScopePoller.Poll` has been removed +- Function `*ResourcesUpdateByIDPoller.Done` has been removed +- Function `*ResourcesClient.Get` has been removed +- Function `*TagsListPager.Err` has been removed +- Function `*ResourcesCreateOrUpdatePoller.FinalResponse` has been removed +- Function `*DeploymentsListAtTenantScopePager.NextPage` has been removed +- Function `*DeploymentsDeleteAtTenantScopePoller.Poll` has been removed +- Function `*DeploymentsWhatIfAtSubscriptionScopePoller.Done` has been removed +- Function `*ResourcesDeleteByIDPoller.ResumeToken` has been removed +- Function `*ResourcesMoveResourcesPoller.Done` has been removed +- Function `*DeploymentsValidateAtSubscriptionScopePoller.Poll` has been removed +- Function `*DeploymentsDeleteAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `*ResourcesUpdateByIDPoller.FinalResponse` has been removed +- Function `*OperationsListPager.PageResponse` has been removed +- Function `*ResourcesMoveResourcesPoller.ResumeToken` has been removed +- Function `*ResourceGroupsDeletePoller.Poll` has been removed +- Function `*DeploymentOperationsListAtScopePager.Err` has been removed +- Function `*DeploymentsListByResourceGroupPager.NextPage` has been removed +- Function `*ResourcesValidateMoveResourcesPoller.Done` has been removed +- Function `*DeploymentsCreateOrUpdateAtScopePoller.ResumeToken` has been removed +- Function `DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse.PollUntilDone` has been removed +- Function `*DeploymentsValidateAtManagementGroupScopePollerResponse.Resume` has been removed +- Function `DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse.PollUntilDone` has been removed +- Function `*ResourcesCreateOrUpdateByIDPoller.Poll` has been removed +- Function `*ResourcesValidateMoveResourcesPoller.Poll` has been removed +- Function `*DeploymentsDeleteAtManagementGroupScopePoller.FinalResponse` has been removed +- Function `*DeploymentsWhatIfAtTenantScopePoller.ResumeToken` has been removed +- Function `*DeploymentsValidateAtSubscriptionScopePoller.ResumeToken` has been removed +- Function `*DeploymentsWhatIfAtSubscriptionScopePoller.FinalResponse` has been removed +- Function `*DeploymentsWhatIfAtManagementGroupScopePoller.Poll` has been removed +- Function `*ProvidersListPager.Err` has been removed +- Function `*ResourcesCreateOrUpdateByIDPoller.FinalResponse` has been removed +- Function `*DeploymentsDeleteAtTenantScopePoller.FinalResponse` has been removed +- Function `*ResourcesCreateOrUpdateByIDPoller.ResumeToken` has been removed +- Function `*ResourceGroupsExportTemplatePoller.Poll` has been removed +- Function `*DeploymentsDeletePoller.ResumeToken` has been removed +- Function `*DeploymentsWhatIfAtTenantScopePollerResponse.Resume` has been removed +- Function `*DeploymentOperationsListAtScopePager.NextPage` has been removed +- Function `*DeploymentsDeleteAtScopePollerResponse.Resume` has been removed +- Function `*DeploymentOperationsListPager.Err` has been removed +- Function `*DeploymentsWhatIfPoller.Poll` has been removed +- Function `*DeploymentOperationsListAtSubscriptionScopePager.PageResponse` has been removed +- Function `*DeploymentsListAtSubscriptionScopePager.Err` has been removed +- Function `*DeploymentsValidatePoller.FinalResponse` has been removed +- Function `*DeploymentsValidateAtScopePoller.Poll` has been removed +- Struct `DeploymentOperationsGetAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentOperationsGetAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentOperationsGetAtManagementGroupScopeResult` has been removed +- Struct `DeploymentOperationsGetAtScopeOptions` has been removed +- Struct `DeploymentOperationsGetAtScopeResponse` has been removed +- Struct `DeploymentOperationsGetAtScopeResult` has been removed +- Struct `DeploymentOperationsGetAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentOperationsGetAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentOperationsGetAtSubscriptionScopeResult` has been removed +- Struct `DeploymentOperationsGetAtTenantScopeOptions` has been removed +- Struct `DeploymentOperationsGetAtTenantScopeResponse` has been removed +- Struct `DeploymentOperationsGetAtTenantScopeResult` has been removed +- Struct `DeploymentOperationsGetOptions` has been removed +- Struct `DeploymentOperationsGetResponse` has been removed +- Struct `DeploymentOperationsGetResult` has been removed +- Struct `DeploymentOperationsListAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentOperationsListAtManagementGroupScopePager` has been removed +- Struct `DeploymentOperationsListAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentOperationsListAtManagementGroupScopeResult` has been removed +- Struct `DeploymentOperationsListAtScopeOptions` has been removed +- Struct `DeploymentOperationsListAtScopePager` has been removed +- Struct `DeploymentOperationsListAtScopeResponse` has been removed +- Struct `DeploymentOperationsListAtScopeResult` has been removed +- Struct `DeploymentOperationsListAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentOperationsListAtSubscriptionScopePager` has been removed +- Struct `DeploymentOperationsListAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentOperationsListAtSubscriptionScopeResult` has been removed +- Struct `DeploymentOperationsListAtTenantScopeOptions` has been removed +- Struct `DeploymentOperationsListAtTenantScopePager` has been removed +- Struct `DeploymentOperationsListAtTenantScopeResponse` has been removed +- Struct `DeploymentOperationsListAtTenantScopeResult` has been removed +- Struct `DeploymentOperationsListOptions` has been removed +- Struct `DeploymentOperationsListPager` has been removed +- Struct `DeploymentOperationsListResponse` has been removed +- Struct `DeploymentOperationsListResultEnvelope` has been removed +- Struct `DeploymentsBeginCreateOrUpdateAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsBeginCreateOrUpdateAtScopeOptions` has been removed +- Struct `DeploymentsBeginCreateOrUpdateAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsBeginCreateOrUpdateAtTenantScopeOptions` has been removed +- Struct `DeploymentsBeginCreateOrUpdateOptions` has been removed +- Struct `DeploymentsBeginDeleteAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsBeginDeleteAtScopeOptions` has been removed +- Struct `DeploymentsBeginDeleteAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsBeginDeleteAtTenantScopeOptions` has been removed +- Struct `DeploymentsBeginDeleteOptions` has been removed +- Struct `DeploymentsBeginValidateAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsBeginValidateAtScopeOptions` has been removed +- Struct `DeploymentsBeginValidateAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsBeginValidateAtTenantScopeOptions` has been removed +- Struct `DeploymentsBeginValidateOptions` has been removed +- Struct `DeploymentsBeginWhatIfAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsBeginWhatIfAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsBeginWhatIfAtTenantScopeOptions` has been removed +- Struct `DeploymentsBeginWhatIfOptions` has been removed +- Struct `DeploymentsCalculateTemplateHashOptions` has been removed +- Struct `DeploymentsCalculateTemplateHashResponse` has been removed +- Struct `DeploymentsCalculateTemplateHashResult` has been removed +- Struct `DeploymentsCancelAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsCancelAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsCancelAtScopeOptions` has been removed +- Struct `DeploymentsCancelAtScopeResponse` has been removed +- Struct `DeploymentsCancelAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsCancelAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsCancelAtTenantScopeOptions` has been removed +- Struct `DeploymentsCancelAtTenantScopeResponse` has been removed +- Struct `DeploymentsCancelOptions` has been removed +- Struct `DeploymentsCancelResponse` has been removed +- Struct `DeploymentsCheckExistenceAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsCheckExistenceAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsCheckExistenceAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsCheckExistenceAtScopeOptions` has been removed +- Struct `DeploymentsCheckExistenceAtScopeResponse` has been removed +- Struct `DeploymentsCheckExistenceAtScopeResult` has been removed +- Struct `DeploymentsCheckExistenceAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsCheckExistenceAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsCheckExistenceAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsCheckExistenceAtTenantScopeOptions` has been removed +- Struct `DeploymentsCheckExistenceAtTenantScopeResponse` has been removed +- Struct `DeploymentsCheckExistenceAtTenantScopeResult` has been removed +- Struct `DeploymentsCheckExistenceOptions` has been removed +- Struct `DeploymentsCheckExistenceResponse` has been removed +- Struct `DeploymentsCheckExistenceResult` has been removed +- Struct `DeploymentsCreateOrUpdateAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsCreateOrUpdateAtScopePoller` has been removed +- Struct `DeploymentsCreateOrUpdateAtScopePollerResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtScopeResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtScopeResult` has been removed +- Struct `DeploymentsCreateOrUpdateAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsCreateOrUpdateAtTenantScopePoller` has been removed +- Struct `DeploymentsCreateOrUpdateAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtTenantScopeResponse` has been removed +- Struct `DeploymentsCreateOrUpdateAtTenantScopeResult` has been removed +- Struct `DeploymentsCreateOrUpdatePoller` has been removed +- Struct `DeploymentsCreateOrUpdatePollerResponse` has been removed +- Struct `DeploymentsCreateOrUpdateResponse` has been removed +- Struct `DeploymentsCreateOrUpdateResult` has been removed +- Struct `DeploymentsDeleteAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsDeleteAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsDeleteAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsDeleteAtScopePoller` has been removed +- Struct `DeploymentsDeleteAtScopePollerResponse` has been removed +- Struct `DeploymentsDeleteAtScopeResponse` has been removed +- Struct `DeploymentsDeleteAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsDeleteAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsDeleteAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsDeleteAtTenantScopePoller` has been removed +- Struct `DeploymentsDeleteAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsDeleteAtTenantScopeResponse` has been removed +- Struct `DeploymentsDeletePoller` has been removed +- Struct `DeploymentsDeletePollerResponse` has been removed +- Struct `DeploymentsDeleteResponse` has been removed +- Struct `DeploymentsExportTemplateAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsExportTemplateAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsExportTemplateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsExportTemplateAtScopeOptions` has been removed +- Struct `DeploymentsExportTemplateAtScopeResponse` has been removed +- Struct `DeploymentsExportTemplateAtScopeResult` has been removed +- Struct `DeploymentsExportTemplateAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsExportTemplateAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsExportTemplateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsExportTemplateAtTenantScopeOptions` has been removed +- Struct `DeploymentsExportTemplateAtTenantScopeResponse` has been removed +- Struct `DeploymentsExportTemplateAtTenantScopeResult` has been removed +- Struct `DeploymentsExportTemplateOptions` has been removed +- Struct `DeploymentsExportTemplateResponse` has been removed +- Struct `DeploymentsExportTemplateResult` has been removed +- Struct `DeploymentsGetAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsGetAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsGetAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsGetAtScopeOptions` has been removed +- Struct `DeploymentsGetAtScopeResponse` has been removed +- Struct `DeploymentsGetAtScopeResult` has been removed +- Struct `DeploymentsGetAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsGetAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsGetAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsGetAtTenantScopeOptions` has been removed +- Struct `DeploymentsGetAtTenantScopeResponse` has been removed +- Struct `DeploymentsGetAtTenantScopeResult` has been removed +- Struct `DeploymentsGetOptions` has been removed +- Struct `DeploymentsGetResponse` has been removed +- Struct `DeploymentsGetResult` has been removed +- Struct `DeploymentsListAtManagementGroupScopeOptions` has been removed +- Struct `DeploymentsListAtManagementGroupScopePager` has been removed +- Struct `DeploymentsListAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsListAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsListAtScopeOptions` has been removed +- Struct `DeploymentsListAtScopePager` has been removed +- Struct `DeploymentsListAtScopeResponse` has been removed +- Struct `DeploymentsListAtScopeResult` has been removed +- Struct `DeploymentsListAtSubscriptionScopeOptions` has been removed +- Struct `DeploymentsListAtSubscriptionScopePager` has been removed +- Struct `DeploymentsListAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsListAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsListAtTenantScopeOptions` has been removed +- Struct `DeploymentsListAtTenantScopePager` has been removed +- Struct `DeploymentsListAtTenantScopeResponse` has been removed +- Struct `DeploymentsListAtTenantScopeResult` has been removed +- Struct `DeploymentsListByResourceGroupOptions` has been removed +- Struct `DeploymentsListByResourceGroupPager` has been removed +- Struct `DeploymentsListByResourceGroupResponse` has been removed +- Struct `DeploymentsListByResourceGroupResult` has been removed +- Struct `DeploymentsValidateAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsValidateAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsValidateAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsValidateAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsValidateAtScopePoller` has been removed +- Struct `DeploymentsValidateAtScopePollerResponse` has been removed +- Struct `DeploymentsValidateAtScopeResponse` has been removed +- Struct `DeploymentsValidateAtScopeResult` has been removed +- Struct `DeploymentsValidateAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsValidateAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsValidateAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsValidateAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsValidateAtTenantScopePoller` has been removed +- Struct `DeploymentsValidateAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsValidateAtTenantScopeResponse` has been removed +- Struct `DeploymentsValidateAtTenantScopeResult` has been removed +- Struct `DeploymentsValidatePoller` has been removed +- Struct `DeploymentsValidatePollerResponse` has been removed +- Struct `DeploymentsValidateResponse` has been removed +- Struct `DeploymentsValidateResult` has been removed +- Struct `DeploymentsWhatIfAtManagementGroupScopePoller` has been removed +- Struct `DeploymentsWhatIfAtManagementGroupScopePollerResponse` has been removed +- Struct `DeploymentsWhatIfAtManagementGroupScopeResponse` has been removed +- Struct `DeploymentsWhatIfAtManagementGroupScopeResult` has been removed +- Struct `DeploymentsWhatIfAtSubscriptionScopePoller` has been removed +- Struct `DeploymentsWhatIfAtSubscriptionScopePollerResponse` has been removed +- Struct `DeploymentsWhatIfAtSubscriptionScopeResponse` has been removed +- Struct `DeploymentsWhatIfAtSubscriptionScopeResult` has been removed +- Struct `DeploymentsWhatIfAtTenantScopePoller` has been removed +- Struct `DeploymentsWhatIfAtTenantScopePollerResponse` has been removed +- Struct `DeploymentsWhatIfAtTenantScopeResponse` has been removed +- Struct `DeploymentsWhatIfAtTenantScopeResult` has been removed +- Struct `DeploymentsWhatIfPoller` has been removed +- Struct `DeploymentsWhatIfPollerResponse` has been removed +- Struct `DeploymentsWhatIfResponse` has been removed +- Struct `DeploymentsWhatIfResult` has been removed +- Struct `OperationsListOptions` has been removed +- Struct `OperationsListPager` has been removed +- Struct `OperationsListResponse` has been removed +- Struct `OperationsListResult` has been removed +- Struct `ProviderResourceTypesListOptions` has been removed +- Struct `ProviderResourceTypesListResponse` has been removed +- Struct `ProviderResourceTypesListResult` has been removed +- Struct `ProvidersGetAtTenantScopeOptions` has been removed +- Struct `ProvidersGetAtTenantScopeResponse` has been removed +- Struct `ProvidersGetAtTenantScopeResult` has been removed +- Struct `ProvidersGetOptions` has been removed +- Struct `ProvidersGetResponse` has been removed +- Struct `ProvidersGetResult` has been removed +- Struct `ProvidersListAtTenantScopeOptions` has been removed +- Struct `ProvidersListAtTenantScopePager` has been removed +- Struct `ProvidersListAtTenantScopeResponse` has been removed +- Struct `ProvidersListAtTenantScopeResult` has been removed +- Struct `ProvidersListOptions` has been removed +- Struct `ProvidersListPager` has been removed +- Struct `ProvidersListResponse` has been removed +- Struct `ProvidersListResult` has been removed +- Struct `ProvidersProviderPermissionsOptions` has been removed +- Struct `ProvidersProviderPermissionsResponse` has been removed +- Struct `ProvidersProviderPermissionsResult` has been removed +- Struct `ProvidersRegisterAtManagementGroupScopeOptions` has been removed +- Struct `ProvidersRegisterAtManagementGroupScopeResponse` has been removed +- Struct `ProvidersRegisterOptions` has been removed +- Struct `ProvidersRegisterResponse` has been removed +- Struct `ProvidersRegisterResult` has been removed +- Struct `ProvidersUnregisterOptions` has been removed +- Struct `ProvidersUnregisterResponse` has been removed +- Struct `ProvidersUnregisterResult` has been removed +- Struct `ResourceGroupsBeginDeleteOptions` has been removed +- Struct `ResourceGroupsBeginExportTemplateOptions` has been removed +- Struct `ResourceGroupsCheckExistenceOptions` has been removed +- Struct `ResourceGroupsCheckExistenceResponse` has been removed +- Struct `ResourceGroupsCheckExistenceResult` has been removed +- Struct `ResourceGroupsCreateOrUpdateOptions` has been removed +- Struct `ResourceGroupsCreateOrUpdateResponse` has been removed +- Struct `ResourceGroupsCreateOrUpdateResult` has been removed +- Struct `ResourceGroupsDeletePoller` has been removed +- Struct `ResourceGroupsDeletePollerResponse` has been removed +- Struct `ResourceGroupsDeleteResponse` has been removed +- Struct `ResourceGroupsExportTemplatePoller` has been removed +- Struct `ResourceGroupsExportTemplatePollerResponse` has been removed +- Struct `ResourceGroupsExportTemplateResponse` has been removed +- Struct `ResourceGroupsExportTemplateResult` has been removed +- Struct `ResourceGroupsGetOptions` has been removed +- Struct `ResourceGroupsGetResponse` has been removed +- Struct `ResourceGroupsGetResult` has been removed +- Struct `ResourceGroupsListOptions` has been removed +- Struct `ResourceGroupsListPager` has been removed +- Struct `ResourceGroupsListResponse` has been removed +- Struct `ResourceGroupsListResult` has been removed +- Struct `ResourceGroupsUpdateOptions` has been removed +- Struct `ResourceGroupsUpdateResponse` has been removed +- Struct `ResourceGroupsUpdateResult` has been removed +- Struct `ResourcesBeginCreateOrUpdateByIDOptions` has been removed +- Struct `ResourcesBeginCreateOrUpdateOptions` has been removed +- Struct `ResourcesBeginDeleteByIDOptions` has been removed +- Struct `ResourcesBeginDeleteOptions` has been removed +- Struct `ResourcesBeginMoveResourcesOptions` has been removed +- Struct `ResourcesBeginUpdateByIDOptions` has been removed +- Struct `ResourcesBeginUpdateOptions` has been removed +- Struct `ResourcesBeginValidateMoveResourcesOptions` has been removed +- Struct `ResourcesCheckExistenceByIDOptions` has been removed +- Struct `ResourcesCheckExistenceByIDResponse` has been removed +- Struct `ResourcesCheckExistenceByIDResult` has been removed +- Struct `ResourcesCheckExistenceOptions` has been removed +- Struct `ResourcesCheckExistenceResponse` has been removed +- Struct `ResourcesCheckExistenceResult` has been removed +- Struct `ResourcesClient` has been removed +- Struct `ResourcesCreateOrUpdateByIDPoller` has been removed +- Struct `ResourcesCreateOrUpdateByIDPollerResponse` has been removed +- Struct `ResourcesCreateOrUpdateByIDResponse` has been removed +- Struct `ResourcesCreateOrUpdateByIDResult` has been removed +- Struct `ResourcesCreateOrUpdatePoller` has been removed +- Struct `ResourcesCreateOrUpdatePollerResponse` has been removed +- Struct `ResourcesCreateOrUpdateResponse` has been removed +- Struct `ResourcesCreateOrUpdateResult` has been removed +- Struct `ResourcesDeleteByIDPoller` has been removed +- Struct `ResourcesDeleteByIDPollerResponse` has been removed +- Struct `ResourcesDeleteByIDResponse` has been removed +- Struct `ResourcesDeletePoller` has been removed +- Struct `ResourcesDeletePollerResponse` has been removed +- Struct `ResourcesDeleteResponse` has been removed +- Struct `ResourcesGetByIDOptions` has been removed +- Struct `ResourcesGetByIDResponse` has been removed +- Struct `ResourcesGetByIDResult` has been removed +- Struct `ResourcesGetOptions` has been removed +- Struct `ResourcesGetResponse` has been removed +- Struct `ResourcesGetResult` has been removed +- Struct `ResourcesListByResourceGroupOptions` has been removed +- Struct `ResourcesListByResourceGroupPager` has been removed +- Struct `ResourcesListByResourceGroupResponse` has been removed +- Struct `ResourcesListByResourceGroupResult` has been removed +- Struct `ResourcesListOptions` has been removed +- Struct `ResourcesListPager` has been removed +- Struct `ResourcesListResponse` has been removed +- Struct `ResourcesListResult` has been removed +- Struct `ResourcesMoveInfo` has been removed +- Struct `ResourcesMoveResourcesPoller` has been removed +- Struct `ResourcesMoveResourcesPollerResponse` has been removed +- Struct `ResourcesMoveResourcesResponse` has been removed +- Struct `ResourcesUpdateByIDPoller` has been removed +- Struct `ResourcesUpdateByIDPollerResponse` has been removed +- Struct `ResourcesUpdateByIDResponse` has been removed +- Struct `ResourcesUpdateByIDResult` has been removed +- Struct `ResourcesUpdatePoller` has been removed +- Struct `ResourcesUpdatePollerResponse` has been removed +- Struct `ResourcesUpdateResponse` has been removed +- Struct `ResourcesUpdateResult` has been removed +- Struct `ResourcesValidateMoveResourcesPoller` has been removed +- Struct `ResourcesValidateMoveResourcesPollerResponse` has been removed +- Struct `ResourcesValidateMoveResourcesResponse` has been removed +- Struct `TagsCreateOrUpdateAtScopeOptions` has been removed +- Struct `TagsCreateOrUpdateAtScopeResponse` has been removed +- Struct `TagsCreateOrUpdateAtScopeResult` has been removed +- Struct `TagsCreateOrUpdateOptions` has been removed +- Struct `TagsCreateOrUpdateResponse` has been removed +- Struct `TagsCreateOrUpdateResult` has been removed +- Struct `TagsCreateOrUpdateValueOptions` has been removed +- Struct `TagsCreateOrUpdateValueResponse` has been removed +- Struct `TagsCreateOrUpdateValueResult` has been removed +- Struct `TagsDeleteAtScopeOptions` has been removed +- Struct `TagsDeleteAtScopeResponse` has been removed +- Struct `TagsDeleteOptions` has been removed +- Struct `TagsDeleteResponse` has been removed +- Struct `TagsDeleteValueOptions` has been removed +- Struct `TagsDeleteValueResponse` has been removed +- Struct `TagsGetAtScopeOptions` has been removed +- Struct `TagsGetAtScopeResponse` has been removed +- Struct `TagsGetAtScopeResult` has been removed +- Struct `TagsListOptions` has been removed +- Struct `TagsListPager` has been removed +- Struct `TagsListResponse` has been removed +- Struct `TagsListResultEnvelope` has been removed +- Struct `TagsUpdateAtScopeOptions` has been removed +- Struct `TagsUpdateAtScopeResponse` has been removed +- Struct `TagsUpdateAtScopeResult` has been removed +- Field `DeploymentProperties` of struct `DeploymentWhatIfProperties` has been removed +- Field `InnerError` of struct `CloudError` has been removed +- Field `Resource` of struct `GenericResource` has been removed +- Field `GenericResource` of struct `GenericResourceExpanded` has been removed + +### Features Added + +- New function `*DeploymentsClientListAtTenantScopePager.NextPage(context.Context) bool` +- New function `*ClientDeleteByIDPoller.ResumeToken() (string, error)` +- New function `*ClientDeletePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidateAtManagementGroupScopePoller.FinalResponse(context.Context) (DeploymentsClientValidateAtManagementGroupScopeResponse, error)` +- New function `*ClientListByResourceGroupPager.Err() error` +- New function `*ClientDeleteByIDPollerResponse.Resume(context.Context, *Client, string) error` +- New function `*ClientListPager.NextPage(context.Context) bool` +- New function `ClientUpdatePollerResponse.PollUntilDone(context.Context, time.Duration) (ClientUpdateResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentOperationsClientListAtScopePager.NextPage(context.Context) bool` +- New function `*DeploymentsClientListAtScopePager.PageResponse() DeploymentsClientListAtScopeResponse` +- New function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentOperationsClientListAtTenantScopePager.PageResponse() DeploymentOperationsClientListAtTenantScopeResponse` +- New function `*Client.BeginValidateMoveResources(context.Context, string, MoveInfo, *ClientBeginValidateMoveResourcesOptions) (ClientValidateMoveResourcesPollerResponse, error)` +- New function `*DeploymentsClientListAtSubscriptionScopePager.PageResponse() DeploymentsClientListAtSubscriptionScopeResponse` +- New function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.Done() bool` +- New function `ClientUpdateByIDPollerResponse.PollUntilDone(context.Context, time.Duration) (ClientUpdateByIDResponse, error)` +- New function `*DeploymentsClientWhatIfPoller.ResumeToken() (string, error)` +- New function `*ClientCreateOrUpdatePollerResponse.Resume(context.Context, *Client, string) error` +- New function `*ResourceGroupsClientExportTemplatePoller.ResumeToken() (string, error)` +- New function `*DeploymentOperationsClientListAtScopePager.Err() error` +- New function `*DeploymentOperationsClientListAtManagementGroupScopePager.NextPage(context.Context) bool` +- New function `DeploymentsClientDeleteAtSubscriptionScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientDeleteAtSubscriptionScopeResponse, error)` +- New function `*ClientDeletePollerResponse.Resume(context.Context, *Client, string) error` +- New function `*DeploymentsClientValidateAtManagementGroupScopePoller.ResumeToken() (string, error)` +- New function `*ProvidersClientListAtTenantScopePager.NextPage(context.Context) bool` +- New function `ResourceGroupsClientDeletePollerResponse.PollUntilDone(context.Context, time.Duration) (ResourceGroupsClientDeleteResponse, error)` +- New function `*ResourceGroupsClientListPager.Err() error` +- New function `*ProvidersClientListAtTenantScopePager.PageResponse() ProvidersClientListAtTenantScopeResponse` +- New function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.Done() bool` +- New function `*DeploymentOperationsClientListAtTenantScopePager.Err() error` +- New function `*ClientValidateMoveResourcesPoller.FinalResponse(context.Context) (ClientValidateMoveResourcesResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientCreateOrUpdateAtScopePoller.FinalResponse(context.Context) (DeploymentsClientCreateOrUpdateAtScopeResponse, error)` +- New function `*ProvidersClientListPager.PageResponse() ProvidersClientListResponse` +- New function `*DeploymentsClientCreateOrUpdatePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidatePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientWhatIfAtTenantScopePoller.ResumeToken() (string, error)` +- New function `*ClientCreateOrUpdateByIDPoller.ResumeToken() (string, error)` +- New function `*ClientValidateMoveResourcesPollerResponse.Resume(context.Context, *Client, string) error` +- New function `DeploymentsClientWhatIfAtManagementGroupScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientWhatIfAtManagementGroupScopeResponse, error)` +- New function `*DeploymentsClientValidateAtSubscriptionScopePoller.Done() bool` +- New function `ClientCreateOrUpdatePollerResponse.PollUntilDone(context.Context, time.Duration) (ClientCreateOrUpdateResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.FinalResponse(context.Context) (DeploymentsClientCreateOrUpdateAtTenantScopeResponse, error)` +- New function `*DeploymentOperationsClientListAtTenantScopePager.NextPage(context.Context) bool` +- New function `*DeploymentsClientListByResourceGroupPager.Err() error` +- New function `*DeploymentsClientDeleteAtScopePoller.Done() bool` +- New function `*DeploymentsClientCreateOrUpdatePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientValidateAtTenantScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientValidatePoller.Done() bool` +- New function `*DeploymentsClientListAtSubscriptionScopePager.NextPage(context.Context) bool` +- New function `*DeploymentsClientListAtManagementGroupScopePager.PageResponse() DeploymentsClientListAtManagementGroupScopeResponse` +- New function `*DeploymentsClientDeleteAtManagementGroupScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*TagsClientListPager.Err() error` +- New function `DeploymentsClientValidateAtManagementGroupScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientValidateAtManagementGroupScopeResponse, error)` +- New function `*ResourceGroupsClientListPager.PageResponse() ResourceGroupsClientListResponse` +- New function `DeploymentsClientWhatIfAtSubscriptionScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientWhatIfAtSubscriptionScopeResponse, error)` +- New function `*ClientCreateOrUpdateByIDPoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientCreateOrUpdatePoller.ResumeToken() (string, error)` +- New function `*Client.BeginCreateOrUpdateByID(context.Context, string, string, GenericResource, *ClientBeginCreateOrUpdateByIDOptions) (ClientCreateOrUpdateByIDPollerResponse, error)` +- New function `*DeploymentsClientDeleteAtSubscriptionScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientWhatIfAtTenantScopePoller.FinalResponse(context.Context) (DeploymentsClientWhatIfAtTenantScopeResponse, error)` +- New function `*DeploymentsClientValidateAtSubscriptionScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidateAtTenantScopePoller.Done() bool` +- New function `*ClientListByResourceGroupPager.NextPage(context.Context) bool` +- New function `*DeploymentsClientWhatIfAtSubscriptionScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*Client.BeginDeleteByID(context.Context, string, string, *ClientBeginDeleteByIDOptions) (ClientDeleteByIDPollerResponse, error)` +- New function `*DeploymentsClientListAtScopePager.NextPage(context.Context) bool` +- New function `*Client.BeginUpdateByID(context.Context, string, string, GenericResource, *ClientBeginUpdateByIDOptions) (ClientUpdateByIDPollerResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.ResumeToken() (string, error)` +- New function `*ClientUpdatePollerResponse.Resume(context.Context, *Client, string) error` +- New function `*DeploymentsClientValidateAtScopePoller.FinalResponse(context.Context) (DeploymentsClientValidateAtScopeResponse, error)` +- New function `*DeploymentsClientCreateOrUpdatePoller.Done() bool` +- New function `*ResourceGroupsClientExportTemplatePollerResponse.Resume(context.Context, *ResourceGroupsClient, string) error` +- New function `*Client.BeginCreateOrUpdate(context.Context, string, string, string, string, string, string, GenericResource, *ClientBeginCreateOrUpdateOptions) (ClientCreateOrUpdatePollerResponse, error)` +- New function `*Client.BeginUpdate(context.Context, string, string, string, string, string, string, GenericResource, *ClientBeginUpdateOptions) (ClientUpdatePollerResponse, error)` +- New function `DeploymentsClientWhatIfPollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientWhatIfResponse, error)` +- New function `*OperationsClientListPager.NextPage(context.Context) bool` +- New function `*ClientUpdateByIDPoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientDeleteAtManagementGroupScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientCreateOrUpdateAtScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientDeleteAtScopePoller.FinalResponse(context.Context) (DeploymentsClientDeleteAtScopeResponse, error)` +- New function `*DeploymentsClientCreateOrUpdatePoller.FinalResponse(context.Context) (DeploymentsClientCreateOrUpdateResponse, error)` +- New function `*ProvidersClientListAtTenantScopePager.Err() error` +- New function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientUpdatePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientDeleteAtSubscriptionScopePoller.ResumeToken() (string, error)` +- New function `*ClientCreateOrUpdatePoller.FinalResponse(context.Context) (ClientCreateOrUpdateResponse, error)` +- New function `*DeploymentsClientListAtManagementGroupScopePager.Err() error` +- New function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `DeploymentsClientDeletePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientDeleteResponse, error)` +- New function `*ResourceGroupsClientDeletePollerResponse.Resume(context.Context, *ResourceGroupsClient, string) error` +- New function `*DeploymentsClientCreateOrUpdateAtTenantScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientListByResourceGroupPager.NextPage(context.Context) bool` +- New function `*ResourceGroupsClientExportTemplatePoller.FinalResponse(context.Context) (ResourceGroupsClientExportTemplateResponse, error)` +- New function `*OperationsClientListPager.Err() error` +- New function `*ClientUpdateByIDPollerResponse.Resume(context.Context, *Client, string) error` +- New function `*DeploymentsClientDeletePoller.ResumeToken() (string, error)` +- New function `*ClientUpdateByIDPoller.Done() bool` +- New function `*DeploymentsClientValidateAtScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentOperationsClientListPager.Err() error` +- New function `*DeploymentsClientWhatIfPoller.Poll(context.Context) (*http.Response, error)` +- New function `DeploymentsClientDeleteAtScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientDeleteAtScopeResponse, error)` +- New function `DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientCreateOrUpdateAtTenantScopeResponse, error)` +- New function `*Client.ListByResourceGroup(string, *ClientListByResourceGroupOptions) *ClientListByResourceGroupPager` +- New function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.FinalResponse(context.Context) (DeploymentsClientWhatIfAtManagementGroupScopeResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtScopePoller.ResumeToken() (string, error)` +- New function `*TagsClientListPager.NextPage(context.Context) bool` +- New function `*DeploymentOperationsClientListAtSubscriptionScopePager.Err() error` +- New function `*DeploymentsClientDeletePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientMoveResourcesPoller.ResumeToken() (string, error)` +- New function `*ClientDeletePoller.FinalResponse(context.Context) (ClientDeleteResponse, error)` +- New function `*DeploymentsClientValidateAtManagementGroupScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientValidateAtSubscriptionScopePoller.FinalResponse(context.Context) (DeploymentsClientValidateAtSubscriptionScopeResponse, error)` +- New function `*ClientMoveResourcesPoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidateAtScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidatePoller.ResumeToken() (string, error)` +- New function `DeploymentsClientWhatIfAtTenantScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientWhatIfAtTenantScopeResponse, error)` +- New function `*ClientUpdateByIDPoller.FinalResponse(context.Context) (ClientUpdateByIDResponse, error)` +- New function `*ClientCreateOrUpdateByIDPoller.FinalResponse(context.Context) (ClientCreateOrUpdateByIDResponse, error)` +- New function `ClientMoveResourcesPollerResponse.PollUntilDone(context.Context, time.Duration) (ClientMoveResourcesResponse, error)` +- New function `*DeploymentsClientDeleteAtTenantScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientWhatIfAtTenantScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `DeploymentsClientValidatePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientValidateResponse, error)` +- New function `*Client.CheckExistenceByID(context.Context, string, string, *ClientCheckExistenceByIDOptions) (ClientCheckExistenceByIDResponse, error)` +- New function `*ResourceGroupsClientDeletePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientValidateMoveResourcesPoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientDeleteAtScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ResourceGroupsClientDeletePoller.Done() bool` +- New function `*TagsClientListPager.PageResponse() TagsClientListResponse` +- New function `*Client.Get(context.Context, string, string, string, string, string, string, *ClientGetOptions) (ClientGetResponse, error)` +- New function `*ResourceGroupsClientExportTemplatePoller.Done() bool` +- New function `*DeploymentsClientDeleteAtScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*ClientUpdatePoller.FinalResponse(context.Context) (ClientUpdateResponse, error)` +- New function `*ClientCreateOrUpdateByIDPoller.Done() bool` +- New function `*ClientUpdatePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.FinalResponse(context.Context) (DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse, error)` +- New function `ClientDeleteByIDPollerResponse.PollUntilDone(context.Context, time.Duration) (ClientDeleteByIDResponse, error)` +- New function `*DeploymentsClientDeleteAtTenantScopePoller.FinalResponse(context.Context) (DeploymentsClientDeleteAtTenantScopeResponse, error)` +- New function `*DeploymentsClientDeleteAtSubscriptionScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientDeleteAtTenantScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientDeleteAtTenantScopePoller.Done() bool` +- New function `*Client.List(*ClientListOptions) *ClientListPager` +- New function `*DeploymentOperationsClientListPager.PageResponse() DeploymentOperationsClientListResponse` +- New function `*DeploymentOperationsClientListAtSubscriptionScopePager.PageResponse() DeploymentOperationsClientListAtSubscriptionScopeResponse` +- New function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.FinalResponse(context.Context) (DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse, error)` +- New function `*ClientCreateOrUpdateByIDPollerResponse.Resume(context.Context, *Client, string) error` +- New function `*DeploymentsClientDeletePoller.Done() bool` +- New function `*DeploymentsClientDeleteAtManagementGroupScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `DeploymentsClientValidateAtSubscriptionScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientValidateAtSubscriptionScopeResponse, error)` +- New function `*DeploymentOperationsClientListPager.NextPage(context.Context) bool` +- New function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.FinalResponse(context.Context) (DeploymentsClientWhatIfAtSubscriptionScopeResponse, error)` +- New function `*ResourceGroupsClientDeletePoller.ResumeToken() (string, error)` +- New function `*Client.GetByID(context.Context, string, string, *ClientGetByIDOptions) (ClientGetByIDResponse, error)` +- New function `*Client.CheckExistence(context.Context, string, string, string, string, string, string, *ClientCheckExistenceOptions) (ClientCheckExistenceResponse, error)` +- New function `*DeploymentsClientDeleteAtManagementGroupScopePoller.Done() bool` +- New function `*ClientDeletePoller.Done() bool` +- New function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.Done() bool` +- New function `*DeploymentsClientWhatIfPoller.Done() bool` +- New function `*ResourceGroupsClientExportTemplatePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientDeletePoller.FinalResponse(context.Context) (DeploymentsClientDeleteResponse, error)` +- New function `*ClientCreateOrUpdatePoller.Done() bool` +- New function `*DeploymentsClientCreateOrUpdateAtScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientWhatIfPoller.FinalResponse(context.Context) (DeploymentsClientWhatIfResponse, error)` +- New function `*DeploymentsClientValidateAtManagementGroupScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientValidateMoveResourcesPoller.Done() bool` +- New function `*DeploymentsClientValidateAtManagementGroupScopePoller.Done() bool` +- New function `*Client.BeginDelete(context.Context, string, string, string, string, string, string, *ClientBeginDeleteOptions) (ClientDeletePollerResponse, error)` +- New function `*OperationsClientListPager.PageResponse() OperationsClientListResponse` +- New function `*ClientListPager.Err() error` +- New function `*ClientDeletePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientValidateAtScopePoller.Done() bool` +- New function `*DeploymentsClientDeleteAtSubscriptionScopePoller.FinalResponse(context.Context) (DeploymentsClientDeleteAtSubscriptionScopeResponse, error)` +- New function `*Client.BeginMoveResources(context.Context, string, MoveInfo, *ClientBeginMoveResourcesOptions) (ClientMoveResourcesPollerResponse, error)` +- New function `DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse, error)` +- New function `*DeploymentsClientListAtScopePager.Err() error` +- New function `*DeploymentsClientDeleteAtScopePoller.ResumeToken() (string, error)` +- New function `*ClientListByResourceGroupPager.PageResponse() ClientListByResourceGroupResponse` +- New function `*DeploymentsClientListAtManagementGroupScopePager.NextPage(context.Context) bool` +- New function `*ProvidersClientListPager.Err() error` +- New function `*ClientDeleteByIDPoller.Done() bool` +- New function `DeploymentsClientCreateOrUpdatePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientCreateOrUpdateResponse, error)` +- New function `*DeploymentsClientListByResourceGroupPager.PageResponse() DeploymentsClientListByResourceGroupResponse` +- New function `*ClientMoveResourcesPoller.FinalResponse(context.Context) (ClientMoveResourcesResponse, error)` +- New function `*DeploymentsClientValidatePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientListAtSubscriptionScopePager.Err() error` +- New function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidateAtSubscriptionScopePoller.ResumeToken() (string, error)` +- New function `ZoneMapping.MarshalJSON() ([]byte, error)` +- New function `ClientValidateMoveResourcesPollerResponse.PollUntilDone(context.Context, time.Duration) (ClientValidateMoveResourcesResponse, error)` +- New function `DeploymentsClientDeleteAtTenantScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientDeleteAtTenantScopeResponse, error)` +- New function `*ClientMoveResourcesPoller.Done() bool` +- New function `NewClient(string, azcore.TokenCredential, *arm.ClientOptions) *Client` +- New function `*DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller.Done() bool` +- New function `DeploymentsClientCreateOrUpdateAtScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientCreateOrUpdateAtScopeResponse, error)` +- New function `*DeploymentOperationsClientListAtScopePager.PageResponse() DeploymentOperationsClientListAtScopeResponse` +- New function `*DeploymentsClientWhatIfAtSubscriptionScopePoller.Done() bool` +- New function `*DeploymentsClientListAtTenantScopePager.Err() error` +- New function `*DeploymentsClientValidateAtTenantScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientValidateAtTenantScopePoller.FinalResponse(context.Context) (DeploymentsClientValidateAtTenantScopeResponse, error)` +- New function `ClientDeletePollerResponse.PollUntilDone(context.Context, time.Duration) (ClientDeleteResponse, error)` +- New function `*DeploymentsClientDeleteAtManagementGroupScopePoller.FinalResponse(context.Context) (DeploymentsClientDeleteAtManagementGroupScopeResponse, error)` +- New function `*ClientValidateMoveResourcesPoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `DeploymentsClientDeleteAtManagementGroupScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientDeleteAtManagementGroupScopeResponse, error)` +- New function `*ClientMoveResourcesPollerResponse.Resume(context.Context, *Client, string) error` +- New function `*DeploymentsClientValidateAtScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*ClientListPager.PageResponse() ClientListResponse` +- New function `*DeploymentOperationsClientListAtManagementGroupScopePager.Err() error` +- New function `*DeploymentsClientDeletePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*ResourceGroupsClientDeletePoller.FinalResponse(context.Context) (ResourceGroupsClientDeleteResponse, error)` +- New function `*DeploymentsClientDeleteAtTenantScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientUpdateByIDPoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientWhatIfAtManagementGroupScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `ClientCreateOrUpdateByIDPollerResponse.PollUntilDone(context.Context, time.Duration) (ClientCreateOrUpdateByIDResponse, error)` +- New function `*ClientDeleteByIDPoller.Poll(context.Context) (*http.Response, error)` +- New function `*ClientDeleteByIDPoller.FinalResponse(context.Context) (ClientDeleteByIDResponse, error)` +- New function `*DeploymentOperationsClientListAtManagementGroupScopePager.PageResponse() DeploymentOperationsClientListAtManagementGroupScopeResponse` +- New function `*DeploymentsClientWhatIfAtManagementGroupScopePoller.ResumeToken() (string, error)` +- New function `MoveInfo.MarshalJSON() ([]byte, error)` +- New function `*ClientCreateOrUpdatePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientDeleteAtSubscriptionScopePoller.Done() bool` +- New function `DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse, error)` +- New function `*DeploymentOperationsClientListAtSubscriptionScopePager.NextPage(context.Context) bool` +- New function `*DeploymentsClientValidatePoller.FinalResponse(context.Context) (DeploymentsClientValidateResponse, error)` +- New function `*DeploymentsClientWhatIfPollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `*DeploymentsClientWhatIfAtTenantScopePoller.Done() bool` +- New function `*DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller.ResumeToken() (string, error)` +- New function `*DeploymentsClientWhatIfAtTenantScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `DeploymentsClientValidateAtTenantScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientValidateAtTenantScopeResponse, error)` +- New function `*DeploymentsClientCreateOrUpdateAtScopePoller.Done() bool` +- New function `*DeploymentsClientListAtTenantScopePager.PageResponse() DeploymentsClientListAtTenantScopeResponse` +- New function `ResourceGroupsClientExportTemplatePollerResponse.PollUntilDone(context.Context, time.Duration) (ResourceGroupsClientExportTemplateResponse, error)` +- New function `*ProvidersClientListPager.NextPage(context.Context) bool` +- New function `*DeploymentsClientValidateAtSubscriptionScopePollerResponse.Resume(context.Context, *DeploymentsClient, string) error` +- New function `DeploymentsClientValidateAtScopePollerResponse.PollUntilDone(context.Context, time.Duration) (DeploymentsClientValidateAtScopeResponse, error)` +- New function `*ClientCreateOrUpdatePoller.Poll(context.Context) (*http.Response, error)` +- New function `*DeploymentsClientValidateAtTenantScopePoller.Poll(context.Context) (*http.Response, error)` +- New function `*ResourceGroupsClientListPager.NextPage(context.Context) bool` +- New function `*ClientUpdatePoller.Done() bool` +- New struct `Client` +- New struct `ClientBeginCreateOrUpdateByIDOptions` +- New struct `ClientBeginCreateOrUpdateOptions` +- New struct `ClientBeginDeleteByIDOptions` +- New struct `ClientBeginDeleteOptions` +- New struct `ClientBeginMoveResourcesOptions` +- New struct `ClientBeginUpdateByIDOptions` +- New struct `ClientBeginUpdateOptions` +- New struct `ClientBeginValidateMoveResourcesOptions` +- New struct `ClientCheckExistenceByIDOptions` +- New struct `ClientCheckExistenceByIDResponse` +- New struct `ClientCheckExistenceByIDResult` +- New struct `ClientCheckExistenceOptions` +- New struct `ClientCheckExistenceResponse` +- New struct `ClientCheckExistenceResult` +- New struct `ClientCreateOrUpdateByIDPoller` +- New struct `ClientCreateOrUpdateByIDPollerResponse` +- New struct `ClientCreateOrUpdateByIDResponse` +- New struct `ClientCreateOrUpdateByIDResult` +- New struct `ClientCreateOrUpdatePoller` +- New struct `ClientCreateOrUpdatePollerResponse` +- New struct `ClientCreateOrUpdateResponse` +- New struct `ClientCreateOrUpdateResult` +- New struct `ClientDeleteByIDPoller` +- New struct `ClientDeleteByIDPollerResponse` +- New struct `ClientDeleteByIDResponse` +- New struct `ClientDeletePoller` +- New struct `ClientDeletePollerResponse` +- New struct `ClientDeleteResponse` +- New struct `ClientGetByIDOptions` +- New struct `ClientGetByIDResponse` +- New struct `ClientGetByIDResult` +- New struct `ClientGetOptions` +- New struct `ClientGetResponse` +- New struct `ClientGetResult` +- New struct `ClientListByResourceGroupOptions` +- New struct `ClientListByResourceGroupPager` +- New struct `ClientListByResourceGroupResponse` +- New struct `ClientListByResourceGroupResult` +- New struct `ClientListOptions` +- New struct `ClientListPager` +- New struct `ClientListResponse` +- New struct `ClientListResult` +- New struct `ClientMoveResourcesPoller` +- New struct `ClientMoveResourcesPollerResponse` +- New struct `ClientMoveResourcesResponse` +- New struct `ClientUpdateByIDPoller` +- New struct `ClientUpdateByIDPollerResponse` +- New struct `ClientUpdateByIDResponse` +- New struct `ClientUpdateByIDResult` +- New struct `ClientUpdatePoller` +- New struct `ClientUpdatePollerResponse` +- New struct `ClientUpdateResponse` +- New struct `ClientUpdateResult` +- New struct `ClientValidateMoveResourcesPoller` +- New struct `ClientValidateMoveResourcesPollerResponse` +- New struct `ClientValidateMoveResourcesResponse` +- New struct `DeploymentOperationsClientGetAtManagementGroupScopeOptions` +- New struct `DeploymentOperationsClientGetAtManagementGroupScopeResponse` +- New struct `DeploymentOperationsClientGetAtManagementGroupScopeResult` +- New struct `DeploymentOperationsClientGetAtScopeOptions` +- New struct `DeploymentOperationsClientGetAtScopeResponse` +- New struct `DeploymentOperationsClientGetAtScopeResult` +- New struct `DeploymentOperationsClientGetAtSubscriptionScopeOptions` +- New struct `DeploymentOperationsClientGetAtSubscriptionScopeResponse` +- New struct `DeploymentOperationsClientGetAtSubscriptionScopeResult` +- New struct `DeploymentOperationsClientGetAtTenantScopeOptions` +- New struct `DeploymentOperationsClientGetAtTenantScopeResponse` +- New struct `DeploymentOperationsClientGetAtTenantScopeResult` +- New struct `DeploymentOperationsClientGetOptions` +- New struct `DeploymentOperationsClientGetResponse` +- New struct `DeploymentOperationsClientGetResult` +- New struct `DeploymentOperationsClientListAtManagementGroupScopeOptions` +- New struct `DeploymentOperationsClientListAtManagementGroupScopePager` +- New struct `DeploymentOperationsClientListAtManagementGroupScopeResponse` +- New struct `DeploymentOperationsClientListAtManagementGroupScopeResult` +- New struct `DeploymentOperationsClientListAtScopeOptions` +- New struct `DeploymentOperationsClientListAtScopePager` +- New struct `DeploymentOperationsClientListAtScopeResponse` +- New struct `DeploymentOperationsClientListAtScopeResult` +- New struct `DeploymentOperationsClientListAtSubscriptionScopeOptions` +- New struct `DeploymentOperationsClientListAtSubscriptionScopePager` +- New struct `DeploymentOperationsClientListAtSubscriptionScopeResponse` +- New struct `DeploymentOperationsClientListAtSubscriptionScopeResult` +- New struct `DeploymentOperationsClientListAtTenantScopeOptions` +- New struct `DeploymentOperationsClientListAtTenantScopePager` +- New struct `DeploymentOperationsClientListAtTenantScopeResponse` +- New struct `DeploymentOperationsClientListAtTenantScopeResult` +- New struct `DeploymentOperationsClientListOptions` +- New struct `DeploymentOperationsClientListPager` +- New struct `DeploymentOperationsClientListResponse` +- New struct `DeploymentOperationsClientListResult` +- New struct `DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions` +- New struct `DeploymentsClientBeginCreateOrUpdateAtScopeOptions` +- New struct `DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions` +- New struct `DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions` +- New struct `DeploymentsClientBeginCreateOrUpdateOptions` +- New struct `DeploymentsClientBeginDeleteAtManagementGroupScopeOptions` +- New struct `DeploymentsClientBeginDeleteAtScopeOptions` +- New struct `DeploymentsClientBeginDeleteAtSubscriptionScopeOptions` +- New struct `DeploymentsClientBeginDeleteAtTenantScopeOptions` +- New struct `DeploymentsClientBeginDeleteOptions` +- New struct `DeploymentsClientBeginValidateAtManagementGroupScopeOptions` +- New struct `DeploymentsClientBeginValidateAtScopeOptions` +- New struct `DeploymentsClientBeginValidateAtSubscriptionScopeOptions` +- New struct `DeploymentsClientBeginValidateAtTenantScopeOptions` +- New struct `DeploymentsClientBeginValidateOptions` +- New struct `DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions` +- New struct `DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions` +- New struct `DeploymentsClientBeginWhatIfAtTenantScopeOptions` +- New struct `DeploymentsClientBeginWhatIfOptions` +- New struct `DeploymentsClientCalculateTemplateHashOptions` +- New struct `DeploymentsClientCalculateTemplateHashResponse` +- New struct `DeploymentsClientCalculateTemplateHashResult` +- New struct `DeploymentsClientCancelAtManagementGroupScopeOptions` +- New struct `DeploymentsClientCancelAtManagementGroupScopeResponse` +- New struct `DeploymentsClientCancelAtScopeOptions` +- New struct `DeploymentsClientCancelAtScopeResponse` +- New struct `DeploymentsClientCancelAtSubscriptionScopeOptions` +- New struct `DeploymentsClientCancelAtSubscriptionScopeResponse` +- New struct `DeploymentsClientCancelAtTenantScopeOptions` +- New struct `DeploymentsClientCancelAtTenantScopeResponse` +- New struct `DeploymentsClientCancelOptions` +- New struct `DeploymentsClientCancelResponse` +- New struct `DeploymentsClientCheckExistenceAtManagementGroupScopeOptions` +- New struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResponse` +- New struct `DeploymentsClientCheckExistenceAtManagementGroupScopeResult` +- New struct `DeploymentsClientCheckExistenceAtScopeOptions` +- New struct `DeploymentsClientCheckExistenceAtScopeResponse` +- New struct `DeploymentsClientCheckExistenceAtScopeResult` +- New struct `DeploymentsClientCheckExistenceAtSubscriptionScopeOptions` +- New struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResponse` +- New struct `DeploymentsClientCheckExistenceAtSubscriptionScopeResult` +- New struct `DeploymentsClientCheckExistenceAtTenantScopeOptions` +- New struct `DeploymentsClientCheckExistenceAtTenantScopeResponse` +- New struct `DeploymentsClientCheckExistenceAtTenantScopeResult` +- New struct `DeploymentsClientCheckExistenceOptions` +- New struct `DeploymentsClientCheckExistenceResponse` +- New struct `DeploymentsClientCheckExistenceResult` +- New struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopePoller` +- New struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopePollerResponse` +- New struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse` +- New struct `DeploymentsClientCreateOrUpdateAtManagementGroupScopeResult` +- New struct `DeploymentsClientCreateOrUpdateAtScopePoller` +- New struct `DeploymentsClientCreateOrUpdateAtScopePollerResponse` +- New struct `DeploymentsClientCreateOrUpdateAtScopeResponse` +- New struct `DeploymentsClientCreateOrUpdateAtScopeResult` +- New struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopePoller` +- New struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopePollerResponse` +- New struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse` +- New struct `DeploymentsClientCreateOrUpdateAtSubscriptionScopeResult` +- New struct `DeploymentsClientCreateOrUpdateAtTenantScopePoller` +- New struct `DeploymentsClientCreateOrUpdateAtTenantScopePollerResponse` +- New struct `DeploymentsClientCreateOrUpdateAtTenantScopeResponse` +- New struct `DeploymentsClientCreateOrUpdateAtTenantScopeResult` +- New struct `DeploymentsClientCreateOrUpdatePoller` +- New struct `DeploymentsClientCreateOrUpdatePollerResponse` +- New struct `DeploymentsClientCreateOrUpdateResponse` +- New struct `DeploymentsClientCreateOrUpdateResult` +- New struct `DeploymentsClientDeleteAtManagementGroupScopePoller` +- New struct `DeploymentsClientDeleteAtManagementGroupScopePollerResponse` +- New struct `DeploymentsClientDeleteAtManagementGroupScopeResponse` +- New struct `DeploymentsClientDeleteAtScopePoller` +- New struct `DeploymentsClientDeleteAtScopePollerResponse` +- New struct `DeploymentsClientDeleteAtScopeResponse` +- New struct `DeploymentsClientDeleteAtSubscriptionScopePoller` +- New struct `DeploymentsClientDeleteAtSubscriptionScopePollerResponse` +- New struct `DeploymentsClientDeleteAtSubscriptionScopeResponse` +- New struct `DeploymentsClientDeleteAtTenantScopePoller` +- New struct `DeploymentsClientDeleteAtTenantScopePollerResponse` +- New struct `DeploymentsClientDeleteAtTenantScopeResponse` +- New struct `DeploymentsClientDeletePoller` +- New struct `DeploymentsClientDeletePollerResponse` +- New struct `DeploymentsClientDeleteResponse` +- New struct `DeploymentsClientExportTemplateAtManagementGroupScopeOptions` +- New struct `DeploymentsClientExportTemplateAtManagementGroupScopeResponse` +- New struct `DeploymentsClientExportTemplateAtManagementGroupScopeResult` +- New struct `DeploymentsClientExportTemplateAtScopeOptions` +- New struct `DeploymentsClientExportTemplateAtScopeResponse` +- New struct `DeploymentsClientExportTemplateAtScopeResult` +- New struct `DeploymentsClientExportTemplateAtSubscriptionScopeOptions` +- New struct `DeploymentsClientExportTemplateAtSubscriptionScopeResponse` +- New struct `DeploymentsClientExportTemplateAtSubscriptionScopeResult` +- New struct `DeploymentsClientExportTemplateAtTenantScopeOptions` +- New struct `DeploymentsClientExportTemplateAtTenantScopeResponse` +- New struct `DeploymentsClientExportTemplateAtTenantScopeResult` +- New struct `DeploymentsClientExportTemplateOptions` +- New struct `DeploymentsClientExportTemplateResponse` +- New struct `DeploymentsClientExportTemplateResult` +- New struct `DeploymentsClientGetAtManagementGroupScopeOptions` +- New struct `DeploymentsClientGetAtManagementGroupScopeResponse` +- New struct `DeploymentsClientGetAtManagementGroupScopeResult` +- New struct `DeploymentsClientGetAtScopeOptions` +- New struct `DeploymentsClientGetAtScopeResponse` +- New struct `DeploymentsClientGetAtScopeResult` +- New struct `DeploymentsClientGetAtSubscriptionScopeOptions` +- New struct `DeploymentsClientGetAtSubscriptionScopeResponse` +- New struct `DeploymentsClientGetAtSubscriptionScopeResult` +- New struct `DeploymentsClientGetAtTenantScopeOptions` +- New struct `DeploymentsClientGetAtTenantScopeResponse` +- New struct `DeploymentsClientGetAtTenantScopeResult` +- New struct `DeploymentsClientGetOptions` +- New struct `DeploymentsClientGetResponse` +- New struct `DeploymentsClientGetResult` +- New struct `DeploymentsClientListAtManagementGroupScopeOptions` +- New struct `DeploymentsClientListAtManagementGroupScopePager` +- New struct `DeploymentsClientListAtManagementGroupScopeResponse` +- New struct `DeploymentsClientListAtManagementGroupScopeResult` +- New struct `DeploymentsClientListAtScopeOptions` +- New struct `DeploymentsClientListAtScopePager` +- New struct `DeploymentsClientListAtScopeResponse` +- New struct `DeploymentsClientListAtScopeResult` +- New struct `DeploymentsClientListAtSubscriptionScopeOptions` +- New struct `DeploymentsClientListAtSubscriptionScopePager` +- New struct `DeploymentsClientListAtSubscriptionScopeResponse` +- New struct `DeploymentsClientListAtSubscriptionScopeResult` +- New struct `DeploymentsClientListAtTenantScopeOptions` +- New struct `DeploymentsClientListAtTenantScopePager` +- New struct `DeploymentsClientListAtTenantScopeResponse` +- New struct `DeploymentsClientListAtTenantScopeResult` +- New struct `DeploymentsClientListByResourceGroupOptions` +- New struct `DeploymentsClientListByResourceGroupPager` +- New struct `DeploymentsClientListByResourceGroupResponse` +- New struct `DeploymentsClientListByResourceGroupResult` +- New struct `DeploymentsClientValidateAtManagementGroupScopePoller` +- New struct `DeploymentsClientValidateAtManagementGroupScopePollerResponse` +- New struct `DeploymentsClientValidateAtManagementGroupScopeResponse` +- New struct `DeploymentsClientValidateAtManagementGroupScopeResult` +- New struct `DeploymentsClientValidateAtScopePoller` +- New struct `DeploymentsClientValidateAtScopePollerResponse` +- New struct `DeploymentsClientValidateAtScopeResponse` +- New struct `DeploymentsClientValidateAtScopeResult` +- New struct `DeploymentsClientValidateAtSubscriptionScopePoller` +- New struct `DeploymentsClientValidateAtSubscriptionScopePollerResponse` +- New struct `DeploymentsClientValidateAtSubscriptionScopeResponse` +- New struct `DeploymentsClientValidateAtSubscriptionScopeResult` +- New struct `DeploymentsClientValidateAtTenantScopePoller` +- New struct `DeploymentsClientValidateAtTenantScopePollerResponse` +- New struct `DeploymentsClientValidateAtTenantScopeResponse` +- New struct `DeploymentsClientValidateAtTenantScopeResult` +- New struct `DeploymentsClientValidatePoller` +- New struct `DeploymentsClientValidatePollerResponse` +- New struct `DeploymentsClientValidateResponse` +- New struct `DeploymentsClientValidateResult` +- New struct `DeploymentsClientWhatIfAtManagementGroupScopePoller` +- New struct `DeploymentsClientWhatIfAtManagementGroupScopePollerResponse` +- New struct `DeploymentsClientWhatIfAtManagementGroupScopeResponse` +- New struct `DeploymentsClientWhatIfAtManagementGroupScopeResult` +- New struct `DeploymentsClientWhatIfAtSubscriptionScopePoller` +- New struct `DeploymentsClientWhatIfAtSubscriptionScopePollerResponse` +- New struct `DeploymentsClientWhatIfAtSubscriptionScopeResponse` +- New struct `DeploymentsClientWhatIfAtSubscriptionScopeResult` +- New struct `DeploymentsClientWhatIfAtTenantScopePoller` +- New struct `DeploymentsClientWhatIfAtTenantScopePollerResponse` +- New struct `DeploymentsClientWhatIfAtTenantScopeResponse` +- New struct `DeploymentsClientWhatIfAtTenantScopeResult` +- New struct `DeploymentsClientWhatIfPoller` +- New struct `DeploymentsClientWhatIfPollerResponse` +- New struct `DeploymentsClientWhatIfResponse` +- New struct `DeploymentsClientWhatIfResult` +- New struct `MoveInfo` +- New struct `OperationsClientListOptions` +- New struct `OperationsClientListPager` +- New struct `OperationsClientListResponse` +- New struct `OperationsClientListResult` +- New struct `ProviderResourceTypesClientListOptions` +- New struct `ProviderResourceTypesClientListResponse` +- New struct `ProviderResourceTypesClientListResult` +- New struct `ProvidersClientGetAtTenantScopeOptions` +- New struct `ProvidersClientGetAtTenantScopeResponse` +- New struct `ProvidersClientGetAtTenantScopeResult` +- New struct `ProvidersClientGetOptions` +- New struct `ProvidersClientGetResponse` +- New struct `ProvidersClientGetResult` +- New struct `ProvidersClientListAtTenantScopeOptions` +- New struct `ProvidersClientListAtTenantScopePager` +- New struct `ProvidersClientListAtTenantScopeResponse` +- New struct `ProvidersClientListAtTenantScopeResult` +- New struct `ProvidersClientListOptions` +- New struct `ProvidersClientListPager` +- New struct `ProvidersClientListResponse` +- New struct `ProvidersClientListResult` +- New struct `ProvidersClientProviderPermissionsOptions` +- New struct `ProvidersClientProviderPermissionsResponse` +- New struct `ProvidersClientProviderPermissionsResult` +- New struct `ProvidersClientRegisterAtManagementGroupScopeOptions` +- New struct `ProvidersClientRegisterAtManagementGroupScopeResponse` +- New struct `ProvidersClientRegisterOptions` +- New struct `ProvidersClientRegisterResponse` +- New struct `ProvidersClientRegisterResult` +- New struct `ProvidersClientUnregisterOptions` +- New struct `ProvidersClientUnregisterResponse` +- New struct `ProvidersClientUnregisterResult` +- New struct `ResourceGroupsClientBeginDeleteOptions` +- New struct `ResourceGroupsClientBeginExportTemplateOptions` +- New struct `ResourceGroupsClientCheckExistenceOptions` +- New struct `ResourceGroupsClientCheckExistenceResponse` +- New struct `ResourceGroupsClientCheckExistenceResult` +- New struct `ResourceGroupsClientCreateOrUpdateOptions` +- New struct `ResourceGroupsClientCreateOrUpdateResponse` +- New struct `ResourceGroupsClientCreateOrUpdateResult` +- New struct `ResourceGroupsClientDeletePoller` +- New struct `ResourceGroupsClientDeletePollerResponse` +- New struct `ResourceGroupsClientDeleteResponse` +- New struct `ResourceGroupsClientExportTemplatePoller` +- New struct `ResourceGroupsClientExportTemplatePollerResponse` +- New struct `ResourceGroupsClientExportTemplateResponse` +- New struct `ResourceGroupsClientExportTemplateResult` +- New struct `ResourceGroupsClientGetOptions` +- New struct `ResourceGroupsClientGetResponse` +- New struct `ResourceGroupsClientGetResult` +- New struct `ResourceGroupsClientListOptions` +- New struct `ResourceGroupsClientListPager` +- New struct `ResourceGroupsClientListResponse` +- New struct `ResourceGroupsClientListResult` +- New struct `ResourceGroupsClientUpdateOptions` +- New struct `ResourceGroupsClientUpdateResponse` +- New struct `ResourceGroupsClientUpdateResult` +- New struct `TagsClientCreateOrUpdateAtScopeOptions` +- New struct `TagsClientCreateOrUpdateAtScopeResponse` +- New struct `TagsClientCreateOrUpdateAtScopeResult` +- New struct `TagsClientCreateOrUpdateOptions` +- New struct `TagsClientCreateOrUpdateResponse` +- New struct `TagsClientCreateOrUpdateResult` +- New struct `TagsClientCreateOrUpdateValueOptions` +- New struct `TagsClientCreateOrUpdateValueResponse` +- New struct `TagsClientCreateOrUpdateValueResult` +- New struct `TagsClientDeleteAtScopeOptions` +- New struct `TagsClientDeleteAtScopeResponse` +- New struct `TagsClientDeleteOptions` +- New struct `TagsClientDeleteResponse` +- New struct `TagsClientDeleteValueOptions` +- New struct `TagsClientDeleteValueResponse` +- New struct `TagsClientGetAtScopeOptions` +- New struct `TagsClientGetAtScopeResponse` +- New struct `TagsClientGetAtScopeResult` +- New struct `TagsClientListOptions` +- New struct `TagsClientListPager` +- New struct `TagsClientListResponse` +- New struct `TagsClientListResult` +- New struct `TagsClientUpdateAtScopeOptions` +- New struct `TagsClientUpdateAtScopeResponse` +- New struct `TagsClientUpdateAtScopeResult` +- New struct `ZoneMapping` +- New field `ZoneMappings` in struct `ProviderResourceType` +- New field `Tags` in struct `GenericResource` +- New field `Location` in struct `GenericResource` +- New field `ExtendedLocation` in struct `GenericResource` +- New field `ID` in struct `GenericResource` +- New field `Name` in struct `GenericResource` +- New field `Type` in struct `GenericResource` +- New field `Parameters` in struct `DeploymentWhatIfProperties` +- New field `TemplateLink` in struct `DeploymentWhatIfProperties` +- New field `ExpressionEvaluationOptions` in struct `DeploymentWhatIfProperties` +- New field `OnErrorDeployment` in struct `DeploymentWhatIfProperties` +- New field `ParametersLink` in struct `DeploymentWhatIfProperties` +- New field `Template` in struct `DeploymentWhatIfProperties` +- New field `Mode` in struct `DeploymentWhatIfProperties` +- New field `DebugSetting` in struct `DeploymentWhatIfProperties` +- New field `ExtendedLocation` in struct `GenericResourceExpanded` +- New field `Kind` in struct `GenericResourceExpanded` +- New field `SKU` in struct `GenericResourceExpanded` +- New field `ID` in struct `GenericResourceExpanded` +- New field `Name` in struct `GenericResourceExpanded` +- New field `Identity` in struct `GenericResourceExpanded` +- New field `ManagedBy` in struct `GenericResourceExpanded` +- New field `Location` in struct `GenericResourceExpanded` +- New field `Properties` in struct `GenericResourceExpanded` +- New field `Plan` in struct `GenericResourceExpanded` +- New field `Tags` in struct `GenericResourceExpanded` +- New field `Type` in struct `GenericResourceExpanded` +- New field `Error` in struct `CloudError` + + +## 0.2.1 (2021-11-26) + +### Other Changes + +- Now use `github.com/Azure/azure-sdk-for-go/sdk/azidentity@v0.12.0` explicitly. + +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + +## 0.1.0 (2021-09-30) +- To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/resources/armresources") to avoid confusion. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md new file mode 100644 index 000000000..a97797f03 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/README.md @@ -0,0 +1,84 @@ +# Azure Resources Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources) + +The `armresources` module provides operations for working with Azure Resources. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/resources/armresources) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Resources module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Resources. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Resources modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. + +```go +client, err := armresources.NewClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armresources.NewClient(, cred, &options) +``` + +## More sample code + +- [Deployment](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/deployment) +- [Provider](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/provider) +- [Resource Group](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/resourcegroups) +- [Resource](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/resource/resources) + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Resources` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md new file mode 100644 index 000000000..5c5c21c31 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 +package-resources: true +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/build.go new file mode 100644 index 000000000..7fc2762e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/resources/armresources + +package armresources diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/ci.yml new file mode 100644 index 000000000..bf846e65b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/resources/armresources/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/resources/armresources/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/resources/armresources' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_client.go new file mode 100644 index 000000000..dda59a680 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_client.go @@ -0,0 +1,910 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// Client contains the methods for the Resources group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewClient creates a new instance of Client with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &Client{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckExistence - Checks whether a resource exists. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group containing the resource to check. The name is case insensitive. +// resourceProviderNamespace - The resource provider of the resource to check. +// parentResourcePath - The parent resource identity. +// resourceType - The resource type. +// resourceName - The name of the resource to check whether it exists. +// apiVersion - The API version to use for the operation. +// options - ClientCheckExistenceOptions contains the optional parameters for the Client.CheckExistence method. +func (client *Client) CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientCheckExistenceOptions) (ClientCheckExistenceResponse, error) { + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return ClientCheckExistenceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return ClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + } + return ClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceCreateRequest creates the CheckExistence request. +func (client *Client) checkExistenceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientCheckExistenceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistenceByID - Checks by ID whether a resource exists. +// Generated from API version 2021-04-01 +// resourceID - The fully qualified ID of the resource, including the resource name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// apiVersion - The API version to use for the operation. +// options - ClientCheckExistenceByIDOptions contains the optional parameters for the Client.CheckExistenceByID method. +func (client *Client) CheckExistenceByID(ctx context.Context, resourceID string, apiVersion string, options *ClientCheckExistenceByIDOptions) (ClientCheckExistenceByIDResponse, error) { + req, err := client.checkExistenceByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return ClientCheckExistenceByIDResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientCheckExistenceByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return ClientCheckExistenceByIDResponse{}, runtime.NewResponseError(resp) + } + return ClientCheckExistenceByIDResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceByIDCreateRequest creates the CheckExistenceByID request. +func (client *Client) checkExistenceByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ClientCheckExistenceByIDOptions) (*policy.Request, error) { + urlPath := "/{resourceId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Creates a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - The namespace of the resource provider. +// parentResourcePath - The parent resource identity. +// resourceType - The resource type of the resource to create. +// resourceName - The name of the resource to create. +// apiVersion - The API version to use for the operation. +// parameters - Parameters for creating or updating the resource. +// options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdateByID - Create a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceID - The fully qualified ID of the resource, including the resource name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// apiVersion - The API version to use for the operation. +// parameters - Create or update resource parameters. +// options - ClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the Client.BeginCreateOrUpdateByID +// method. +func (client *Client) BeginCreateOrUpdateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateByIDOptions) (*runtime.Poller[ClientCreateOrUpdateByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateByID(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientCreateOrUpdateByIDResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateByIDResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateByID - Create a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) createOrUpdateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateByIDOptions) (*http.Response, error) { + req, err := client.createOrUpdateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *Client) createOrUpdateByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{resourceId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group that contains the resource to delete. The name is case insensitive. +// resourceProviderNamespace - The namespace of the resource provider. +// parentResourcePath - The parent resource identity. +// resourceType - The resource type. +// resourceName - The name of the resource to delete. +// apiVersion - The API version to use for the operation. +// options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteByID - Deletes a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceID - The fully qualified ID of the resource, including the resource name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// apiVersion - The API version to use for the operation. +// options - ClientBeginDeleteByIDOptions contains the optional parameters for the Client.BeginDeleteByID method. +func (client *Client) BeginDeleteByID(ctx context.Context, resourceID string, apiVersion string, options *ClientBeginDeleteByIDOptions) (*runtime.Poller[ClientDeleteByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteByID(ctx, resourceID, apiVersion, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientDeleteByIDResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientDeleteByIDResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteByID - Deletes a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) deleteByID(ctx context.Context, resourceID string, apiVersion string, options *ClientBeginDeleteByIDOptions) (*http.Response, error) { + req, err := client.deleteByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *Client) deleteByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ClientBeginDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{resourceId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group containing the resource to get. The name is case insensitive. +// resourceProviderNamespace - The namespace of the resource provider. +// parentResourcePath - The parent resource identity. +// resourceType - The resource type of the resource. +// resourceName - The name of the resource to get. +// apiVersion - The API version to use for the operation. +// options - ClientGetOptions contains the optional parameters for the Client.Get method. +func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientGetOptions) (ClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) + if err != nil { + return ClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, options *ClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { + result := ClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GenericResource); err != nil { + return ClientGetResponse{}, err + } + return result, nil +} + +// GetByID - Gets a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceID - The fully qualified ID of the resource, including the resource name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// apiVersion - The API version to use for the operation. +// options - ClientGetByIDOptions contains the optional parameters for the Client.GetByID method. +func (client *Client) GetByID(ctx context.Context, resourceID string, apiVersion string, options *ClientGetByIDOptions) (ClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, resourceID, apiVersion, options) + if err != nil { + return ClientGetByIDResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *Client) getByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{resourceId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *Client) getByIDHandleResponse(resp *http.Response) (ClientGetByIDResponse, error) { + result := ClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GenericResource); err != nil { + return ClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get all the resources in a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - ClientListOptions contains the optional parameters for the Client.List method. +func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ClientListResponse]{ + More: func(page ClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *Client) listCreateRequest(ctx context.Context, options *ClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *Client) listHandleResponse(resp *http.Response) (ClientListResponse, error) { + result := ClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + return ClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the resources for a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The resource group with the resources to get. +// options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. +func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClientListByResourceGroupResponse]{ + More: func(page ClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClientListByResourceGroupResponse) (ClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (ClientListByResourceGroupResponse, error) { + result := ClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + return ClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginMoveResources - The resources to be moved must be in the same source resource group in the source subscription being +// used. The target resource group may be in a different subscription. When moving resources, both the +// source group and the target group are locked for the duration of the operation. Write and delete operations are blocked +// on the groups until the move completes. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// sourceResourceGroupName - The name of the resource group from the source subscription containing the resources to be moved. +// parameters - Parameters for moving resources. +// options - ClientBeginMoveResourcesOptions contains the optional parameters for the Client.BeginMoveResources method. +func (client *Client) BeginMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginMoveResourcesOptions) (*runtime.Poller[ClientMoveResourcesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.moveResources(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientMoveResourcesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientMoveResourcesResponse](options.ResumeToken, client.pl, nil) + } +} + +// MoveResources - The resources to be moved must be in the same source resource group in the source subscription being used. +// The target resource group may be in a different subscription. When moving resources, both the +// source group and the target group are locked for the duration of the operation. Write and delete operations are blocked +// on the groups until the move completes. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) moveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginMoveResourcesOptions) (*http.Response, error) { + req, err := client.moveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// moveResourcesCreateRequest creates the MoveResources request. +func (client *Client) moveResourcesCreateRequest(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginMoveResourcesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" + if sourceResourceGroupName == "" { + return nil, errors.New("parameter sourceResourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceResourceGroupName}", url.PathEscape(sourceResourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdate - Updates a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - The namespace of the resource provider. +// parentResourcePath - The parent resource identity. +// resourceType - The resource type of the resource to update. +// resourceName - The name of the resource to update. +// apiVersion - The API version to use for the operation. +// parameters - Parameters for updating the resource. +// options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateOptions) (*runtime.Poller[ClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates a resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdateByID - Updates a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceID - The fully qualified ID of the resource, including the resource name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// apiVersion - The API version to use for the operation. +// parameters - Update resource parameters. +// options - ClientBeginUpdateByIDOptions contains the optional parameters for the Client.BeginUpdateByID method. +func (client *Client) BeginUpdateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateByIDOptions) (*runtime.Poller[ClientUpdateByIDResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateByID(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientUpdateByIDResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientUpdateByIDResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateByID - Updates a resource by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) updateByID(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateByIDOptions) (*http.Response, error) { + req, err := client.updateByIDCreateRequest(ctx, resourceID, apiVersion, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateByIDCreateRequest creates the UpdateByID request. +func (client *Client) updateByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ClientBeginUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{resourceId}" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", apiVersion) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidateMoveResources - This operation checks whether the specified resources can be moved to the target. The resources +// to be moved must be in the same source resource group in the source subscription being used. The target +// resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). +// If validation fails, it returns HTTP response code 409 (Conflict) with an +// error message. Retrieve the URL in the Location header value to check the result of the long-running operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// sourceResourceGroupName - The name of the resource group from the source subscription containing the resources to be validated +// for move. +// parameters - Parameters for moving resources. +// options - ClientBeginValidateMoveResourcesOptions contains the optional parameters for the Client.BeginValidateMoveResources +// method. +func (client *Client) BeginValidateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginValidateMoveResourcesOptions) (*runtime.Poller[ClientValidateMoveResourcesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateMoveResources(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ClientValidateMoveResourcesResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ClientValidateMoveResourcesResponse](options.ResumeToken, client.pl, nil) + } +} + +// ValidateMoveResources - This operation checks whether the specified resources can be moved to the target. The resources +// to be moved must be in the same source resource group in the source subscription being used. The target +// resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). +// If validation fails, it returns HTTP response code 409 (Conflict) with an +// error message. Retrieve the URL in the Location header value to check the result of the long-running operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *Client) validateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginValidateMoveResourcesOptions) (*http.Response, error) { + req, err := client.validateMoveResourcesCreateRequest(ctx, sourceResourceGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateMoveResourcesCreateRequest creates the ValidateMoveResources request. +func (client *Client) validateMoveResourcesCreateRequest(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo, options *ClientBeginValidateMoveResourcesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" + if sourceResourceGroupName == "" { + return nil, errors.New("parameter sourceResourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceResourceGroupName}", url.PathEscape(sourceResourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_constants.go new file mode 100644 index 000000000..83a3ba89e --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_constants.go @@ -0,0 +1,402 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +const ( + moduleName = "armresources" + moduleVersion = "v1.0.0" +) + +// AliasPathAttributes - The attributes of the token that the alias path is referring to. +type AliasPathAttributes string + +const ( + // AliasPathAttributesModifiable - The token that the alias path is referring to is modifiable by policies with 'modify' effect. + AliasPathAttributesModifiable AliasPathAttributes = "Modifiable" + // AliasPathAttributesNone - The token that the alias path is referring to has no attributes. + AliasPathAttributesNone AliasPathAttributes = "None" +) + +// PossibleAliasPathAttributesValues returns the possible values for the AliasPathAttributes const type. +func PossibleAliasPathAttributesValues() []AliasPathAttributes { + return []AliasPathAttributes{ + AliasPathAttributesModifiable, + AliasPathAttributesNone, + } +} + +// AliasPathTokenType - The type of the token that the alias path is referring to. +type AliasPathTokenType string + +const ( + // AliasPathTokenTypeAny - The token type can be anything. + AliasPathTokenTypeAny AliasPathTokenType = "Any" + // AliasPathTokenTypeArray - The token type is array. + AliasPathTokenTypeArray AliasPathTokenType = "Array" + // AliasPathTokenTypeBoolean - The token type is boolean. + AliasPathTokenTypeBoolean AliasPathTokenType = "Boolean" + // AliasPathTokenTypeInteger - The token type is integer. + AliasPathTokenTypeInteger AliasPathTokenType = "Integer" + // AliasPathTokenTypeNotSpecified - The token type is not specified. + AliasPathTokenTypeNotSpecified AliasPathTokenType = "NotSpecified" + // AliasPathTokenTypeNumber - The token type is number. + AliasPathTokenTypeNumber AliasPathTokenType = "Number" + // AliasPathTokenTypeObject - The token type is object. + AliasPathTokenTypeObject AliasPathTokenType = "Object" + // AliasPathTokenTypeString - The token type is string. + AliasPathTokenTypeString AliasPathTokenType = "String" +) + +// PossibleAliasPathTokenTypeValues returns the possible values for the AliasPathTokenType const type. +func PossibleAliasPathTokenTypeValues() []AliasPathTokenType { + return []AliasPathTokenType{ + AliasPathTokenTypeAny, + AliasPathTokenTypeArray, + AliasPathTokenTypeBoolean, + AliasPathTokenTypeInteger, + AliasPathTokenTypeNotSpecified, + AliasPathTokenTypeNumber, + AliasPathTokenTypeObject, + AliasPathTokenTypeString, + } +} + +// AliasPatternType - The type of alias pattern +type AliasPatternType string + +const ( + // AliasPatternTypeNotSpecified - NotSpecified is not allowed. + AliasPatternTypeNotSpecified AliasPatternType = "NotSpecified" + // AliasPatternTypeExtract - Extract is the only allowed value. + AliasPatternTypeExtract AliasPatternType = "Extract" +) + +// PossibleAliasPatternTypeValues returns the possible values for the AliasPatternType const type. +func PossibleAliasPatternTypeValues() []AliasPatternType { + return []AliasPatternType{ + AliasPatternTypeNotSpecified, + AliasPatternTypeExtract, + } +} + +// AliasType - The type of the alias. +type AliasType string + +const ( + // AliasTypeNotSpecified - Alias type is unknown (same as not providing alias type). + AliasTypeNotSpecified AliasType = "NotSpecified" + // AliasTypePlainText - Alias value is not secret. + AliasTypePlainText AliasType = "PlainText" + // AliasTypeMask - Alias value is secret. + AliasTypeMask AliasType = "Mask" +) + +// PossibleAliasTypeValues returns the possible values for the AliasType const type. +func PossibleAliasTypeValues() []AliasType { + return []AliasType{ + AliasTypeNotSpecified, + AliasTypePlainText, + AliasTypeMask, + } +} + +// ChangeType - Type of change that will be made to the resource when the deployment is executed. +type ChangeType string + +const ( + // ChangeTypeCreate - The resource does not exist in the current state but is present in the desired state. The resource will + // be created when the deployment is executed. + ChangeTypeCreate ChangeType = "Create" + // ChangeTypeDelete - The resource exists in the current state and is missing from the desired state. The resource will be + // deleted when the deployment is executed. + ChangeTypeDelete ChangeType = "Delete" + // ChangeTypeIgnore - The resource exists in the current state and is missing from the desired state. The resource will not + // be deployed or modified when the deployment is executed. + ChangeTypeIgnore ChangeType = "Ignore" + // ChangeTypeDeploy - The resource exists in the current state and the desired state and will be redeployed when the deployment + // is executed. The properties of the resource may or may not change. + ChangeTypeDeploy ChangeType = "Deploy" + // ChangeTypeNoChange - The resource exists in the current state and the desired state and will be redeployed when the deployment + // is executed. The properties of the resource will not change. + ChangeTypeNoChange ChangeType = "NoChange" + // ChangeTypeModify - The resource exists in the current state and the desired state and will be redeployed when the deployment + // is executed. The properties of the resource will change. + ChangeTypeModify ChangeType = "Modify" + // ChangeTypeUnsupported - The resource is not supported by What-If. + ChangeTypeUnsupported ChangeType = "Unsupported" +) + +// PossibleChangeTypeValues returns the possible values for the ChangeType const type. +func PossibleChangeTypeValues() []ChangeType { + return []ChangeType{ + ChangeTypeCreate, + ChangeTypeDelete, + ChangeTypeIgnore, + ChangeTypeDeploy, + ChangeTypeNoChange, + ChangeTypeModify, + ChangeTypeUnsupported, + } +} + +// DeploymentMode - The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental +// mode, resources are deployed without deleting existing resources that are not included in +// the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included +// in the template are deleted. Be careful when using Complete mode as you may +// unintentionally delete resources. +type DeploymentMode string + +const ( + DeploymentModeIncremental DeploymentMode = "Incremental" + DeploymentModeComplete DeploymentMode = "Complete" +) + +// PossibleDeploymentModeValues returns the possible values for the DeploymentMode const type. +func PossibleDeploymentModeValues() []DeploymentMode { + return []DeploymentMode{ + DeploymentModeIncremental, + DeploymentModeComplete, + } +} + +// ExpressionEvaluationOptionsScopeType - The scope to be used for evaluation of parameters, variables and functions in a +// nested template. +type ExpressionEvaluationOptionsScopeType string + +const ( + ExpressionEvaluationOptionsScopeTypeInner ExpressionEvaluationOptionsScopeType = "Inner" + ExpressionEvaluationOptionsScopeTypeNotSpecified ExpressionEvaluationOptionsScopeType = "NotSpecified" + ExpressionEvaluationOptionsScopeTypeOuter ExpressionEvaluationOptionsScopeType = "Outer" +) + +// PossibleExpressionEvaluationOptionsScopeTypeValues returns the possible values for the ExpressionEvaluationOptionsScopeType const type. +func PossibleExpressionEvaluationOptionsScopeTypeValues() []ExpressionEvaluationOptionsScopeType { + return []ExpressionEvaluationOptionsScopeType{ + ExpressionEvaluationOptionsScopeTypeInner, + ExpressionEvaluationOptionsScopeTypeNotSpecified, + ExpressionEvaluationOptionsScopeTypeOuter, + } +} + +// ExtendedLocationType - The extended location type. +type ExtendedLocationType string + +const ( + ExtendedLocationTypeEdgeZone ExtendedLocationType = "EdgeZone" +) + +// PossibleExtendedLocationTypeValues returns the possible values for the ExtendedLocationType const type. +func PossibleExtendedLocationTypeValues() []ExtendedLocationType { + return []ExtendedLocationType{ + ExtendedLocationTypeEdgeZone, + } +} + +// OnErrorDeploymentType - The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. +type OnErrorDeploymentType string + +const ( + OnErrorDeploymentTypeLastSuccessful OnErrorDeploymentType = "LastSuccessful" + OnErrorDeploymentTypeSpecificDeployment OnErrorDeploymentType = "SpecificDeployment" +) + +// PossibleOnErrorDeploymentTypeValues returns the possible values for the OnErrorDeploymentType const type. +func PossibleOnErrorDeploymentTypeValues() []OnErrorDeploymentType { + return []OnErrorDeploymentType{ + OnErrorDeploymentTypeLastSuccessful, + OnErrorDeploymentTypeSpecificDeployment, + } +} + +// PropertyChangeType - The type of property change. +type PropertyChangeType string + +const ( + // PropertyChangeTypeCreate - The property does not exist in the current state but is present in the desired state. The property + // will be created when the deployment is executed. + PropertyChangeTypeCreate PropertyChangeType = "Create" + // PropertyChangeTypeDelete - The property exists in the current state and is missing from the desired state. It will be deleted + // when the deployment is executed. + PropertyChangeTypeDelete PropertyChangeType = "Delete" + // PropertyChangeTypeModify - The property exists in both current and desired state and is different. The value of the property + // will change when the deployment is executed. + PropertyChangeTypeModify PropertyChangeType = "Modify" + // PropertyChangeTypeArray - The property is an array and contains nested changes. + PropertyChangeTypeArray PropertyChangeType = "Array" + // PropertyChangeTypeNoEffect - The property will not be set or updated. + PropertyChangeTypeNoEffect PropertyChangeType = "NoEffect" +) + +// PossiblePropertyChangeTypeValues returns the possible values for the PropertyChangeType const type. +func PossiblePropertyChangeTypeValues() []PropertyChangeType { + return []PropertyChangeType{ + PropertyChangeTypeCreate, + PropertyChangeTypeDelete, + PropertyChangeTypeModify, + PropertyChangeTypeArray, + PropertyChangeTypeNoEffect, + } +} + +// ProviderAuthorizationConsentState - The provider authorization consent state. +type ProviderAuthorizationConsentState string + +const ( + ProviderAuthorizationConsentStateConsented ProviderAuthorizationConsentState = "Consented" + ProviderAuthorizationConsentStateNotRequired ProviderAuthorizationConsentState = "NotRequired" + ProviderAuthorizationConsentStateNotSpecified ProviderAuthorizationConsentState = "NotSpecified" + ProviderAuthorizationConsentStateRequired ProviderAuthorizationConsentState = "Required" +) + +// PossibleProviderAuthorizationConsentStateValues returns the possible values for the ProviderAuthorizationConsentState const type. +func PossibleProviderAuthorizationConsentStateValues() []ProviderAuthorizationConsentState { + return []ProviderAuthorizationConsentState{ + ProviderAuthorizationConsentStateConsented, + ProviderAuthorizationConsentStateNotRequired, + ProviderAuthorizationConsentStateNotSpecified, + ProviderAuthorizationConsentStateRequired, + } +} + +// ProvisioningOperation - The name of the current provisioning operation. +type ProvisioningOperation string + +const ( + // ProvisioningOperationNotSpecified - The provisioning operation is not specified. + ProvisioningOperationNotSpecified ProvisioningOperation = "NotSpecified" + // ProvisioningOperationCreate - The provisioning operation is create. + ProvisioningOperationCreate ProvisioningOperation = "Create" + // ProvisioningOperationDelete - The provisioning operation is delete. + ProvisioningOperationDelete ProvisioningOperation = "Delete" + // ProvisioningOperationWaiting - The provisioning operation is waiting. + ProvisioningOperationWaiting ProvisioningOperation = "Waiting" + // ProvisioningOperationAzureAsyncOperationWaiting - The provisioning operation is waiting Azure async operation. + ProvisioningOperationAzureAsyncOperationWaiting ProvisioningOperation = "AzureAsyncOperationWaiting" + // ProvisioningOperationResourceCacheWaiting - The provisioning operation is waiting for resource cache. + ProvisioningOperationResourceCacheWaiting ProvisioningOperation = "ResourceCacheWaiting" + // ProvisioningOperationAction - The provisioning operation is action. + ProvisioningOperationAction ProvisioningOperation = "Action" + // ProvisioningOperationRead - The provisioning operation is read. + ProvisioningOperationRead ProvisioningOperation = "Read" + // ProvisioningOperationEvaluateDeploymentOutput - The provisioning operation is evaluate output. + ProvisioningOperationEvaluateDeploymentOutput ProvisioningOperation = "EvaluateDeploymentOutput" + // ProvisioningOperationDeploymentCleanup - The provisioning operation is cleanup. This operation is part of the 'complete' + // mode deployment. + ProvisioningOperationDeploymentCleanup ProvisioningOperation = "DeploymentCleanup" +) + +// PossibleProvisioningOperationValues returns the possible values for the ProvisioningOperation const type. +func PossibleProvisioningOperationValues() []ProvisioningOperation { + return []ProvisioningOperation{ + ProvisioningOperationNotSpecified, + ProvisioningOperationCreate, + ProvisioningOperationDelete, + ProvisioningOperationWaiting, + ProvisioningOperationAzureAsyncOperationWaiting, + ProvisioningOperationResourceCacheWaiting, + ProvisioningOperationAction, + ProvisioningOperationRead, + ProvisioningOperationEvaluateDeploymentOutput, + ProvisioningOperationDeploymentCleanup, + } +} + +// ProvisioningState - Denotes the state of provisioning. +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" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreated, + ProvisioningStateCreating, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateNotSpecified, + ProvisioningStateReady, + ProvisioningStateRunning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ResourceIdentityType - The identity type. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeNone ResourceIdentityType = "None" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeNone, + } +} + +// TagsPatchOperation - The operation type for the patch API. +type TagsPatchOperation string + +const ( + // TagsPatchOperationDelete - The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + TagsPatchOperationDelete TagsPatchOperation = "Delete" + // TagsPatchOperationMerge - The 'merge' option allows adding tags with new names and updating the values of tags with existing + // names. + TagsPatchOperationMerge TagsPatchOperation = "Merge" + // TagsPatchOperationReplace - The 'replace' option replaces the entire set of existing tags with a new set. + TagsPatchOperationReplace TagsPatchOperation = "Replace" +) + +// PossibleTagsPatchOperationValues returns the possible values for the TagsPatchOperation const type. +func PossibleTagsPatchOperationValues() []TagsPatchOperation { + return []TagsPatchOperation{ + TagsPatchOperationDelete, + TagsPatchOperationMerge, + TagsPatchOperationReplace, + } +} + +// WhatIfResultFormat - The format of the What-If results +type WhatIfResultFormat string + +const ( + WhatIfResultFormatResourceIDOnly WhatIfResultFormat = "ResourceIdOnly" + WhatIfResultFormatFullResourcePayloads WhatIfResultFormat = "FullResourcePayloads" +) + +// PossibleWhatIfResultFormatValues returns the possible values for the WhatIfResultFormat const type. +func PossibleWhatIfResultFormatValues() []WhatIfResultFormat { + return []WhatIfResultFormat{ + WhatIfResultFormatResourceIDOnly, + WhatIfResultFormatFullResourcePayloads, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go new file mode 100644 index 000000000..70ec3ea3a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go @@ -0,0 +1,681 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DeploymentOperationsClient contains the methods for the DeploymentOperations group. +// Don't use this type directly, use NewDeploymentOperationsClient() instead. +type DeploymentOperationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDeploymentOperationsClient creates a new instance of DeploymentOperationsClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDeploymentOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentOperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DeploymentOperationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a deployments operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// deploymentName - The name of the deployment. +// operationID - The ID of the operation to get. +// options - DeploymentOperationsClientGetOptions contains the optional parameters for the DeploymentOperationsClient.Get +// method. +func (client *DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string, options *DeploymentOperationsClientGetOptions) (DeploymentOperationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DeploymentOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, operationID string, options *DeploymentOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeploymentOperationsClient) getHandleResponse(resp *http.Response) (DeploymentOperationsClientGetResponse, error) { + result := DeploymentOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { + return DeploymentOperationsClientGetResponse{}, err + } + return result, nil +} + +// GetAtManagementGroupScope - Gets a deployments operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// operationID - The ID of the operation to get. +// options - DeploymentOperationsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtManagementGroupScope +// method. +func (client *DeploymentOperationsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtManagementGroupScopeOptions) (DeploymentOperationsClientGetAtManagementGroupScopeResponse, error) { + req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtManagementGroupScopeHandleResponse(resp) +} + +// getAtManagementGroupScopeCreateRequest creates the GetAtManagementGroupScope request. +func (client *DeploymentOperationsClient) getAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtManagementGroupScopeHandleResponse handles the GetAtManagementGroupScope response. +func (client *DeploymentOperationsClient) getAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientGetAtManagementGroupScopeResponse, error) { + result := DeploymentOperationsClientGetAtManagementGroupScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { + return DeploymentOperationsClientGetAtManagementGroupScopeResponse{}, err + } + return result, nil +} + +// GetAtScope - Gets a deployments operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// operationID - The ID of the operation to get. +// options - DeploymentOperationsClientGetAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtScope +// method. +func (client *DeploymentOperationsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtScopeOptions) (DeploymentOperationsClientGetAtScopeResponse, error) { + req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtScopeHandleResponse(resp) +} + +// getAtScopeCreateRequest creates the GetAtScope request. +func (client *DeploymentOperationsClient) getAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtScopeHandleResponse handles the GetAtScope response. +func (client *DeploymentOperationsClient) getAtScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientGetAtScopeResponse, error) { + result := DeploymentOperationsClientGetAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { + return DeploymentOperationsClientGetAtScopeResponse{}, err + } + return result, nil +} + +// GetAtSubscriptionScope - Gets a deployments operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// operationID - The ID of the operation to get. +// options - DeploymentOperationsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtSubscriptionScope +// method. +func (client *DeploymentOperationsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtSubscriptionScopeOptions) (DeploymentOperationsClientGetAtSubscriptionScopeResponse, error) { + req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtSubscriptionScopeHandleResponse(resp) +} + +// getAtSubscriptionScopeCreateRequest creates the GetAtSubscriptionScope request. +func (client *DeploymentOperationsClient) getAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtSubscriptionScopeHandleResponse handles the GetAtSubscriptionScope response. +func (client *DeploymentOperationsClient) getAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientGetAtSubscriptionScopeResponse, error) { + result := DeploymentOperationsClientGetAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { + return DeploymentOperationsClientGetAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// GetAtTenantScope - Gets a deployments operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// operationID - The ID of the operation to get. +// options - DeploymentOperationsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtTenantScope +// method. +func (client *DeploymentOperationsClient) GetAtTenantScope(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtTenantScopeOptions) (DeploymentOperationsClientGetAtTenantScopeResponse, error) { + req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, operationID, options) + if err != nil { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtTenantScopeHandleResponse(resp) +} + +// getAtTenantScopeCreateRequest creates the GetAtTenantScope request. +func (client *DeploymentOperationsClient) getAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, operationID string, options *DeploymentOperationsClientGetAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtTenantScopeHandleResponse handles the GetAtTenantScope response. +func (client *DeploymentOperationsClient) getAtTenantScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientGetAtTenantScopeResponse, error) { + result := DeploymentOperationsClientGetAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { + return DeploymentOperationsClientGetAtTenantScopeResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all deployments operations for a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentOperationsClientListOptions contains the optional parameters for the DeploymentOperationsClient.List +// method. +func (client *DeploymentOperationsClient) NewListPager(resourceGroupName string, deploymentName string, options *DeploymentOperationsClientListOptions) *runtime.Pager[DeploymentOperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListResponse]{ + More: func(page DeploymentOperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListResponse) (DeploymentOperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentOperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DeploymentOperationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentOperationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DeploymentOperationsClient) listHandleResponse(resp *http.Response) (DeploymentOperationsClientListResponse, error) { + result := DeploymentOperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { + return DeploymentOperationsClientListResponse{}, err + } + return result, nil +} + +// NewListAtManagementGroupScopePager - Gets all deployments operations for a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentOperationsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtManagementGroupScope +// method. +func (client *DeploymentOperationsClient) NewListAtManagementGroupScopePager(groupID string, deploymentName string, options *DeploymentOperationsClientListAtManagementGroupScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtManagementGroupScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListAtManagementGroupScopeResponse]{ + More: func(page DeploymentOperationsClientListAtManagementGroupScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtManagementGroupScopeResponse) (DeploymentOperationsClientListAtManagementGroupScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtManagementGroupScopeHandleResponse(resp) + }, + }) +} + +// listAtManagementGroupScopeCreateRequest creates the ListAtManagementGroupScope request. +func (client *DeploymentOperationsClient) listAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentOperationsClientListAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtManagementGroupScopeHandleResponse handles the ListAtManagementGroupScope response. +func (client *DeploymentOperationsClient) listAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientListAtManagementGroupScopeResponse, error) { + result := DeploymentOperationsClientListAtManagementGroupScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { + return DeploymentOperationsClientListAtManagementGroupScopeResponse{}, err + } + return result, nil +} + +// NewListAtScopePager - Gets all deployments operations for a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentOperationsClientListAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtScope +// method. +func (client *DeploymentOperationsClient) NewListAtScopePager(scope string, deploymentName string, options *DeploymentOperationsClientListAtScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListAtScopeResponse]{ + More: func(page DeploymentOperationsClientListAtScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtScopeResponse) (DeploymentOperationsClientListAtScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtScopeCreateRequest(ctx, scope, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentOperationsClientListAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientListAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientListAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtScopeHandleResponse(resp) + }, + }) +} + +// listAtScopeCreateRequest creates the ListAtScope request. +func (client *DeploymentOperationsClient) listAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentOperationsClientListAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtScopeHandleResponse handles the ListAtScope response. +func (client *DeploymentOperationsClient) listAtScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientListAtScopeResponse, error) { + result := DeploymentOperationsClientListAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { + return DeploymentOperationsClientListAtScopeResponse{}, err + } + return result, nil +} + +// NewListAtSubscriptionScopePager - Gets all deployments operations for a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtSubscriptionScope +// method. +func (client *DeploymentOperationsClient) NewListAtSubscriptionScopePager(deploymentName string, options *DeploymentOperationsClientListAtSubscriptionScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtSubscriptionScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListAtSubscriptionScopeResponse]{ + More: func(page DeploymentOperationsClientListAtSubscriptionScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtSubscriptionScopeResponse) (DeploymentOperationsClientListAtSubscriptionScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtSubscriptionScopeHandleResponse(resp) + }, + }) +} + +// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. +func (client *DeploymentOperationsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentOperationsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. +func (client *DeploymentOperationsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientListAtSubscriptionScopeResponse, error) { + result := DeploymentOperationsClientListAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { + return DeploymentOperationsClientListAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// NewListAtTenantScopePager - Gets all deployments operations for a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtTenantScope +// method. +func (client *DeploymentOperationsClient) NewListAtTenantScopePager(deploymentName string, options *DeploymentOperationsClientListAtTenantScopeOptions) *runtime.Pager[DeploymentOperationsClientListAtTenantScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentOperationsClientListAtTenantScopeResponse]{ + More: func(page DeploymentOperationsClientListAtTenantScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentOperationsClientListAtTenantScopeResponse) (DeploymentOperationsClientListAtTenantScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtTenantScopeCreateRequest(ctx, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentOperationsClientListAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentOperationsClientListAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentOperationsClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtTenantScopeHandleResponse(resp) + }, + }) +} + +// listAtTenantScopeCreateRequest creates the ListAtTenantScope request. +func (client *DeploymentOperationsClient) listAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentOperationsClientListAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/operations" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtTenantScopeHandleResponse handles the ListAtTenantScope response. +func (client *DeploymentOperationsClient) listAtTenantScopeHandleResponse(resp *http.Response) (DeploymentOperationsClientListAtTenantScopeResponse, error) { + result := DeploymentOperationsClientListAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { + return DeploymentOperationsClientListAtTenantScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go new file mode 100644 index 000000000..cedd89925 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go @@ -0,0 +1,2584 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DeploymentsClient contains the methods for the Deployments group. +// Don't use this type directly, use NewDeploymentsClient() instead. +type DeploymentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDeploymentsClient creates a new instance of DeploymentsClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DeploymentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CalculateTemplateHash - Calculate the hash of the given template. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// templateParam - The template provided to calculate hash. +// options - DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash +// method. +func (client *DeploymentsClient) CalculateTemplateHash(ctx context.Context, templateParam interface{}, options *DeploymentsClientCalculateTemplateHashOptions) (DeploymentsClientCalculateTemplateHashResponse, error) { + req, err := client.calculateTemplateHashCreateRequest(ctx, templateParam, options) + if err != nil { + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientCalculateTemplateHashResponse{}, runtime.NewResponseError(resp) + } + return client.calculateTemplateHashHandleResponse(resp) +} + +// calculateTemplateHashCreateRequest creates the CalculateTemplateHash request. +func (client *DeploymentsClient) calculateTemplateHashCreateRequest(ctx context.Context, templateParam interface{}, options *DeploymentsClientCalculateTemplateHashOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/calculateTemplateHash" + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, templateParam) +} + +// calculateTemplateHashHandleResponse handles the CalculateTemplateHash response. +func (client *DeploymentsClient) calculateTemplateHashHandleResponse(resp *http.Response) (DeploymentsClientCalculateTemplateHashResponse, error) { + result := DeploymentsClientCalculateTemplateHashResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TemplateHashResult); err != nil { + return DeploymentsClientCalculateTemplateHashResponse{}, err + } + return result, nil +} + +// Cancel - You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, +// the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resource group partially deployed. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. +func (client *DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCancelOptions) (DeploymentsClientCancelResponse, error) { + req, err := client.cancelCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientCancelResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return DeploymentsClientCancelResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCancelResponse{}, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *DeploymentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CancelAtManagementGroupScope - You can cancel a deployment only if the provisioningState is Accepted or Running. After +// the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope +// method. +func (client *DeploymentsClient) CancelAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCancelAtManagementGroupScopeOptions) (DeploymentsClientCancelAtManagementGroupScopeResponse, error) { + req, err := client.cancelAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCancelAtManagementGroupScopeResponse{}, nil +} + +// cancelAtManagementGroupScopeCreateRequest creates the CancelAtManagementGroupScope request. +func (client *DeploymentsClient) cancelAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCancelAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CancelAtScope - You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment +// is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope +// method. +func (client *DeploymentsClient) CancelAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCancelAtScopeOptions) (DeploymentsClientCancelAtScopeResponse, error) { + req, err := client.cancelAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCancelAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return DeploymentsClientCancelAtScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCancelAtScopeResponse{}, nil +} + +// cancelAtScopeCreateRequest creates the CancelAtScope request. +func (client *DeploymentsClient) cancelAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCancelAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CancelAtSubscriptionScope - You can cancel a deployment only if the provisioningState is Accepted or Running. After the +// deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope +// method. +func (client *DeploymentsClient) CancelAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtSubscriptionScopeOptions) (DeploymentsClientCancelAtSubscriptionScopeResponse, error) { + req, err := client.cancelAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCancelAtSubscriptionScopeResponse{}, nil +} + +// cancelAtSubscriptionScopeCreateRequest creates the CancelAtSubscriptionScope request. +func (client *DeploymentsClient) cancelAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CancelAtTenantScope - You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment +// is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the +// currently running template deployment and leaves the resources partially deployed. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope +// method. +func (client *DeploymentsClient) CancelAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtTenantScopeOptions) (DeploymentsClientCancelAtTenantScopeResponse, error) { + req, err := client.cancelAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCancelAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCancelAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return DeploymentsClientCancelAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCancelAtTenantScopeResponse{}, nil +} + +// cancelAtTenantScopeCreateRequest creates the CancelAtTenantScope request. +func (client *DeploymentsClient) cancelAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCancelAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistence - Checks whether the deployment exists. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group with the deployment to check. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence +// method. +func (client *DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCheckExistenceOptions) (DeploymentsClientCheckExistenceResponse, error) { + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return DeploymentsClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceCreateRequest creates the CheckExistence request. +func (client *DeploymentsClient) checkExistenceCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientCheckExistenceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistenceAtManagementGroupScope - Checks whether the deployment exists. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope +// method. +func (client *DeploymentsClient) CheckExistenceAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions) (DeploymentsClientCheckExistenceAtManagementGroupScopeResponse, error) { + req, err := client.checkExistenceAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCheckExistenceAtManagementGroupScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceAtManagementGroupScopeCreateRequest creates the CheckExistenceAtManagementGroupScope request. +func (client *DeploymentsClient) checkExistenceAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientCheckExistenceAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistenceAtScope - Checks whether the deployment exists. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope +// method. +func (client *DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCheckExistenceAtScopeOptions) (DeploymentsClientCheckExistenceAtScopeResponse, error) { + req, err := client.checkExistenceAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return DeploymentsClientCheckExistenceAtScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCheckExistenceAtScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceAtScopeCreateRequest creates the CheckExistenceAtScope request. +func (client *DeploymentsClient) checkExistenceAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientCheckExistenceAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistenceAtSubscriptionScope - Checks whether the deployment exists. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope +// method. +func (client *DeploymentsClient) CheckExistenceAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions) (DeploymentsClientCheckExistenceAtSubscriptionScopeResponse, error) { + req, err := client.checkExistenceAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCheckExistenceAtSubscriptionScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceAtSubscriptionScopeCreateRequest creates the CheckExistenceAtSubscriptionScope request. +func (client *DeploymentsClient) checkExistenceAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CheckExistenceAtTenantScope - Checks whether the deployment exists. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope +// method. +func (client *DeploymentsClient) CheckExistenceAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtTenantScopeOptions) (DeploymentsClientCheckExistenceAtTenantScopeResponse, error) { + req, err := client.checkExistenceAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return DeploymentsClientCheckExistenceAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return DeploymentsClientCheckExistenceAtTenantScopeResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceAtTenantScopeCreateRequest creates the CheckExistenceAtTenantScope request. +func (client *DeploymentsClient) checkExistenceAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientCheckExistenceAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - You can provide the template and parameters directly in the request or link to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to deploy the resources to. The name is case insensitive. The resource +// group must already exist. +// deploymentName - The name of the deployment. +// parameters - Additional parameters supplied to the operation. +// options - DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate +// method. +func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - You can provide the template and parameters directly in the request or link to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdateAtManagementGroupScope - You can provide the template and parameters directly in the request or link +// to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// parameters - Additional parameters supplied to the operation. +// options - DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope +// method. +func (client *DeploymentsClient) BeginCreateOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateAtManagementGroupScope - You can provide the template and parameters directly in the request or link to JSON +// files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) createOrUpdateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*http.Response, error) { + req, err := client.createOrUpdateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateAtManagementGroupScopeCreateRequest creates the CreateOrUpdateAtManagementGroupScope request. +func (client *DeploymentsClient) createOrUpdateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdateAtScope - You can provide the template and parameters directly in the request or link to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// parameters - Additional parameters supplied to the operation. +// options - DeploymentsClientBeginCreateOrUpdateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtScope +// method. +func (client *DeploymentsClient) BeginCreateOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateAtScope(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateAtScope - You can provide the template and parameters directly in the request or link to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) createOrUpdateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*http.Response, error) { + req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. +func (client *DeploymentsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdateAtSubscriptionScope - You can provide the template and parameters directly in the request or link to +// JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Additional parameters supplied to the operation. +// options - DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope +// method. +func (client *DeploymentsClient) BeginCreateOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateAtSubscriptionScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateAtSubscriptionScope - You can provide the template and parameters directly in the request or link to JSON +// files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) createOrUpdateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*http.Response, error) { + req, err := client.createOrUpdateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateAtSubscriptionScopeCreateRequest creates the CreateOrUpdateAtSubscriptionScope request. +func (client *DeploymentsClient) createOrUpdateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginCreateOrUpdateAtTenantScope - You can provide the template and parameters directly in the request or link to JSON +// files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Additional parameters supplied to the operation. +// options - DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtTenantScope +// method. +func (client *DeploymentsClient) BeginCreateOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdateAtTenantScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateAtTenantScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdateAtTenantScope - You can provide the template and parameters directly in the request or link to JSON files. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) createOrUpdateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*http.Response, error) { + req, err := client.createOrUpdateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateAtTenantScopeCreateRequest creates the CreateOrUpdateAtTenantScope request. +func (client *DeploymentsClient) createOrUpdateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - A template deployment that is currently running cannot be deleted. Deleting a template deployment removes +// the associated deployment operations. Deleting a template deployment does not affect the state +// of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is +// successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status +// of 202. When the process finishes, the URI in the Location header returns a +// status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status +// code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group with the deployment to delete. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. +func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*runtime.Poller[DeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the +// associated deployment operations. Deleting a template deployment does not affect the state +// of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is +// successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status +// of 202. When the process finishes, the URI in the Location header returns a +// status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status +// code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteAtManagementGroupScope - A template deployment that is currently running cannot be deleted. Deleting a template +// deployment removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentsClientBeginDeleteAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtManagementGroupScope +// method. +func (client *DeploymentsClient) BeginDeleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtManagementGroupScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteAtManagementGroupScope(ctx, groupID, deploymentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientDeleteAtManagementGroupScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtManagementGroupScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteAtManagementGroupScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) deleteAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*http.Response, error) { + req, err := client.deleteAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteAtManagementGroupScopeCreateRequest creates the DeleteAtManagementGroupScope request. +func (client *DeploymentsClient) deleteAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientBeginDeleteAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteAtScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentsClientBeginDeleteAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtScope +// method. +func (client *DeploymentsClient) BeginDeleteAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteAtScope(ctx, scope, deploymentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientDeleteAtScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteAtScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment removes +// the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) deleteAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*http.Response, error) { + req, err := client.deleteAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteAtScopeCreateRequest creates the DeleteAtScope request. +func (client *DeploymentsClient) deleteAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientBeginDeleteAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteAtSubscriptionScope - A template deployment that is currently running cannot be deleted. Deleting a template +// deployment removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientBeginDeleteAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtSubscriptionScope +// method. +func (client *DeploymentsClient) BeginDeleteAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtSubscriptionScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteAtSubscriptionScope(ctx, deploymentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientDeleteAtSubscriptionScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtSubscriptionScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteAtSubscriptionScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) deleteAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*http.Response, error) { + req, err := client.deleteAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteAtSubscriptionScopeCreateRequest creates the DeleteAtSubscriptionScope request. +func (client *DeploymentsClient) deleteAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteAtTenantScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientBeginDeleteAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtTenantScope +// method. +func (client *DeploymentsClient) BeginDeleteAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientDeleteAtTenantScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteAtTenantScope(ctx, deploymentName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientDeleteAtTenantScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteAtTenantScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// DeleteAtTenantScope - A template deployment that is currently running cannot be deleted. Deleting a template deployment +// removes the associated deployment operations. This is an asynchronous operation that returns a status +// of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used +// to obtain the status of the process. While the process is running, a call to +// the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns +// a status of 204 on success. If the asynchronous request failed, the URI in the +// Location header returns an error-level status code. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) deleteAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*http.Response, error) { + req, err := client.deleteAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteAtTenantScopeCreateRequest creates the DeleteAtTenantScope request. +func (client *DeploymentsClient) deleteAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientBeginDeleteAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ExportTemplate - Exports the template used for specified deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate +// method. +func (client *DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientExportTemplateOptions) (DeploymentsClientExportTemplateResponse, error) { + req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientExportTemplateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientExportTemplateResponse{}, runtime.NewResponseError(resp) + } + return client.exportTemplateHandleResponse(resp) +} + +// exportTemplateCreateRequest creates the ExportTemplate request. +func (client *DeploymentsClient) exportTemplateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientExportTemplateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// exportTemplateHandleResponse handles the ExportTemplate response. +func (client *DeploymentsClient) exportTemplateHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateResponse, error) { + result := DeploymentsClientExportTemplateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { + return DeploymentsClientExportTemplateResponse{}, err + } + return result, nil +} + +// ExportTemplateAtManagementGroupScope - Exports the template used for specified deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope +// method. +func (client *DeploymentsClient) ExportTemplateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientExportTemplateAtManagementGroupScopeOptions) (DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error) { + req, err := client.exportTemplateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return client.exportTemplateAtManagementGroupScopeHandleResponse(resp) +} + +// exportTemplateAtManagementGroupScopeCreateRequest creates the ExportTemplateAtManagementGroupScope request. +func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientExportTemplateAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// exportTemplateAtManagementGroupScopeHandleResponse handles the ExportTemplateAtManagementGroupScope response. +func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtManagementGroupScopeResponse, error) { + result := DeploymentsClientExportTemplateAtManagementGroupScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { + return DeploymentsClientExportTemplateAtManagementGroupScopeResponse{}, err + } + return result, nil +} + +// ExportTemplateAtScope - Exports the template used for specified deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope +// method. +func (client *DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientExportTemplateAtScopeOptions) (DeploymentsClientExportTemplateAtScopeResponse, error) { + req, err := client.exportTemplateAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientExportTemplateAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.exportTemplateAtScopeHandleResponse(resp) +} + +// exportTemplateAtScopeCreateRequest creates the ExportTemplateAtScope request. +func (client *DeploymentsClient) exportTemplateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientExportTemplateAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// exportTemplateAtScopeHandleResponse handles the ExportTemplateAtScope response. +func (client *DeploymentsClient) exportTemplateAtScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtScopeResponse, error) { + result := DeploymentsClientExportTemplateAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { + return DeploymentsClientExportTemplateAtScopeResponse{}, err + } + return result, nil +} + +// ExportTemplateAtSubscriptionScope - Exports the template used for specified deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope +// method. +func (client *DeploymentsClient) ExportTemplateAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtSubscriptionScopeOptions) (DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error) { + req, err := client.exportTemplateAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.exportTemplateAtSubscriptionScopeHandleResponse(resp) +} + +// exportTemplateAtSubscriptionScopeCreateRequest creates the ExportTemplateAtSubscriptionScope request. +func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// exportTemplateAtSubscriptionScopeHandleResponse handles the ExportTemplateAtSubscriptionScope response. +func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtSubscriptionScopeResponse, error) { + result := DeploymentsClientExportTemplateAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { + return DeploymentsClientExportTemplateAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// ExportTemplateAtTenantScope - Exports the template used for specified deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope +// method. +func (client *DeploymentsClient) ExportTemplateAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtTenantScopeOptions) (DeploymentsClientExportTemplateAtTenantScopeResponse, error) { + req, err := client.exportTemplateAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.exportTemplateAtTenantScopeHandleResponse(resp) +} + +// exportTemplateAtTenantScopeCreateRequest creates the ExportTemplateAtTenantScope request. +func (client *DeploymentsClient) exportTemplateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientExportTemplateAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// exportTemplateAtTenantScopeHandleResponse handles the ExportTemplateAtTenantScope response. +func (client *DeploymentsClient) exportTemplateAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientExportTemplateAtTenantScopeResponse, error) { + result := DeploymentsClientExportTemplateAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { + return DeploymentsClientExportTemplateAtTenantScopeResponse{}, err + } + return result, nil +} + +// Get - Gets a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// deploymentName - The name of the deployment. +// options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. +func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (DeploymentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, deploymentName, options) + if err != nil { + return DeploymentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (DeploymentsClientGetResponse, error) { + result := DeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { + return DeploymentsClientGetResponse{}, err + } + return result, nil +} + +// GetAtManagementGroupScope - Gets a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// options - DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope +// method. +func (client *DeploymentsClient) GetAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientGetAtManagementGroupScopeOptions) (DeploymentsClientGetAtManagementGroupScopeResponse, error) { + req, err := client.getAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtManagementGroupScopeHandleResponse(resp) +} + +// getAtManagementGroupScopeCreateRequest creates the GetAtManagementGroupScope request. +func (client *DeploymentsClient) getAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, options *DeploymentsClientGetAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtManagementGroupScopeHandleResponse handles the GetAtManagementGroupScope response. +func (client *DeploymentsClient) getAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtManagementGroupScopeResponse, error) { + result := DeploymentsClientGetAtManagementGroupScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { + return DeploymentsClientGetAtManagementGroupScopeResponse{}, err + } + return result, nil +} + +// GetAtScope - Gets a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// options - DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. +func (client *DeploymentsClient) GetAtScope(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientGetAtScopeOptions) (DeploymentsClientGetAtScopeResponse, error) { + req, err := client.getAtScopeCreateRequest(ctx, scope, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtScopeHandleResponse(resp) +} + +// getAtScopeCreateRequest creates the GetAtScope request. +func (client *DeploymentsClient) getAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsClientGetAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtScopeHandleResponse handles the GetAtScope response. +func (client *DeploymentsClient) getAtScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtScopeResponse, error) { + result := DeploymentsClientGetAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { + return DeploymentsClientGetAtScopeResponse{}, err + } + return result, nil +} + +// GetAtSubscriptionScope - Gets a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope +// method. +func (client *DeploymentsClient) GetAtSubscriptionScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtSubscriptionScopeOptions) (DeploymentsClientGetAtSubscriptionScopeResponse, error) { + req, err := client.getAtSubscriptionScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtSubscriptionScopeHandleResponse(resp) +} + +// getAtSubscriptionScopeCreateRequest creates the GetAtSubscriptionScope request. +func (client *DeploymentsClient) getAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtSubscriptionScopeHandleResponse handles the GetAtSubscriptionScope response. +func (client *DeploymentsClient) getAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtSubscriptionScopeResponse, error) { + result := DeploymentsClientGetAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { + return DeploymentsClientGetAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// GetAtTenantScope - Gets a deployment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// options - DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope +// method. +func (client *DeploymentsClient) GetAtTenantScope(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtTenantScopeOptions) (DeploymentsClientGetAtTenantScopeResponse, error) { + req, err := client.getAtTenantScopeCreateRequest(ctx, deploymentName, options) + if err != nil { + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtTenantScopeHandleResponse(resp) +} + +// getAtTenantScopeCreateRequest creates the GetAtTenantScope request. +func (client *DeploymentsClient) getAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, options *DeploymentsClientGetAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtTenantScopeHandleResponse handles the GetAtTenantScope response. +func (client *DeploymentsClient) getAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientGetAtTenantScopeResponse, error) { + result := DeploymentsClientGetAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { + return DeploymentsClientGetAtTenantScopeResponse{}, err + } + return result, nil +} + +// NewListAtManagementGroupScopePager - Get all the deployments for a management group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// options - DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ListAtManagementGroupScope +// method. +func (client *DeploymentsClient) NewListAtManagementGroupScopePager(groupID string, options *DeploymentsClientListAtManagementGroupScopeOptions) *runtime.Pager[DeploymentsClientListAtManagementGroupScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtManagementGroupScopeResponse]{ + More: func(page DeploymentsClientListAtManagementGroupScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListAtManagementGroupScopeResponse) (DeploymentsClientListAtManagementGroupScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtManagementGroupScopeCreateRequest(ctx, groupID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientListAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtManagementGroupScopeHandleResponse(resp) + }, + }) +} + +// listAtManagementGroupScopeCreateRequest creates the ListAtManagementGroupScope request. +func (client *DeploymentsClient) listAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, options *DeploymentsClientListAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtManagementGroupScopeHandleResponse handles the ListAtManagementGroupScope response. +func (client *DeploymentsClient) listAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtManagementGroupScopeResponse, error) { + result := DeploymentsClientListAtManagementGroupScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { + return DeploymentsClientListAtManagementGroupScopeResponse{}, err + } + return result, nil +} + +// NewListAtScopePager - Get all the deployments at the given scope. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// options - DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.ListAtScope method. +func (client *DeploymentsClient) NewListAtScopePager(scope string, options *DeploymentsClientListAtScopeOptions) *runtime.Pager[DeploymentsClientListAtScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtScopeResponse]{ + More: func(page DeploymentsClientListAtScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListAtScopeResponse) (DeploymentsClientListAtScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientListAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtScopeHandleResponse(resp) + }, + }) +} + +// listAtScopeCreateRequest creates the ListAtScope request. +func (client *DeploymentsClient) listAtScopeCreateRequest(ctx context.Context, scope string, options *DeploymentsClientListAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtScopeHandleResponse handles the ListAtScope response. +func (client *DeploymentsClient) listAtScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtScopeResponse, error) { + result := DeploymentsClientListAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { + return DeploymentsClientListAtScopeResponse{}, err + } + return result, nil +} + +// NewListAtSubscriptionScopePager - Get all the deployments for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ListAtSubscriptionScope +// method. +func (client *DeploymentsClient) NewListAtSubscriptionScopePager(options *DeploymentsClientListAtSubscriptionScopeOptions) *runtime.Pager[DeploymentsClientListAtSubscriptionScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtSubscriptionScopeResponse]{ + More: func(page DeploymentsClientListAtSubscriptionScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListAtSubscriptionScopeResponse) (DeploymentsClientListAtSubscriptionScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtSubscriptionScopeCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientListAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtSubscriptionScopeHandleResponse(resp) + }, + }) +} + +// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. +func (client *DeploymentsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, options *DeploymentsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. +func (client *DeploymentsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtSubscriptionScopeResponse, error) { + result := DeploymentsClientListAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { + return DeploymentsClientListAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// NewListAtTenantScopePager - Get all the deployments at the tenant scope. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ListAtTenantScope +// method. +func (client *DeploymentsClient) NewListAtTenantScopePager(options *DeploymentsClientListAtTenantScopeOptions) *runtime.Pager[DeploymentsClientListAtTenantScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListAtTenantScopeResponse]{ + More: func(page DeploymentsClientListAtTenantScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListAtTenantScopeResponse) (DeploymentsClientListAtTenantScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtTenantScopeCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientListAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtTenantScopeHandleResponse(resp) + }, + }) +} + +// listAtTenantScopeCreateRequest creates the ListAtTenantScope request. +func (client *DeploymentsClient) listAtTenantScopeCreateRequest(ctx context.Context, options *DeploymentsClientListAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtTenantScopeHandleResponse handles the ListAtTenantScope response. +func (client *DeploymentsClient) listAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsClientListAtTenantScopeResponse, error) { + result := DeploymentsClientListAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { + return DeploymentsClientListAtTenantScopeResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all the deployments for a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group with the deployments to get. The name is case insensitive. +// options - DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.ListByResourceGroup +// method. +func (client *DeploymentsClient) NewListByResourceGroupPager(resourceGroupName string, options *DeploymentsClientListByResourceGroupOptions) *runtime.Pager[DeploymentsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListByResourceGroupResponse]{ + More: func(page DeploymentsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListByResourceGroupResponse) (DeploymentsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeploymentsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DeploymentsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (DeploymentsClientListByResourceGroupResponse, error) { + result := DeploymentsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { + return DeploymentsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginValidate - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource +// Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group the template will be deployed to. The name is case insensitive. +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginValidateOptions contains the optional parameters for the DeploymentsClient.BeginValidate +// method. +func (client *DeploymentsClient) BeginValidate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*runtime.Poller[DeploymentsClientValidateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validate(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientValidateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientValidateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Validate - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*http.Response, error) { + req, err := client.validateCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateCreateRequest creates the Validate request. +func (client *DeploymentsClient) validateCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidateAtManagementGroupScope - Validates whether the specified template is syntactically correct and will be accepted +// by Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginValidateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtManagementGroupScope +// method. +func (client *DeploymentsClient) BeginValidateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtManagementGroupScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientValidateAtManagementGroupScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtManagementGroupScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// ValidateAtManagementGroupScope - Validates whether the specified template is syntactically correct and will be accepted +// by Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) validateAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*http.Response, error) { + req, err := client.validateAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateAtManagementGroupScopeCreateRequest creates the ValidateAtManagementGroupScope request. +func (client *DeploymentsClient) validateAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidateAtScope - Validates whether the specified template is syntactically correct and will be accepted by Azure +// Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginValidateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtScope +// method. +func (client *DeploymentsClient) BeginValidateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateAtScope(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientValidateAtScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// ValidateAtScope - Validates whether the specified template is syntactically correct and will be accepted by Azure Resource +// Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) validateAtScope(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*http.Response, error) { + req, err := client.validateAtScopeCreateRequest(ctx, scope, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateAtScopeCreateRequest creates the ValidateAtScope request. +func (client *DeploymentsClient) validateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidateAtSubscriptionScope - Validates whether the specified template is syntactically correct and will be accepted +// by Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginValidateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtSubscriptionScope +// method. +func (client *DeploymentsClient) BeginValidateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtSubscriptionScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateAtSubscriptionScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientValidateAtSubscriptionScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtSubscriptionScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// ValidateAtSubscriptionScope - Validates whether the specified template is syntactically correct and will be accepted by +// Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) validateAtSubscriptionScope(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*http.Response, error) { + req, err := client.validateAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateAtSubscriptionScopeCreateRequest creates the ValidateAtSubscriptionScope request. +func (client *DeploymentsClient) validateAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters Deployment, options *DeploymentsClientBeginValidateAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginValidateAtTenantScope - Validates whether the specified template is syntactically correct and will be accepted by +// Azure Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginValidateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtTenantScope +// method. +func (client *DeploymentsClient) BeginValidateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientValidateAtTenantScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateAtTenantScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeploymentsClientValidateAtTenantScopeResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientValidateAtTenantScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// ValidateAtTenantScope - Validates whether the specified template is syntactically correct and will be accepted by Azure +// Resource Manager.. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) validateAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*http.Response, error) { + req, err := client.validateAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusBadRequest) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// validateAtTenantScopeCreateRequest creates the ValidateAtTenantScope request. +func (client *DeploymentsClient) validateAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeployment, options *DeploymentsClientBeginValidateAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/validate" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginWhatIf - Returns changes that will be made by the deployment if executed at the scope of the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group the template will be deployed to. The name is case insensitive. +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginWhatIfOptions contains the optional parameters for the DeploymentsClient.BeginWhatIf method. +func (client *DeploymentsClient) BeginWhatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*runtime.Poller[DeploymentsClientWhatIfResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.whatIf(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DeploymentsClientWhatIfResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfResponse](options.ResumeToken, client.pl, nil) + } +} + +// WhatIf - Returns changes that will be made by the deployment if executed at the scope of the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) whatIf(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*http.Response, error) { + req, err := client.whatIfCreateRequest(ctx, resourceGroupName, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// whatIfCreateRequest creates the WhatIf request. +func (client *DeploymentsClient) whatIfCreateRequest(ctx context.Context, resourceGroupName string, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginWhatIfAtManagementGroupScope - Returns changes that will be made by the deployment if executed at the scope of the +// management group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// groupID - The management group ID. +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtManagementGroupScope +// method. +func (client *DeploymentsClient) BeginWhatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtManagementGroupScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.whatIfAtManagementGroupScope(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DeploymentsClientWhatIfAtManagementGroupScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtManagementGroupScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// WhatIfAtManagementGroupScope - Returns changes that will be made by the deployment if executed at the scope of the management +// group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) whatIfAtManagementGroupScope(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*http.Response, error) { + req, err := client.whatIfAtManagementGroupScopeCreateRequest(ctx, groupID, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// whatIfAtManagementGroupScopeCreateRequest creates the WhatIfAtManagementGroupScope request. +func (client *DeploymentsClient) whatIfAtManagementGroupScopeCreateRequest(ctx context.Context, groupID string, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginWhatIfAtSubscriptionScope - Returns changes that will be made by the deployment if executed at the scope of the subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Parameters to What If. +// options - DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtSubscriptionScope +// method. +func (client *DeploymentsClient) BeginWhatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtSubscriptionScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.whatIfAtSubscriptionScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DeploymentsClientWhatIfAtSubscriptionScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtSubscriptionScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// WhatIfAtSubscriptionScope - Returns changes that will be made by the deployment if executed at the scope of the subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) whatIfAtSubscriptionScope(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*http.Response, error) { + req, err := client.whatIfAtSubscriptionScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// whatIfAtSubscriptionScopeCreateRequest creates the WhatIfAtSubscriptionScope request. +func (client *DeploymentsClient) whatIfAtSubscriptionScopeCreateRequest(ctx context.Context, deploymentName string, parameters DeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginWhatIfAtTenantScope - Returns changes that will be made by the deployment if executed at the scope of the tenant group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// deploymentName - The name of the deployment. +// parameters - Parameters to validate. +// options - DeploymentsClientBeginWhatIfAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtTenantScope +// method. +func (client *DeploymentsClient) BeginWhatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*runtime.Poller[DeploymentsClientWhatIfAtTenantScopeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.whatIfAtTenantScope(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DeploymentsClientWhatIfAtTenantScopeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientWhatIfAtTenantScopeResponse](options.ResumeToken, client.pl, nil) + } +} + +// WhatIfAtTenantScope - Returns changes that will be made by the deployment if executed at the scope of the tenant group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *DeploymentsClient) whatIfAtTenantScope(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*http.Response, error) { + req, err := client.whatIfAtTenantScopeCreateRequest(ctx, deploymentName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// whatIfAtTenantScopeCreateRequest creates the WhatIfAtTenantScope request. +func (client *DeploymentsClient) whatIfAtTenantScopeCreateRequest(ctx context.Context, deploymentName string, parameters ScopedDeploymentWhatIf, options *DeploymentsClientBeginWhatIfAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf" + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models.go new file mode 100644 index 000000000..e3ba3a380 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models.go @@ -0,0 +1,1812 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import "time" + +type APIProfile struct { + // READ-ONLY; The API version. + APIVersion *string `json:"apiVersion,omitempty" azure:"ro"` + + // READ-ONLY; The profile version. + ProfileVersion *string `json:"profileVersion,omitempty" azure:"ro"` +} + +// Alias - The alias type. +type Alias struct { + // The default path for an alias. + DefaultPath *string `json:"defaultPath,omitempty"` + + // The default pattern for an alias. + DefaultPattern *AliasPattern `json:"defaultPattern,omitempty"` + + // The alias name. + Name *string `json:"name,omitempty"` + + // The paths for an alias. + Paths []*AliasPath `json:"paths,omitempty"` + + // The type of the alias. + Type *AliasType `json:"type,omitempty"` + + // READ-ONLY; The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata + DefaultMetadata *AliasPathMetadata `json:"defaultMetadata,omitempty" azure:"ro"` +} + +// AliasPath - The type of the paths for alias. +type AliasPath struct { + // The API versions. + APIVersions []*string `json:"apiVersions,omitempty"` + + // The path of an alias. + Path *string `json:"path,omitempty"` + + // The pattern for an alias path. + Pattern *AliasPattern `json:"pattern,omitempty"` + + // READ-ONLY; The metadata of the alias path. If missing, fall back to the default metadata of the alias. + Metadata *AliasPathMetadata `json:"metadata,omitempty" azure:"ro"` +} + +type AliasPathMetadata struct { + // READ-ONLY; The attributes of the token that the alias path is referring to. + Attributes *AliasPathAttributes `json:"attributes,omitempty" azure:"ro"` + + // READ-ONLY; The type of the token that the alias path is referring to. + Type *AliasPathTokenType `json:"type,omitempty" azure:"ro"` +} + +// AliasPattern - The type of the pattern for an alias path. +type AliasPattern struct { + // The alias pattern phrase. + Phrase *string `json:"phrase,omitempty"` + + // The type of alias pattern + Type *AliasPatternType `json:"type,omitempty"` + + // The alias pattern variable. + Variable *string `json:"variable,omitempty"` +} + +// BasicDependency - Deployment dependency information. +type BasicDependency struct { + // The ID of the dependency. + ID *string `json:"id,omitempty"` + + // The dependency resource name. + ResourceName *string `json:"resourceName,omitempty"` + + // The dependency resource type. + ResourceType *string `json:"resourceType,omitempty"` +} + +// ClientBeginCreateOrUpdateByIDOptions contains the optional parameters for the Client.BeginCreateOrUpdateByID method. +type ClientBeginCreateOrUpdateByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +type ClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteByIDOptions contains the optional parameters for the Client.BeginDeleteByID method. +type ClientBeginDeleteByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +type ClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginMoveResourcesOptions contains the optional parameters for the Client.BeginMoveResources method. +type ClientBeginMoveResourcesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginUpdateByIDOptions contains the optional parameters for the Client.BeginUpdateByID method. +type ClientBeginUpdateByIDOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +type ClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginValidateMoveResourcesOptions contains the optional parameters for the Client.BeginValidateMoveResources method. +type ClientBeginValidateMoveResourcesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientCheckExistenceByIDOptions contains the optional parameters for the Client.CheckExistenceByID method. +type ClientCheckExistenceByIDOptions struct { + // placeholder for future optional parameters +} + +// ClientCheckExistenceOptions contains the optional parameters for the Client.CheckExistence method. +type ClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// ClientGetByIDOptions contains the optional parameters for the Client.GetByID method. +type ClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. +type ClientListByResourceGroupOptions struct { + // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime + // and provisioningState. For example, $expand=createdTime,changedTime. + Expand *string + // The filter to apply on the operation. + // The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, + // identity/principalId, plan, plan/publisher, plan/product, plan/name, + // plan/version, and plan/promotionCode. + // For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks' + // You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup. + // For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name) + // You can link more than one substringof together by adding and/or operators. + // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' + // and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for + // each resource are not returned in the results. + // You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, + // plan and plan/publisher and plan/name, identity and identity/principalId. + Filter *string + // The number of results to return. If null is passed, returns all resources. + Top *int32 +} + +// ClientListOptions contains the optional parameters for the Client.List method. +type ClientListOptions struct { + // Comma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime + // and provisioningState. For example, $expand=createdTime,changedTime. + Expand *string + // The filter to apply on the operation. + // Filter comparison operators include eq (equals) and ne (not equals) and may be used with the following properties: location, + // resourceType, name, resourceGroup, identity, identity/principalId, plan, + // plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode. + // For example, to filter by a resource type, use $filter=resourceType eq 'Microsoft.Network/virtualNetworks' + // substringof(value, property) can be used to filter for substrings of the following currently-supported properties: name + // and resourceGroup + // For example, to get all resources with 'demo' anywhere in the resource name, use $filter=substringof('demo', name) + // Multiple substring operations can also be combined using and/or operators. + // Note that any truncated number of results queried via $top may also not be compatible when using a filter. + // Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName + // eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag + // name and value, the original tags for each resource will not be returned in the results. Any list of additional properties + // queried via $expand may also not be compatible when filtering by tag + // names/values. + // For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). + // This query will return all resources with a tag name prefixed by the phrase + // depart (i.e.department, departureDate, departureTime, etc.) + // Note that some properties can be combined when filtering resources, which include the following: substringof() and/or resourceType, + // plan and plan/publisher and plan/name, and identity and + // identity/principalId. + Filter *string + // The number of results to return. If null is passed, returns all resources. + Top *int32 +} + +// CloudError - An error response for a resource management request. +type CloudError struct { + // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + // the OData error response format.) + Error *ErrorResponse `json:"error,omitempty"` +} + +// DebugSetting - The debug setting. +type DebugSetting struct { + // Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, + // or both requestContent and responseContent separated by a comma. The default is + // none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging + // information about the request or response, you could potentially expose + // sensitive data that is retrieved through the deployment operations. + DetailLevel *string `json:"detailLevel,omitempty"` +} + +// Dependency - Deployment dependency information. +type Dependency struct { + // The list of dependencies. + DependsOn []*BasicDependency `json:"dependsOn,omitempty"` + + // The ID of the dependency. + ID *string `json:"id,omitempty"` + + // The dependency resource name. + ResourceName *string `json:"resourceName,omitempty"` + + // The dependency resource type. + ResourceType *string `json:"resourceType,omitempty"` +} + +// Deployment operation parameters. +type Deployment struct { + // REQUIRED; The deployment properties. + Properties *DeploymentProperties `json:"properties,omitempty"` + + // The location to store the deployment data. + Location *string `json:"location,omitempty"` + + // Deployment tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// DeploymentExportResult - The deployment export result. +type DeploymentExportResult struct { + // The template content. + Template interface{} `json:"template,omitempty"` +} + +// DeploymentExtended - Deployment information. +type DeploymentExtended struct { + // the location of the deployment. + Location *string `json:"location,omitempty"` + + // Deployment properties. + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` + + // Deployment tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The ID of the deployment. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the deployment. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the deployment. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DeploymentExtendedFilter - Deployment filter. +type DeploymentExtendedFilter struct { + // The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// DeploymentListResult - List of deployments. +type DeploymentListResult struct { + // An array of deployments. + Value []*DeploymentExtended `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DeploymentOperation - Deployment operation information. +type DeploymentOperation struct { + // Deployment properties. + Properties *DeploymentOperationProperties `json:"properties,omitempty"` + + // READ-ONLY; Full deployment operation ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Deployment operation ID. + OperationID *string `json:"operationId,omitempty" azure:"ro"` +} + +// DeploymentOperationProperties - Deployment operation properties. +type DeploymentOperationProperties struct { + // READ-ONLY; The duration of the operation. + Duration *string `json:"duration,omitempty" azure:"ro"` + + // READ-ONLY; The name of the current provisioning operation. + ProvisioningOperation *ProvisioningOperation `json:"provisioningOperation,omitempty" azure:"ro"` + + // READ-ONLY; The state of the provisioning. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The HTTP request message. + Request *HTTPMessage `json:"request,omitempty" azure:"ro"` + + // READ-ONLY; The HTTP response message. + Response *HTTPMessage `json:"response,omitempty" azure:"ro"` + + // READ-ONLY; Deployment operation service request id. + ServiceRequestID *string `json:"serviceRequestId,omitempty" azure:"ro"` + + // READ-ONLY; Operation status code from the resource provider. This property may not be set if a response has not yet been + // received. + StatusCode *string `json:"statusCode,omitempty" azure:"ro"` + + // READ-ONLY; Operation status message from the resource provider. This property is optional. It will only be provided if + // an error was received from the resource provider. + StatusMessage *StatusMessage `json:"statusMessage,omitempty" azure:"ro"` + + // READ-ONLY; The target resource. + TargetResource *TargetResource `json:"targetResource,omitempty" azure:"ro"` + + // READ-ONLY; The date and time of the operation. + Timestamp *time.Time `json:"timestamp,omitempty" azure:"ro"` +} + +// DeploymentOperationsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtManagementGroupScope +// method. +type DeploymentOperationsClientGetAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtScope +// method. +type DeploymentOperationsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtSubscriptionScope +// method. +type DeploymentOperationsClientGetAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.GetAtTenantScope +// method. +type DeploymentOperationsClientGetAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientGetOptions contains the optional parameters for the DeploymentOperationsClient.Get method. +type DeploymentOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentOperationsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtManagementGroupScope +// method. +type DeploymentOperationsClientListAtManagementGroupScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtScope +// method. +type DeploymentOperationsClientListAtScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtSubscriptionScope +// method. +type DeploymentOperationsClientListAtSubscriptionScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentOperationsClient.ListAtTenantScope +// method. +type DeploymentOperationsClientListAtTenantScopeOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsClientListOptions contains the optional parameters for the DeploymentOperationsClient.List method. +type DeploymentOperationsClientListOptions struct { + // The number of results to return. + Top *int32 +} + +// DeploymentOperationsListResult - List of deployment operations. +type DeploymentOperationsListResult struct { + // An array of deployment operations. + Value []*DeploymentOperation `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// DeploymentProperties - Deployment properties. +type DeploymentProperties struct { + // REQUIRED; The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, + // resources are deployed without deleting existing resources that are not included in + // the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included + // in the template are deleted. Be careful when using Complete mode as you may + // unintentionally delete resources. + Mode *DeploymentMode `json:"mode,omitempty"` + + // The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + + // Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable + // to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` + + // The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + + // Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide + // the parameter values directly in the request rather than link to an existing + // parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or + // a well formed JSON string. + Parameters interface{} `json:"parameters,omitempty"` + + // The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink + // property or the parameters property, but not both. + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + + // The template content. You use this element when you want to pass the template syntax directly in the request rather than + // link to an existing template. It can be a JObject or well-formed JSON string. + // Use either the templateLink property or the template property, but not both. + Template interface{} `json:"template,omitempty"` + + // The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink `json:"templateLink,omitempty"` +} + +// DeploymentPropertiesExtended - Deployment properties with additional details. +type DeploymentPropertiesExtended struct { + // READ-ONLY; The correlation ID of the deployment. + CorrelationID *string `json:"correlationId,omitempty" azure:"ro"` + + // READ-ONLY; The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty" azure:"ro"` + + // READ-ONLY; The list of deployment dependencies. + Dependencies []*Dependency `json:"dependencies,omitempty" azure:"ro"` + + // READ-ONLY; The duration of the template deployment. + Duration *string `json:"duration,omitempty" azure:"ro"` + + // READ-ONLY; The deployment error. + Error *ErrorResponse `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The deployment mode. Possible values are Incremental and Complete. + Mode *DeploymentMode `json:"mode,omitempty" azure:"ro"` + + // READ-ONLY; The deployment on error behavior. + OnErrorDeployment *OnErrorDeploymentExtended `json:"onErrorDeployment,omitempty" azure:"ro"` + + // READ-ONLY; Array of provisioned resources. + OutputResources []*ResourceReference `json:"outputResources,omitempty" azure:"ro"` + + // READ-ONLY; Key/value pairs that represent deployment output. + Outputs interface{} `json:"outputs,omitempty" azure:"ro"` + + // READ-ONLY; Deployment parameters. + Parameters interface{} `json:"parameters,omitempty" azure:"ro"` + + // READ-ONLY; The URI referencing the parameters. + ParametersLink *ParametersLink `json:"parametersLink,omitempty" azure:"ro"` + + // READ-ONLY; The list of resource providers needed for the deployment. + Providers []*Provider `json:"providers,omitempty" azure:"ro"` + + // READ-ONLY; Denotes the state of provisioning. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The hash produced for the template. + TemplateHash *string `json:"templateHash,omitempty" azure:"ro"` + + // READ-ONLY; The URI referencing the template. + TemplateLink *TemplateLink `json:"templateLink,omitempty" azure:"ro"` + + // READ-ONLY; The timestamp of the template deployment. + Timestamp *time.Time `json:"timestamp,omitempty" azure:"ro"` + + // READ-ONLY; Array of validated resources. + ValidatedResources []*ResourceReference `json:"validatedResources,omitempty" azure:"ro"` +} + +// DeploymentValidateResult - Information from validate template deployment response. +type DeploymentValidateResult struct { + // The template deployment properties. + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` + + // READ-ONLY; The deployment validation error. + Error *ErrorResponse `json:"error,omitempty" azure:"ro"` +} + +// DeploymentWhatIf - Deployment What-if operation parameters. +type DeploymentWhatIf struct { + // REQUIRED; The deployment properties. + Properties *DeploymentWhatIfProperties `json:"properties,omitempty"` + + // The location to store the deployment data. + Location *string `json:"location,omitempty"` +} + +// DeploymentWhatIfProperties - Deployment What-if properties. +type DeploymentWhatIfProperties struct { + // REQUIRED; The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, + // resources are deployed without deleting existing resources that are not included in + // the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included + // in the template are deleted. Be careful when using Complete mode as you may + // unintentionally delete resources. + Mode *DeploymentMode `json:"mode,omitempty"` + + // The debug setting of the deployment. + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` + + // Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable + // to nested templates. If not specified, default value is outer. + ExpressionEvaluationOptions *ExpressionEvaluationOptions `json:"expressionEvaluationOptions,omitempty"` + + // The deployment on error behavior. + OnErrorDeployment *OnErrorDeployment `json:"onErrorDeployment,omitempty"` + + // Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide + // the parameter values directly in the request rather than link to an existing + // parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or + // a well formed JSON string. + Parameters interface{} `json:"parameters,omitempty"` + + // The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink + // property or the parameters property, but not both. + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + + // The template content. You use this element when you want to pass the template syntax directly in the request rather than + // link to an existing template. It can be a JObject or well-formed JSON string. + // Use either the templateLink property or the template property, but not both. + Template interface{} `json:"template,omitempty"` + + // The URI of the template. Use either the templateLink property or the template property, but not both. + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + + // Optional What-If operation settings. + WhatIfSettings *DeploymentWhatIfSettings `json:"whatIfSettings,omitempty"` +} + +// DeploymentWhatIfSettings - Deployment What-If operation settings. +type DeploymentWhatIfSettings struct { + // The format of the What-If results + ResultFormat *WhatIfResultFormat `json:"resultFormat,omitempty"` +} + +// DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtManagementGroupScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtSubscriptionScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdateAtTenantScope +// method. +type DeploymentsClientBeginCreateOrUpdateAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate +// method. +type DeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtManagementGroupScope +// method. +type DeploymentsClientBeginDeleteAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtScope +// method. +type DeploymentsClientBeginDeleteAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtSubscriptionScope +// method. +type DeploymentsClientBeginDeleteAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginDeleteAtTenantScope +// method. +type DeploymentsClientBeginDeleteAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. +type DeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtManagementGroupScope +// method. +type DeploymentsClientBeginValidateAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtScope +// method. +type DeploymentsClientBeginValidateAtScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtSubscriptionScope +// method. +type DeploymentsClientBeginValidateAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginValidateAtTenantScope +// method. +type DeploymentsClientBeginValidateAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginValidateOptions contains the optional parameters for the DeploymentsClient.BeginValidate method. +type DeploymentsClientBeginValidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtManagementGroupScope +// method. +type DeploymentsClientBeginWhatIfAtManagementGroupScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtSubscriptionScope +// method. +type DeploymentsClientBeginWhatIfAtSubscriptionScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.BeginWhatIfAtTenantScope +// method. +type DeploymentsClientBeginWhatIfAtTenantScopeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginWhatIfOptions contains the optional parameters for the DeploymentsClient.BeginWhatIf method. +type DeploymentsClientBeginWhatIfOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientCalculateTemplateHashOptions contains the optional parameters for the DeploymentsClient.CalculateTemplateHash +// method. +type DeploymentsClientCalculateTemplateHashOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtManagementGroupScope +// method. +type DeploymentsClientCancelAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtScope method. +type DeploymentsClientCancelAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtSubscriptionScope +// method. +type DeploymentsClientCancelAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CancelAtTenantScope +// method. +type DeploymentsClientCancelAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCancelOptions contains the optional parameters for the DeploymentsClient.Cancel method. +type DeploymentsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtManagementGroupScope +// method. +type DeploymentsClientCheckExistenceAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtScope +// method. +type DeploymentsClientCheckExistenceAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtSubscriptionScope +// method. +type DeploymentsClientCheckExistenceAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.CheckExistenceAtTenantScope +// method. +type DeploymentsClientCheckExistenceAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientCheckExistenceOptions contains the optional parameters for the DeploymentsClient.CheckExistence method. +type DeploymentsClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtManagementGroupScope +// method. +type DeploymentsClientExportTemplateAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtScope +// method. +type DeploymentsClientExportTemplateAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtSubscriptionScope +// method. +type DeploymentsClientExportTemplateAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ExportTemplateAtTenantScope +// method. +type DeploymentsClientExportTemplateAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientExportTemplateOptions contains the optional parameters for the DeploymentsClient.ExportTemplate method. +type DeploymentsClientExportTemplateOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.GetAtManagementGroupScope +// method. +type DeploymentsClientGetAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtScopeOptions contains the optional parameters for the DeploymentsClient.GetAtScope method. +type DeploymentsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.GetAtSubscriptionScope +// method. +type DeploymentsClientGetAtSubscriptionScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.GetAtTenantScope method. +type DeploymentsClientGetAtTenantScopeOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. +type DeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientListAtManagementGroupScopeOptions contains the optional parameters for the DeploymentsClient.ListAtManagementGroupScope +// method. +type DeploymentsClientListAtManagementGroupScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtScopeOptions contains the optional parameters for the DeploymentsClient.ListAtScope method. +type DeploymentsClientListAtScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtSubscriptionScopeOptions contains the optional parameters for the DeploymentsClient.ListAtSubscriptionScope +// method. +type DeploymentsClientListAtSubscriptionScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListAtTenantScopeOptions contains the optional parameters for the DeploymentsClient.ListAtTenantScope +// method. +type DeploymentsClientListAtTenantScopeOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// DeploymentsClientListByResourceGroupOptions contains the optional parameters for the DeploymentsClient.ListByResourceGroup +// method. +type DeploymentsClientListByResourceGroupOptions struct { + // The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + Filter *string + // The number of results to get. If null is passed, returns all deployments. + Top *int32 +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorResponse `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ExportTemplateRequest - Export resource group template request parameters. +type ExportTemplateRequest struct { + // The export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', + // 'IncludeComments', 'SkipResourceNameParameterization', + // 'SkipAllParameterization' + Options *string `json:"options,omitempty"` + + // The IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + Resources []*string `json:"resources,omitempty"` +} + +// ExpressionEvaluationOptions - Specifies whether template expressions are evaluated within the scope of the parent template +// or nested template. +type ExpressionEvaluationOptions struct { + // The scope to be used for evaluation of parameters, variables and functions in a nested template. + Scope *ExpressionEvaluationOptionsScopeType `json:"scope,omitempty"` +} + +// ExtendedLocation - Resource extended location. +type ExtendedLocation struct { + // The extended location name. + Name *string `json:"name,omitempty"` + + // The extended location type. + Type *ExtendedLocationType `json:"type,omitempty"` +} + +// GenericResource - Resource information. +type GenericResource struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + + // The kind of the resource. + Kind *string `json:"kind,omitempty"` + + // Resource location + Location *string `json:"location,omitempty"` + + // ID of the resource that manages this resource. + ManagedBy *string `json:"managedBy,omitempty"` + + // The plan of the resource. + Plan *Plan `json:"plan,omitempty"` + + // The resource properties. + Properties interface{} `json:"properties,omitempty"` + + // The SKU of the resource. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource ID + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GenericResourceExpanded - Resource information. +type GenericResourceExpanded struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + + // The kind of the resource. + Kind *string `json:"kind,omitempty"` + + // Resource location + Location *string `json:"location,omitempty"` + + // ID of the resource that manages this resource. + ManagedBy *string `json:"managedBy,omitempty"` + + // The plan of the resource. + Plan *Plan `json:"plan,omitempty"` + + // The resource properties. + Properties interface{} `json:"properties,omitempty"` + + // The SKU of the resource. + SKU *SKU `json:"sku,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The changed time of the resource. This is only present if requested via the $expand query parameter. + ChangedTime *time.Time `json:"changedTime,omitempty" azure:"ro"` + + // READ-ONLY; The created time of the resource. This is only present if requested via the $expand query parameter. + CreatedTime *time.Time `json:"createdTime,omitempty" azure:"ro"` + + // READ-ONLY; Resource ID + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. This is only present if requested via the $expand query parameter. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GenericResourceFilter - Resource filter. +type GenericResourceFilter struct { + // The resource type. + ResourceType *string `json:"resourceType,omitempty"` + + // The tag name. + Tagname *string `json:"tagname,omitempty"` + + // The tag value. + Tagvalue *string `json:"tagvalue,omitempty"` +} + +// HTTPMessage - HTTP message. +type HTTPMessage struct { + // HTTP message content. + Content interface{} `json:"content,omitempty"` +} + +// Identity for the resource. +type Identity struct { + // The identity type. + Type *ResourceIdentityType `json:"type,omitempty"` + + // The list of user identities associated with the resource. 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,omitempty"` + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +type IdentityUserAssignedIdentitiesValue struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +// MoveInfo - Parameters of move resources. +type MoveInfo struct { + // The IDs of the resources. + Resources []*string `json:"resources,omitempty"` + + // The target resource group. + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` +} + +// OnErrorDeployment - Deployment on error behavior. +type OnErrorDeployment struct { + // The deployment to be used on error case. + DeploymentName *string `json:"deploymentName,omitempty"` + + // The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + Type *OnErrorDeploymentType `json:"type,omitempty"` +} + +// OnErrorDeploymentExtended - Deployment on error behavior with additional details. +type OnErrorDeploymentExtended struct { + // The deployment to be used on error case. + DeploymentName *string `json:"deploymentName,omitempty"` + + // The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + Type *OnErrorDeploymentType `json:"type,omitempty"` + + // READ-ONLY; The state of the provisioning for the on error deployment. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// Operation - Microsoft.Resources operation +type Operation struct { + // The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + + // Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` +} + +// OperationDisplay - The object that represents the operation. +type OperationDisplay struct { + // Description of the operation. + Description *string `json:"description,omitempty"` + + // Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + + // Service provider: Microsoft.Resources + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed: Profile, endpoint, etc. + Resource *string `json:"resource,omitempty"` +} + +// OperationListResult - Result of the request to list Microsoft.Resources operations. It contains a list of operations and +// a URL link to get the next set of results. +type OperationListResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of Microsoft.Resources operations. + Value []*Operation `json:"value,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ParametersLink - Entity representing the reference to the deployment parameters. +type ParametersLink struct { + // REQUIRED; The URI of the parameters file. + URI *string `json:"uri,omitempty"` + + // If included, must match the ContentVersion in the template. + ContentVersion *string `json:"contentVersion,omitempty"` +} + +// Permission - Role definition permissions. +type Permission struct { + // Allowed actions. + Actions []*string `json:"actions,omitempty"` + + // Allowed Data actions. + DataActions []*string `json:"dataActions,omitempty"` + + // Denied actions. + NotActions []*string `json:"notActions,omitempty"` + + // Denied Data actions. + NotDataActions []*string `json:"notDataActions,omitempty"` +} + +// Plan for the resource. +type Plan struct { + // The plan ID. + Name *string `json:"name,omitempty"` + + // The offer ID. + Product *string `json:"product,omitempty"` + + // The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` + + // The publisher ID. + Publisher *string `json:"publisher,omitempty"` + + // The plan's version. + Version *string `json:"version,omitempty"` +} + +// Provider - Resource provider information. +type Provider struct { + // The namespace of the resource provider. + Namespace *string `json:"namespace,omitempty"` + + // The provider authorization consent state. + ProviderAuthorizationConsentState *ProviderAuthorizationConsentState `json:"providerAuthorizationConsentState,omitempty"` + + // READ-ONLY; The provider ID. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The registration policy of the resource provider. + RegistrationPolicy *string `json:"registrationPolicy,omitempty" azure:"ro"` + + // READ-ONLY; The registration state of the resource provider. + RegistrationState *string `json:"registrationState,omitempty" azure:"ro"` + + // READ-ONLY; The collection of provider resource types. + ResourceTypes []*ProviderResourceType `json:"resourceTypes,omitempty" azure:"ro"` +} + +// ProviderConsentDefinition - The provider consent. +type ProviderConsentDefinition struct { + // A value indicating whether authorization is consented or not. + ConsentToAuthorization *bool `json:"consentToAuthorization,omitempty"` +} + +// ProviderExtendedLocation - The provider extended location. +type ProviderExtendedLocation struct { + // The extended locations for the azure location. + ExtendedLocations []*string `json:"extendedLocations,omitempty"` + + // The azure location. + Location *string `json:"location,omitempty"` + + // The extended location type. + Type *string `json:"type,omitempty"` +} + +// ProviderListResult - List of resource providers. +type ProviderListResult struct { + // An array of resource providers. + Value []*Provider `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ProviderPermission - The provider permission +type ProviderPermission struct { + // The application id. + ApplicationID *string `json:"applicationId,omitempty"` + + // Role definition properties. + ManagedByRoleDefinition *RoleDefinition `json:"managedByRoleDefinition,omitempty"` + + // The provider authorization consent state. + ProviderAuthorizationConsentState *ProviderAuthorizationConsentState `json:"providerAuthorizationConsentState,omitempty"` + + // Role definition properties. + RoleDefinition *RoleDefinition `json:"roleDefinition,omitempty"` +} + +// ProviderPermissionListResult - List of provider permissions. +type ProviderPermissionListResult struct { + // An array of provider permissions. + Value []*ProviderPermission `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ProviderRegistrationRequest - The provider registration definition. +type ProviderRegistrationRequest struct { + // The provider consent. + ThirdPartyProviderConsent *ProviderConsentDefinition `json:"thirdPartyProviderConsent,omitempty"` +} + +// ProviderResourceType - Resource type managed by the resource provider. +type ProviderResourceType struct { + // The API version. + APIVersions []*string `json:"apiVersions,omitempty"` + + // The aliases that are supported by this resource type. + Aliases []*Alias `json:"aliases,omitempty"` + + // The additional capabilities offered by this resource type. + Capabilities *string `json:"capabilities,omitempty"` + + // The location mappings that are supported by this resource type. + LocationMappings []*ProviderExtendedLocation `json:"locationMappings,omitempty"` + + // The collection of locations where this resource type can be created. + Locations []*string `json:"locations,omitempty"` + + // The properties. + Properties map[string]*string `json:"properties,omitempty"` + + // The resource type. + ResourceType *string `json:"resourceType,omitempty"` + ZoneMappings []*ZoneMapping `json:"zoneMappings,omitempty"` + + // READ-ONLY; The API profiles for the resource provider. + APIProfiles []*APIProfile `json:"apiProfiles,omitempty" azure:"ro"` + + // READ-ONLY; The default API version. + DefaultAPIVersion *string `json:"defaultApiVersion,omitempty" azure:"ro"` +} + +// ProviderResourceTypeListResult - List of resource types of a resource provider. +type ProviderResourceTypeListResult struct { + // An array of resource types. + Value []*ProviderResourceType `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ProviderResourceTypesClientListOptions contains the optional parameters for the ProviderResourceTypesClient.List method. +type ProviderResourceTypesClientListOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientGetAtTenantScopeOptions contains the optional parameters for the ProvidersClient.GetAtTenantScope method. +type ProvidersClientGetAtTenantScopeOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientGetOptions contains the optional parameters for the ProvidersClient.Get method. +type ProvidersClientGetOptions struct { + // The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientListAtTenantScopeOptions contains the optional parameters for the ProvidersClient.ListAtTenantScope method. +type ProvidersClientListAtTenantScopeOptions struct { + // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider + // metadata. To include property aliases in response, use + // $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientListOptions contains the optional parameters for the ProvidersClient.List method. +type ProvidersClientListOptions struct { + // The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider + // metadata. To include property aliases in response, use + // $expand=resourceTypes/aliases. + Expand *string +} + +// ProvidersClientProviderPermissionsOptions contains the optional parameters for the ProvidersClient.ProviderPermissions +// method. +type ProvidersClientProviderPermissionsOptions struct { + // placeholder for future optional parameters +} + +// ProvidersClientRegisterAtManagementGroupScopeOptions contains the optional parameters for the ProvidersClient.RegisterAtManagementGroupScope +// method. +type ProvidersClientRegisterAtManagementGroupScopeOptions struct { + // placeholder for future optional parameters +} + +// ProvidersClientRegisterOptions contains the optional parameters for the ProvidersClient.Register method. +type ProvidersClientRegisterOptions struct { + // The third party consent for S2S. + Properties *ProviderRegistrationRequest +} + +// ProvidersClientUnregisterOptions contains the optional parameters for the ProvidersClient.Unregister method. +type ProvidersClientUnregisterOptions struct { + // placeholder for future optional parameters +} + +// Resource - Specified resource. +type Resource struct { + // Resource extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + // Resource location + Location *string `json:"location,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource ID + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceGroup - Resource group information. +type ResourceGroup struct { + // REQUIRED; The location of the resource group. It cannot be changed after the resource group has been created. It must be + // one of the supported Azure locations. + Location *string `json:"location,omitempty"` + + // The ID of the resource that manages this resource group. + ManagedBy *string `json:"managedBy,omitempty"` + + // The resource group properties. + Properties *ResourceGroupProperties `json:"properties,omitempty"` + + // The tags attached to the resource group. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The ID of the resource group. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource group. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource group. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceGroupExportResult - Resource group export result. +type ResourceGroupExportResult struct { + // The template export error. + Error *ErrorResponse `json:"error,omitempty"` + + // The template content. + Template interface{} `json:"template,omitempty"` +} + +// ResourceGroupFilter - Resource group filter. +type ResourceGroupFilter struct { + // The tag name. + TagName *string `json:"tagName,omitempty"` + + // The tag value. + TagValue *string `json:"tagValue,omitempty"` +} + +// ResourceGroupListResult - List of resource groups. +type ResourceGroupListResult struct { + // An array of resource groups. + Value []*ResourceGroup `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ResourceGroupPatchable - Resource group information. +type ResourceGroupPatchable struct { + // The ID of the resource that manages this resource group. + ManagedBy *string `json:"managedBy,omitempty"` + + // The name of the resource group. + Name *string `json:"name,omitempty"` + + // The resource group properties. + Properties *ResourceGroupProperties `json:"properties,omitempty"` + + // The tags attached to the resource group. + Tags map[string]*string `json:"tags,omitempty"` +} + +// ResourceGroupProperties - The resource group properties. +type ResourceGroupProperties struct { + // READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// ResourceGroupsClientBeginDeleteOptions contains the optional parameters for the ResourceGroupsClient.BeginDelete method. +type ResourceGroupsClientBeginDeleteOptions struct { + // The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets + ForceDeletionTypes *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceGroupsClientBeginExportTemplateOptions contains the optional parameters for the ResourceGroupsClient.BeginExportTemplate +// method. +type ResourceGroupsClientBeginExportTemplateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ResourceGroupsClientCheckExistenceOptions contains the optional parameters for the ResourceGroupsClient.CheckExistence +// method. +type ResourceGroupsClientCheckExistenceOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientCreateOrUpdateOptions contains the optional parameters for the ResourceGroupsClient.CreateOrUpdate +// method. +type ResourceGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. +type ResourceGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourceGroupsClientListOptions contains the optional parameters for the ResourceGroupsClient.List method. +type ResourceGroupsClientListOptions struct { + // The filter to apply on the operation. + // You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' + // and tagValue eq 'Value1' + Filter *string + // The number of results to return. If null is passed, returns all resource groups. + Top *int32 +} + +// ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. +type ResourceGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ResourceListResult - List of resource groups. +type ResourceListResult struct { + // An array of resources. + Value []*GenericResourceExpanded `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ResourceProviderOperationDisplayProperties - Resource provider operation's display properties. +type ResourceProviderOperationDisplayProperties struct { + // Operation description. + Description *string `json:"description,omitempty"` + + // Resource provider operation. + Operation *string `json:"operation,omitempty"` + + // Operation provider. + Provider *string `json:"provider,omitempty"` + + // Operation description. + Publisher *string `json:"publisher,omitempty"` + + // Operation resource. + Resource *string `json:"resource,omitempty"` +} + +// ResourceReference - The resource Id model. +type ResourceReference struct { + // READ-ONLY; The fully qualified resource Id. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// RoleDefinition - Role definition properties. +type RoleDefinition struct { + // The role definition ID. + ID *string `json:"id,omitempty"` + + // If this is a service role. + IsServiceRole *bool `json:"isServiceRole,omitempty"` + + // The role definition name. + Name *string `json:"name,omitempty"` + + // Role definition permissions. + Permissions []*Permission `json:"permissions,omitempty"` + + // Role definition assignable scopes. + Scopes []*string `json:"scopes,omitempty"` +} + +// SKU for the resource. +type SKU struct { + // The SKU capacity. + Capacity *int32 `json:"capacity,omitempty"` + + // The SKU family. + Family *string `json:"family,omitempty"` + + // The SKU model. + Model *string `json:"model,omitempty"` + + // The SKU name. + Name *string `json:"name,omitempty"` + + // The SKU size. + Size *string `json:"size,omitempty"` + + // The SKU tier. + Tier *string `json:"tier,omitempty"` +} + +// ScopedDeployment - Deployment operation parameters. +type ScopedDeployment struct { + // REQUIRED; The location to store the deployment data. + Location *string `json:"location,omitempty"` + + // REQUIRED; The deployment properties. + Properties *DeploymentProperties `json:"properties,omitempty"` + + // Deployment tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// ScopedDeploymentWhatIf - Deployment What-if operation parameters. +type ScopedDeploymentWhatIf struct { + // REQUIRED; The location to store the deployment data. + Location *string `json:"location,omitempty"` + + // REQUIRED; The deployment properties. + Properties *DeploymentWhatIfProperties `json:"properties,omitempty"` +} + +// StatusMessage - Operation status message object. +type StatusMessage struct { + // The error reported by the operation. + Error *ErrorResponse `json:"error,omitempty"` + + // Status of the deployment operation. + Status *string `json:"status,omitempty"` +} + +// SubResource - Sub-resource. +type SubResource struct { + // Resource ID + ID *string `json:"id,omitempty"` +} + +// TagCount - Tag count. +type TagCount struct { + // Type of count. + Type *string `json:"type,omitempty"` + + // Value of count. + Value *int32 `json:"value,omitempty"` +} + +// TagDetails - Tag details. +type TagDetails struct { + // The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, + // the value is 0. + Count *TagCount `json:"count,omitempty"` + + // The tag name. + TagName *string `json:"tagName,omitempty"` + + // The list of tag values. + Values []*TagValue `json:"values,omitempty"` + + // READ-ONLY; The tag name ID. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// TagValue - Tag information. +type TagValue struct { + // The tag value count. + Count *TagCount `json:"count,omitempty"` + + // The tag value. + TagValue *string `json:"tagValue,omitempty"` + + // READ-ONLY; The tag value ID. + ID *string `json:"id,omitempty" azure:"ro"` +} + +// Tags - A dictionary of name and value pairs. +type Tags struct { + // Dictionary of + Tags map[string]*string `json:"tags,omitempty"` +} + +// TagsClientCreateOrUpdateAtScopeOptions contains the optional parameters for the TagsClient.CreateOrUpdateAtScope method. +type TagsClientCreateOrUpdateAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientCreateOrUpdateOptions contains the optional parameters for the TagsClient.CreateOrUpdate method. +type TagsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TagsClientCreateOrUpdateValueOptions contains the optional parameters for the TagsClient.CreateOrUpdateValue method. +type TagsClientCreateOrUpdateValueOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteAtScopeOptions contains the optional parameters for the TagsClient.DeleteAtScope method. +type TagsClientDeleteAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteOptions contains the optional parameters for the TagsClient.Delete method. +type TagsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TagsClientDeleteValueOptions contains the optional parameters for the TagsClient.DeleteValue method. +type TagsClientDeleteValueOptions struct { + // placeholder for future optional parameters +} + +// TagsClientGetAtScopeOptions contains the optional parameters for the TagsClient.GetAtScope method. +type TagsClientGetAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsClientListOptions contains the optional parameters for the TagsClient.List method. +type TagsClientListOptions struct { + // placeholder for future optional parameters +} + +// TagsClientUpdateAtScopeOptions contains the optional parameters for the TagsClient.UpdateAtScope method. +type TagsClientUpdateAtScopeOptions struct { + // placeholder for future optional parameters +} + +// TagsListResult - List of subscription tags. +type TagsListResult struct { + // An array of tags. + Value []*TagDetails `json:"value,omitempty"` + + // READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// TagsPatchResource - Wrapper resource for tags patch API request only. +type TagsPatchResource struct { + // The operation type for the patch API. + Operation *TagsPatchOperation `json:"operation,omitempty"` + + // The set of tags. + Properties *Tags `json:"properties,omitempty"` +} + +// TagsResource - Wrapper resource for tags API requests and responses. +type TagsResource struct { + // REQUIRED; The set of tags. + Properties *Tags `json:"properties,omitempty"` + + // READ-ONLY; The ID of the tags wrapper resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the tags wrapper resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the tags wrapper resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// TargetResource - Target resource. +type TargetResource struct { + // The ID of the resource. + ID *string `json:"id,omitempty"` + + // The name of the resource. + ResourceName *string `json:"resourceName,omitempty"` + + // The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` +} + +// TemplateHashResult - Result of the request to calculate template hash. It contains a string of minified template and its +// hash. +type TemplateHashResult struct { + // The minified template string. + MinifiedTemplate *string `json:"minifiedTemplate,omitempty"` + + // The template hash. + TemplateHash *string `json:"templateHash,omitempty"` +} + +// TemplateLink - Entity representing the reference to the template. +type TemplateLink struct { + // If included, must match the ContentVersion in the template. + ContentVersion *string `json:"contentVersion,omitempty"` + + // The resource id of a Template Spec. Use either the id or uri property, but not both. + ID *string `json:"id,omitempty"` + + // The query string (for example, a SAS token) to be used with the templateLink URI. + QueryString *string `json:"queryString,omitempty"` + + // The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template + // was linked with a TemplateSpec, this will reference an artifact in the + // TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath + // URIs + RelativePath *string `json:"relativePath,omitempty"` + + // The URI of the template to deploy. Use either the uri or id property, but not both. + URI *string `json:"uri,omitempty"` +} + +// WhatIfChange - Information about a single resource change predicted by What-If operation. +type WhatIfChange struct { + // REQUIRED; Type of change that will be made to the resource when the deployment is executed. + ChangeType *ChangeType `json:"changeType,omitempty"` + + // REQUIRED; Resource ID + ResourceID *string `json:"resourceId,omitempty"` + + // The predicted snapshot of the resource after the deployment is executed. + After interface{} `json:"after,omitempty"` + + // The snapshot of the resource before the deployment is executed. + Before interface{} `json:"before,omitempty"` + + // The predicted changes to resource properties. + Delta []*WhatIfPropertyChange `json:"delta,omitempty"` + + // The explanation about why the resource is unsupported by What-If. + UnsupportedReason *string `json:"unsupportedReason,omitempty"` +} + +// WhatIfOperationProperties - Deployment operation properties. +type WhatIfOperationProperties struct { + // List of resource changes predicted by What-If operation. + Changes []*WhatIfChange `json:"changes,omitempty"` +} + +// WhatIfOperationResult - Result of the What-If operation. Contains a list of predicted changes and a URL link to get to +// the next set of results. +type WhatIfOperationResult struct { + // Error when What-If operation fails. + Error *ErrorResponse `json:"error,omitempty"` + + // What-If operation properties. + Properties *WhatIfOperationProperties `json:"properties,omitempty"` + + // Status of the What-If operation. + Status *string `json:"status,omitempty"` +} + +// WhatIfPropertyChange - The predicted change to the resource property. +type WhatIfPropertyChange struct { + // REQUIRED; The path of the property. + Path *string `json:"path,omitempty"` + + // REQUIRED; The type of property change. + PropertyChangeType *PropertyChangeType `json:"propertyChangeType,omitempty"` + + // The value of the property after the deployment is executed. + After interface{} `json:"after,omitempty"` + + // The value of the property before the deployment is executed. + Before interface{} `json:"before,omitempty"` + + // Nested property changes. + Children []*WhatIfPropertyChange `json:"children,omitempty"` +} + +type ZoneMapping struct { + // The location of the zone mapping. + Location *string `json:"location,omitempty"` + Zones []*string `json:"zones,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models_serde.go new file mode 100644 index 000000000..420314dba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_models_serde.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", d.Location) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentOperationProperties. +func (d *DeploymentOperationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, "Duration", &d.Duration) + delete(rawMsg, key) + case "provisioningOperation": + err = unpopulate(val, "ProvisioningOperation", &d.ProvisioningOperation) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &d.Request) + delete(rawMsg, key) + case "response": + err = unpopulate(val, "Response", &d.Response) + delete(rawMsg, key) + case "serviceRequestId": + err = unpopulate(val, "ServiceRequestID", &d.ServiceRequestID) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &d.StatusCode) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &d.StatusMessage) + delete(rawMsg, key) + case "targetResource": + err = unpopulate(val, "TargetResource", &d.TargetResource) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &d.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPropertiesExtended. +func (d *DeploymentPropertiesExtended) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationId": + err = unpopulate(val, "CorrelationID", &d.CorrelationID) + delete(rawMsg, key) + case "debugSetting": + err = unpopulate(val, "DebugSetting", &d.DebugSetting) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &d.Dependencies) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, "Duration", &d.Duration) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &d.Error) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &d.Mode) + delete(rawMsg, key) + case "onErrorDeployment": + err = unpopulate(val, "OnErrorDeployment", &d.OnErrorDeployment) + delete(rawMsg, key) + case "outputResources": + err = unpopulate(val, "OutputResources", &d.OutputResources) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, "Outputs", &d.Outputs) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &d.Parameters) + delete(rawMsg, key) + case "parametersLink": + err = unpopulate(val, "ParametersLink", &d.ParametersLink) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &d.Providers) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "templateHash": + err = unpopulate(val, "TemplateHash", &d.TemplateHash) + delete(rawMsg, key) + case "templateLink": + err = unpopulate(val, "TemplateLink", &d.TemplateLink) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &d.Timestamp) + delete(rawMsg, key) + case "validatedResources": + err = unpopulate(val, "ValidatedResources", &d.ValidatedResources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportTemplateRequest. +func (e ExportTemplateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "options", e.Options) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GenericResource. +func (g GenericResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", g.ExtendedLocation) + populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "kind", g.Kind) + populate(objectMap, "location", g.Location) + populate(objectMap, "managedBy", g.ManagedBy) + populate(objectMap, "name", g.Name) + populate(objectMap, "plan", g.Plan) + populate(objectMap, "properties", &g.Properties) + populate(objectMap, "sku", g.SKU) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GenericResourceExpanded. +func (g GenericResourceExpanded) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "changedTime", g.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", g.CreatedTime) + populate(objectMap, "extendedLocation", g.ExtendedLocation) + populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "kind", g.Kind) + populate(objectMap, "location", g.Location) + populate(objectMap, "managedBy", g.ManagedBy) + populate(objectMap, "name", g.Name) + populate(objectMap, "plan", g.Plan) + populate(objectMap, "properties", &g.Properties) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "sku", g.SKU) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericResourceExpanded. +func (g *GenericResourceExpanded) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changedTime": + err = unpopulateTimeRFC3339(val, "ChangedTime", &g.ChangedTime) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &g.CreatedTime) + delete(rawMsg, key) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &g.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &g.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "managedBy": + err = unpopulate(val, "ManagedBy", &g.ManagedBy) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "plan": + err = unpopulate(val, "Plan", &g.Plan) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type MoveInfo. +func (m MoveInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resources", m.Resources) + populate(objectMap, "targetResourceGroup", m.TargetResourceGroup) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocation", r.ExtendedLocation) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGroup. +func (r ResourceGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "managedBy", r.ManagedBy) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupPatchable. +func (r ResourceGroupPatchable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managedBy", r.ManagedBy) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ScopedDeployment. +func (s ScopedDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", s.Location) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type TagsPatchResource. +func (t TagsPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operation", t.Operation) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go new file mode 100644 index 000000000..2caf64262 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists all of the available Microsoft.Resources REST API operations. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Resources/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go new file mode 100644 index 000000000..59edcdeec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProviderResourceTypesClient contains the methods for the ProviderResourceTypes group. +// Don't use this type directly, use NewProviderResourceTypesClient() instead. +type ProviderResourceTypesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProviderResourceTypesClient creates a new instance of ProviderResourceTypesClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewProviderResourceTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderResourceTypesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProviderResourceTypesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// List - List the resource types for a specified resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider. +// options - ProviderResourceTypesClientListOptions contains the optional parameters for the ProviderResourceTypesClient.List +// method. +func (client *ProviderResourceTypesClient) List(ctx context.Context, resourceProviderNamespace string, options *ProviderResourceTypesClientListOptions) (ProviderResourceTypesClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProviderResourceTypesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProviderResourceTypesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProviderResourceTypesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *ProviderResourceTypesClient) listCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProviderResourceTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProviderResourceTypesClient) listHandleResponse(resp *http.Response) (ProviderResourceTypesClientListResponse, error) { + result := ProviderResourceTypesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderResourceTypeListResult); err != nil { + return ProviderResourceTypesClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go new file mode 100644 index 000000000..bace22027 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go @@ -0,0 +1,482 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProvidersClient contains the methods for the Providers group. +// Don't use this type directly, use NewProvidersClient() instead. +type ProvidersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProvidersClient creates a new instance of ProvidersClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProvidersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProvidersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets the specified resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider. +// options - ProvidersClientGetOptions contains the optional parameters for the ProvidersClient.Get method. +func (client *ProvidersClient) Get(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetOptions) (ProvidersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProvidersClient) getCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProvidersClient) getHandleResponse(resp *http.Response) (ProvidersClientGetResponse, error) { + result := ProvidersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { + return ProvidersClientGetResponse{}, err + } + return result, nil +} + +// GetAtTenantScope - Gets the specified resource provider at the tenant level. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider. +// options - ProvidersClientGetAtTenantScopeOptions contains the optional parameters for the ProvidersClient.GetAtTenantScope +// method. +func (client *ProvidersClient) GetAtTenantScope(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetAtTenantScopeOptions) (ProvidersClientGetAtTenantScopeResponse, error) { + req, err := client.getAtTenantScopeCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientGetAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientGetAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientGetAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtTenantScopeHandleResponse(resp) +} + +// getAtTenantScopeCreateRequest creates the GetAtTenantScope request. +func (client *ProvidersClient) getAtTenantScopeCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientGetAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers/{resourceProviderNamespace}" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtTenantScopeHandleResponse handles the GetAtTenantScope response. +func (client *ProvidersClient) getAtTenantScopeHandleResponse(resp *http.Response) (ProvidersClientGetAtTenantScopeResponse, error) { + result := ProvidersClientGetAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { + return ProvidersClientGetAtTenantScopeResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all resource providers for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - ProvidersClientListOptions contains the optional parameters for the ProvidersClient.List method. +func (client *ProvidersClient) NewListPager(options *ProvidersClientListOptions) *runtime.Pager[ProvidersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProvidersClientListResponse]{ + More: func(page ProvidersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProvidersClientListResponse) (ProvidersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProvidersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ProvidersClient) listCreateRequest(ctx context.Context, options *ProvidersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProvidersClient) listHandleResponse(resp *http.Response) (ProvidersClientListResponse, error) { + result := ProvidersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderListResult); err != nil { + return ProvidersClientListResponse{}, err + } + return result, nil +} + +// NewListAtTenantScopePager - Gets all resource providers for the tenant. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - ProvidersClientListAtTenantScopeOptions contains the optional parameters for the ProvidersClient.ListAtTenantScope +// method. +func (client *ProvidersClient) NewListAtTenantScopePager(options *ProvidersClientListAtTenantScopeOptions) *runtime.Pager[ProvidersClientListAtTenantScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[ProvidersClientListAtTenantScopeResponse]{ + More: func(page ProvidersClientListAtTenantScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProvidersClientListAtTenantScopeResponse) (ProvidersClientListAtTenantScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAtTenantScopeCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProvidersClientListAtTenantScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientListAtTenantScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientListAtTenantScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtTenantScopeHandleResponse(resp) + }, + }) +} + +// listAtTenantScopeCreateRequest creates the ListAtTenantScope request. +func (client *ProvidersClient) listAtTenantScopeCreateRequest(ctx context.Context, options *ProvidersClientListAtTenantScopeOptions) (*policy.Request, error) { + urlPath := "/providers" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtTenantScopeHandleResponse handles the ListAtTenantScope response. +func (client *ProvidersClient) listAtTenantScopeHandleResponse(resp *http.Response) (ProvidersClientListAtTenantScopeResponse, error) { + result := ProvidersClientListAtTenantScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderListResult); err != nil { + return ProvidersClientListAtTenantScopeResponse{}, err + } + return result, nil +} + +// ProviderPermissions - Get the provider permissions. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider. +// options - ProvidersClientProviderPermissionsOptions contains the optional parameters for the ProvidersClient.ProviderPermissions +// method. +func (client *ProvidersClient) ProviderPermissions(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientProviderPermissionsOptions) (ProvidersClientProviderPermissionsResponse, error) { + req, err := client.providerPermissionsCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientProviderPermissionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientProviderPermissionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientProviderPermissionsResponse{}, runtime.NewResponseError(resp) + } + return client.providerPermissionsHandleResponse(resp) +} + +// providerPermissionsCreateRequest creates the ProviderPermissions request. +func (client *ProvidersClient) providerPermissionsCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientProviderPermissionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// providerPermissionsHandleResponse handles the ProviderPermissions response. +func (client *ProvidersClient) providerPermissionsHandleResponse(resp *http.Response) (ProvidersClientProviderPermissionsResponse, error) { + result := ProvidersClientProviderPermissionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderPermissionListResult); err != nil { + return ProvidersClientProviderPermissionsResponse{}, err + } + return result, nil +} + +// Register - Registers a subscription with a resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider to register. +// options - ProvidersClientRegisterOptions contains the optional parameters for the ProvidersClient.Register method. +func (client *ProvidersClient) Register(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientRegisterOptions) (ProvidersClientRegisterResponse, error) { + req, err := client.registerCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientRegisterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientRegisterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientRegisterResponse{}, runtime.NewResponseError(resp) + } + return client.registerHandleResponse(resp) +} + +// registerCreateRequest creates the Register request. +func (client *ProvidersClient) registerCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientRegisterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Properties != nil { + return req, runtime.MarshalAsJSON(req, *options.Properties) + } + return req, nil +} + +// registerHandleResponse handles the Register response. +func (client *ProvidersClient) registerHandleResponse(resp *http.Response) (ProvidersClientRegisterResponse, error) { + result := ProvidersClientRegisterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { + return ProvidersClientRegisterResponse{}, err + } + return result, nil +} + +// RegisterAtManagementGroupScope - Registers a management group with a resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider to register. +// groupID - The management group ID. +// options - ProvidersClientRegisterAtManagementGroupScopeOptions contains the optional parameters for the ProvidersClient.RegisterAtManagementGroupScope +// method. +func (client *ProvidersClient) RegisterAtManagementGroupScope(ctx context.Context, resourceProviderNamespace string, groupID string, options *ProvidersClientRegisterAtManagementGroupScopeOptions) (ProvidersClientRegisterAtManagementGroupScopeResponse, error) { + req, err := client.registerAtManagementGroupScopeCreateRequest(ctx, resourceProviderNamespace, groupID, options) + if err != nil { + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, runtime.NewResponseError(resp) + } + return ProvidersClientRegisterAtManagementGroupScopeResponse{}, nil +} + +// registerAtManagementGroupScopeCreateRequest creates the RegisterAtManagementGroupScope request. +func (client *ProvidersClient) registerAtManagementGroupScopeCreateRequest(ctx context.Context, resourceProviderNamespace string, groupID string, options *ProvidersClientRegisterAtManagementGroupScopeOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Unregister - Unregisters a subscription from a resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceProviderNamespace - The namespace of the resource provider to unregister. +// options - ProvidersClientUnregisterOptions contains the optional parameters for the ProvidersClient.Unregister method. +func (client *ProvidersClient) Unregister(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientUnregisterOptions) (ProvidersClientUnregisterResponse, error) { + req, err := client.unregisterCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProvidersClientUnregisterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProvidersClientUnregisterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProvidersClientUnregisterResponse{}, runtime.NewResponseError(resp) + } + return client.unregisterHandleResponse(resp) +} + +// unregisterCreateRequest creates the Unregister request. +func (client *ProvidersClient) unregisterCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientUnregisterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister" + if resourceProviderNamespace == "" { + return nil, errors.New("parameter resourceProviderNamespace cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// unregisterHandleResponse handles the Unregister response. +func (client *ProvidersClient) unregisterHandleResponse(resp *http.Response) (ProvidersClientUnregisterResponse, error) { + result := ProvidersClientUnregisterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { + return ProvidersClientUnregisterResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go new file mode 100644 index 000000000..8b16764d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ResourceGroupsClient contains the methods for the ResourceGroups group. +// Don't use this type directly, use NewResourceGroupsClient() instead. +type ResourceGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewResourceGroupsClient creates a new instance of ResourceGroupsClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewResourceGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ResourceGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckExistence - Checks whether a resource group exists. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to check. The name is case insensitive. +// options - ResourceGroupsClientCheckExistenceOptions contains the optional parameters for the ResourceGroupsClient.CheckExistence +// method. +func (client *ResourceGroupsClient) CheckExistence(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientCheckExistenceOptions) (ResourceGroupsClientCheckExistenceResponse, error) { + req, err := client.checkExistenceCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ResourceGroupsClientCheckExistenceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGroupsClientCheckExistenceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent, http.StatusNotFound) { + return ResourceGroupsClientCheckExistenceResponse{}, runtime.NewResponseError(resp) + } + return ResourceGroupsClientCheckExistenceResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil +} + +// checkExistenceCreateRequest creates the CheckExistence request. +func (client *ResourceGroupsClient) checkExistenceCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientCheckExistenceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CreateOrUpdate - Creates or updates a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, +// hyphen, period (except at end), and Unicode characters that match the allowed characters. +// parameters - Parameters supplied to the create or update a resource group. +// options - ResourceGroupsClientCreateOrUpdateOptions contains the optional parameters for the ResourceGroupsClient.CreateOrUpdate +// method. +func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters ResourceGroup, options *ResourceGroupsClientCreateOrUpdateOptions) (ResourceGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ResourceGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parameters ResourceGroup, options *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ResourceGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ResourceGroupsClientCreateOrUpdateResponse, error) { + result := ResourceGroupsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { + return ResourceGroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes +// all of its template deployments and currently stored operations. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to delete. The name is case insensitive. +// options - ResourceGroupsClientBeginDeleteOptions contains the optional parameters for the ResourceGroupsClient.BeginDelete +// method. +func (client *ResourceGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientBeginDeleteOptions) (*runtime.Poller[ResourceGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ResourceGroupsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ResourceGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all +// of its template deployments and currently stored operations. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *ResourceGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.ForceDeletionTypes != nil { + reqQP.Set("forceDeletionTypes", *options.ForceDeletionTypes) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExportTemplate - Captures the specified resource group as a template. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// parameters - Parameters for exporting the template. +// options - ResourceGroupsClientBeginExportTemplateOptions contains the optional parameters for the ResourceGroupsClient.BeginExportTemplate +// method. +func (client *ResourceGroupsClient) BeginExportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest, options *ResourceGroupsClientBeginExportTemplateOptions) (*runtime.Poller[ResourceGroupsClientExportTemplateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.exportTemplate(ctx, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ResourceGroupsClientExportTemplateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ResourceGroupsClientExportTemplateResponse](options.ResumeToken, client.pl, nil) + } +} + +// ExportTemplate - Captures the specified resource group as a template. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +func (client *ResourceGroupsClient) exportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest, options *ResourceGroupsClientBeginExportTemplateOptions) (*http.Response, error) { + req, err := client.exportTemplateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// exportTemplateCreateRequest creates the ExportTemplate request. +func (client *ResourceGroupsClient) exportTemplateCreateRequest(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest, options *ResourceGroupsClientBeginExportTemplateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Get - Gets a resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to get. The name is case insensitive. +// options - ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. +func (client *ResourceGroupsClient) Get(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientGetOptions) (ResourceGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return ResourceGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ResourceGroupsClient) getHandleResponse(resp *http.Response) (ResourceGroupsClientGetResponse, error) { + result := ResourceGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { + return ResourceGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all the resource groups for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - ResourceGroupsClientListOptions contains the optional parameters for the ResourceGroupsClient.List method. +func (client *ResourceGroupsClient) NewListPager(options *ResourceGroupsClientListOptions) *runtime.Pager[ResourceGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceGroupsClientListResponse]{ + More: func(page ResourceGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceGroupsClientListResponse) (ResourceGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ResourceGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, options *ResourceGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (ResourceGroupsClientListResponse, error) { + result := ResourceGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroupListResult); err != nil { + return ResourceGroupsClientListResponse{}, err + } + return result, nil +} + +// Update - Resource groups can be updated through a simple PATCH operation to a group address. The format of the request +// is the same as that for creating a resource group. If a field is unspecified, the current +// value is retained. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// resourceGroupName - The name of the resource group to update. The name is case insensitive. +// parameters - Parameters supplied to update a resource group. +// options - ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. +func (client *ResourceGroupsClient) Update(ctx context.Context, resourceGroupName string, parameters ResourceGroupPatchable, options *ResourceGroupsClientUpdateOptions) (ResourceGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, parameters, options) + if err != nil { + return ResourceGroupsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, parameters ResourceGroupPatchable, options *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *ResourceGroupsClient) updateHandleResponse(resp *http.Response) (ResourceGroupsClientUpdateResponse, error) { + result := ResourceGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { + return ResourceGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go new file mode 100644 index 000000000..ab05392e5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go @@ -0,0 +1,492 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +// ClientCheckExistenceByIDResponse contains the response from method Client.CheckExistenceByID. +type ClientCheckExistenceByIDResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// ClientCheckExistenceResponse contains the response from method Client.CheckExistence. +type ClientCheckExistenceResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// ClientCreateOrUpdateByIDResponse contains the response from method Client.CreateOrUpdateByID. +type ClientCreateOrUpdateByIDResponse struct { + GenericResource +} + +// ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. +type ClientCreateOrUpdateResponse struct { + GenericResource +} + +// ClientDeleteByIDResponse contains the response from method Client.DeleteByID. +type ClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// ClientDeleteResponse contains the response from method Client.Delete. +type ClientDeleteResponse struct { + // placeholder for future response values +} + +// ClientGetByIDResponse contains the response from method Client.GetByID. +type ClientGetByIDResponse struct { + GenericResource +} + +// ClientGetResponse contains the response from method Client.Get. +type ClientGetResponse struct { + GenericResource +} + +// ClientListByResourceGroupResponse contains the response from method Client.ListByResourceGroup. +type ClientListByResourceGroupResponse struct { + ResourceListResult +} + +// ClientListResponse contains the response from method Client.List. +type ClientListResponse struct { + ResourceListResult +} + +// ClientMoveResourcesResponse contains the response from method Client.MoveResources. +type ClientMoveResourcesResponse struct { + // placeholder for future response values +} + +// ClientUpdateByIDResponse contains the response from method Client.UpdateByID. +type ClientUpdateByIDResponse struct { + GenericResource +} + +// ClientUpdateResponse contains the response from method Client.Update. +type ClientUpdateResponse struct { + GenericResource +} + +// ClientValidateMoveResourcesResponse contains the response from method Client.ValidateMoveResources. +type ClientValidateMoveResourcesResponse struct { + // placeholder for future response values +} + +// DeploymentOperationsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.GetAtManagementGroupScope. +type DeploymentOperationsClientGetAtManagementGroupScopeResponse struct { + DeploymentOperation +} + +// DeploymentOperationsClientGetAtScopeResponse contains the response from method DeploymentOperationsClient.GetAtScope. +type DeploymentOperationsClientGetAtScopeResponse struct { + DeploymentOperation +} + +// DeploymentOperationsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.GetAtSubscriptionScope. +type DeploymentOperationsClientGetAtSubscriptionScopeResponse struct { + DeploymentOperation +} + +// DeploymentOperationsClientGetAtTenantScopeResponse contains the response from method DeploymentOperationsClient.GetAtTenantScope. +type DeploymentOperationsClientGetAtTenantScopeResponse struct { + DeploymentOperation +} + +// DeploymentOperationsClientGetResponse contains the response from method DeploymentOperationsClient.Get. +type DeploymentOperationsClientGetResponse struct { + DeploymentOperation +} + +// DeploymentOperationsClientListAtManagementGroupScopeResponse contains the response from method DeploymentOperationsClient.ListAtManagementGroupScope. +type DeploymentOperationsClientListAtManagementGroupScopeResponse struct { + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtScopeResponse contains the response from method DeploymentOperationsClient.ListAtScope. +type DeploymentOperationsClientListAtScopeResponse struct { + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtSubscriptionScopeResponse contains the response from method DeploymentOperationsClient.ListAtSubscriptionScope. +type DeploymentOperationsClientListAtSubscriptionScopeResponse struct { + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListAtTenantScopeResponse contains the response from method DeploymentOperationsClient.ListAtTenantScope. +type DeploymentOperationsClientListAtTenantScopeResponse struct { + DeploymentOperationsListResult +} + +// DeploymentOperationsClientListResponse contains the response from method DeploymentOperationsClient.List. +type DeploymentOperationsClientListResponse struct { + DeploymentOperationsListResult +} + +// DeploymentsClientCalculateTemplateHashResponse contains the response from method DeploymentsClient.CalculateTemplateHash. +type DeploymentsClientCalculateTemplateHashResponse struct { + TemplateHashResult +} + +// DeploymentsClientCancelAtManagementGroupScopeResponse contains the response from method DeploymentsClient.CancelAtManagementGroupScope. +type DeploymentsClientCancelAtManagementGroupScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientCancelAtScopeResponse contains the response from method DeploymentsClient.CancelAtScope. +type DeploymentsClientCancelAtScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientCancelAtSubscriptionScopeResponse contains the response from method DeploymentsClient.CancelAtSubscriptionScope. +type DeploymentsClientCancelAtSubscriptionScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientCancelAtTenantScopeResponse contains the response from method DeploymentsClient.CancelAtTenantScope. +type DeploymentsClientCancelAtTenantScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientCancelResponse contains the response from method DeploymentsClient.Cancel. +type DeploymentsClientCancelResponse struct { + // placeholder for future response values +} + +// DeploymentsClientCheckExistenceAtManagementGroupScopeResponse contains the response from method DeploymentsClient.CheckExistenceAtManagementGroupScope. +type DeploymentsClientCheckExistenceAtManagementGroupScopeResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DeploymentsClientCheckExistenceAtScopeResponse contains the response from method DeploymentsClient.CheckExistenceAtScope. +type DeploymentsClientCheckExistenceAtScopeResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DeploymentsClientCheckExistenceAtSubscriptionScopeResponse contains the response from method DeploymentsClient.CheckExistenceAtSubscriptionScope. +type DeploymentsClientCheckExistenceAtSubscriptionScopeResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DeploymentsClientCheckExistenceAtTenantScopeResponse contains the response from method DeploymentsClient.CheckExistenceAtTenantScope. +type DeploymentsClientCheckExistenceAtTenantScopeResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DeploymentsClientCheckExistenceResponse contains the response from method DeploymentsClient.CheckExistence. +type DeploymentsClientCheckExistenceResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.CreateOrUpdateAtManagementGroupScope. +type DeploymentsClientCreateOrUpdateAtManagementGroupScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtScopeResponse contains the response from method DeploymentsClient.CreateOrUpdateAtScope. +type DeploymentsClientCreateOrUpdateAtScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.CreateOrUpdateAtSubscriptionScope. +type DeploymentsClientCreateOrUpdateAtSubscriptionScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateAtTenantScopeResponse contains the response from method DeploymentsClient.CreateOrUpdateAtTenantScope. +type DeploymentsClientCreateOrUpdateAtTenantScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.CreateOrUpdate. +type DeploymentsClientCreateOrUpdateResponse struct { + DeploymentExtended +} + +// DeploymentsClientDeleteAtManagementGroupScopeResponse contains the response from method DeploymentsClient.DeleteAtManagementGroupScope. +type DeploymentsClientDeleteAtManagementGroupScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtScopeResponse contains the response from method DeploymentsClient.DeleteAtScope. +type DeploymentsClientDeleteAtScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtSubscriptionScopeResponse contains the response from method DeploymentsClient.DeleteAtSubscriptionScope. +type DeploymentsClientDeleteAtSubscriptionScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteAtTenantScopeResponse contains the response from method DeploymentsClient.DeleteAtTenantScope. +type DeploymentsClientDeleteAtTenantScopeResponse struct { + // placeholder for future response values +} + +// DeploymentsClientDeleteResponse contains the response from method DeploymentsClient.Delete. +type DeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// DeploymentsClientExportTemplateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtManagementGroupScope. +type DeploymentsClientExportTemplateAtManagementGroupScopeResponse struct { + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtScope. +type DeploymentsClientExportTemplateAtScopeResponse struct { + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtSubscriptionScope. +type DeploymentsClientExportTemplateAtSubscriptionScopeResponse struct { + DeploymentExportResult +} + +// DeploymentsClientExportTemplateAtTenantScopeResponse contains the response from method DeploymentsClient.ExportTemplateAtTenantScope. +type DeploymentsClientExportTemplateAtTenantScopeResponse struct { + DeploymentExportResult +} + +// DeploymentsClientExportTemplateResponse contains the response from method DeploymentsClient.ExportTemplate. +type DeploymentsClientExportTemplateResponse struct { + DeploymentExportResult +} + +// DeploymentsClientGetAtManagementGroupScopeResponse contains the response from method DeploymentsClient.GetAtManagementGroupScope. +type DeploymentsClientGetAtManagementGroupScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientGetAtScopeResponse contains the response from method DeploymentsClient.GetAtScope. +type DeploymentsClientGetAtScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientGetAtSubscriptionScopeResponse contains the response from method DeploymentsClient.GetAtSubscriptionScope. +type DeploymentsClientGetAtSubscriptionScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientGetAtTenantScopeResponse contains the response from method DeploymentsClient.GetAtTenantScope. +type DeploymentsClientGetAtTenantScopeResponse struct { + DeploymentExtended +} + +// DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. +type DeploymentsClientGetResponse struct { + DeploymentExtended +} + +// DeploymentsClientListAtManagementGroupScopeResponse contains the response from method DeploymentsClient.ListAtManagementGroupScope. +type DeploymentsClientListAtManagementGroupScopeResponse struct { + DeploymentListResult +} + +// DeploymentsClientListAtScopeResponse contains the response from method DeploymentsClient.ListAtScope. +type DeploymentsClientListAtScopeResponse struct { + DeploymentListResult +} + +// DeploymentsClientListAtSubscriptionScopeResponse contains the response from method DeploymentsClient.ListAtSubscriptionScope. +type DeploymentsClientListAtSubscriptionScopeResponse struct { + DeploymentListResult +} + +// DeploymentsClientListAtTenantScopeResponse contains the response from method DeploymentsClient.ListAtTenantScope. +type DeploymentsClientListAtTenantScopeResponse struct { + DeploymentListResult +} + +// DeploymentsClientListByResourceGroupResponse contains the response from method DeploymentsClient.ListByResourceGroup. +type DeploymentsClientListByResourceGroupResponse struct { + DeploymentListResult +} + +// DeploymentsClientValidateAtManagementGroupScopeResponse contains the response from method DeploymentsClient.ValidateAtManagementGroupScope. +type DeploymentsClientValidateAtManagementGroupScopeResponse struct { + DeploymentValidateResult +} + +// DeploymentsClientValidateAtScopeResponse contains the response from method DeploymentsClient.ValidateAtScope. +type DeploymentsClientValidateAtScopeResponse struct { + DeploymentValidateResult +} + +// DeploymentsClientValidateAtSubscriptionScopeResponse contains the response from method DeploymentsClient.ValidateAtSubscriptionScope. +type DeploymentsClientValidateAtSubscriptionScopeResponse struct { + DeploymentValidateResult +} + +// DeploymentsClientValidateAtTenantScopeResponse contains the response from method DeploymentsClient.ValidateAtTenantScope. +type DeploymentsClientValidateAtTenantScopeResponse struct { + DeploymentValidateResult +} + +// DeploymentsClientValidateResponse contains the response from method DeploymentsClient.Validate. +type DeploymentsClientValidateResponse struct { + DeploymentValidateResult +} + +// DeploymentsClientWhatIfAtManagementGroupScopeResponse contains the response from method DeploymentsClient.WhatIfAtManagementGroupScope. +type DeploymentsClientWhatIfAtManagementGroupScopeResponse struct { + WhatIfOperationResult +} + +// DeploymentsClientWhatIfAtSubscriptionScopeResponse contains the response from method DeploymentsClient.WhatIfAtSubscriptionScope. +type DeploymentsClientWhatIfAtSubscriptionScopeResponse struct { + WhatIfOperationResult +} + +// DeploymentsClientWhatIfAtTenantScopeResponse contains the response from method DeploymentsClient.WhatIfAtTenantScope. +type DeploymentsClientWhatIfAtTenantScopeResponse struct { + WhatIfOperationResult +} + +// DeploymentsClientWhatIfResponse contains the response from method DeploymentsClient.WhatIf. +type DeploymentsClientWhatIfResponse struct { + WhatIfOperationResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} + +// ProviderResourceTypesClientListResponse contains the response from method ProviderResourceTypesClient.List. +type ProviderResourceTypesClientListResponse struct { + ProviderResourceTypeListResult +} + +// ProvidersClientGetAtTenantScopeResponse contains the response from method ProvidersClient.GetAtTenantScope. +type ProvidersClientGetAtTenantScopeResponse struct { + Provider +} + +// ProvidersClientGetResponse contains the response from method ProvidersClient.Get. +type ProvidersClientGetResponse struct { + Provider +} + +// ProvidersClientListAtTenantScopeResponse contains the response from method ProvidersClient.ListAtTenantScope. +type ProvidersClientListAtTenantScopeResponse struct { + ProviderListResult +} + +// ProvidersClientListResponse contains the response from method ProvidersClient.List. +type ProvidersClientListResponse struct { + ProviderListResult +} + +// ProvidersClientProviderPermissionsResponse contains the response from method ProvidersClient.ProviderPermissions. +type ProvidersClientProviderPermissionsResponse struct { + ProviderPermissionListResult +} + +// ProvidersClientRegisterAtManagementGroupScopeResponse contains the response from method ProvidersClient.RegisterAtManagementGroupScope. +type ProvidersClientRegisterAtManagementGroupScopeResponse struct { + // placeholder for future response values +} + +// ProvidersClientRegisterResponse contains the response from method ProvidersClient.Register. +type ProvidersClientRegisterResponse struct { + Provider +} + +// ProvidersClientUnregisterResponse contains the response from method ProvidersClient.Unregister. +type ProvidersClientUnregisterResponse struct { + Provider +} + +// ResourceGroupsClientCheckExistenceResponse contains the response from method ResourceGroupsClient.CheckExistence. +type ResourceGroupsClientCheckExistenceResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// ResourceGroupsClientCreateOrUpdateResponse contains the response from method ResourceGroupsClient.CreateOrUpdate. +type ResourceGroupsClientCreateOrUpdateResponse struct { + ResourceGroup +} + +// ResourceGroupsClientDeleteResponse contains the response from method ResourceGroupsClient.Delete. +type ResourceGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ResourceGroupsClientExportTemplateResponse contains the response from method ResourceGroupsClient.ExportTemplate. +type ResourceGroupsClientExportTemplateResponse struct { + ResourceGroupExportResult +} + +// ResourceGroupsClientGetResponse contains the response from method ResourceGroupsClient.Get. +type ResourceGroupsClientGetResponse struct { + ResourceGroup +} + +// ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.List. +type ResourceGroupsClientListResponse struct { + ResourceGroupListResult +} + +// ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. +type ResourceGroupsClientUpdateResponse struct { + ResourceGroup +} + +// TagsClientCreateOrUpdateAtScopeResponse contains the response from method TagsClient.CreateOrUpdateAtScope. +type TagsClientCreateOrUpdateAtScopeResponse struct { + TagsResource +} + +// TagsClientCreateOrUpdateResponse contains the response from method TagsClient.CreateOrUpdate. +type TagsClientCreateOrUpdateResponse struct { + TagDetails +} + +// TagsClientCreateOrUpdateValueResponse contains the response from method TagsClient.CreateOrUpdateValue. +type TagsClientCreateOrUpdateValueResponse struct { + TagValue +} + +// TagsClientDeleteAtScopeResponse contains the response from method TagsClient.DeleteAtScope. +type TagsClientDeleteAtScopeResponse struct { + // placeholder for future response values +} + +// TagsClientDeleteResponse contains the response from method TagsClient.Delete. +type TagsClientDeleteResponse struct { + // placeholder for future response values +} + +// TagsClientDeleteValueResponse contains the response from method TagsClient.DeleteValue. +type TagsClientDeleteValueResponse struct { + // placeholder for future response values +} + +// TagsClientGetAtScopeResponse contains the response from method TagsClient.GetAtScope. +type TagsClientGetAtScopeResponse struct { + TagsResource +} + +// TagsClientListResponse contains the response from method TagsClient.List. +type TagsClientListResponse struct { + TagsListResult +} + +// TagsClientUpdateAtScopeResponse contains the response from method TagsClient.UpdateAtScope. +type TagsClientUpdateAtScopeResponse struct { + TagsResource +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go new file mode 100644 index 000000000..177c8484c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go @@ -0,0 +1,493 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TagsClient contains the methods for the Tags group. +// Don't use this type directly, use NewTagsClient() instead. +type TagsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewTagsClient creates a new instance of TagsClient with the specified values. +// subscriptionID - The Microsoft Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TagsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - This operation allows adding a name to the list of predefined tag names for the given subscription. A +// tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the +// following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// tagName - The name of the tag to create. +// options - TagsClientCreateOrUpdateOptions contains the optional parameters for the TagsClient.CreateOrUpdate method. +func (client *TagsClient) CreateOrUpdate(ctx context.Context, tagName string, options *TagsClientCreateOrUpdateOptions) (TagsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, tagName, options) + if err != nil { + return TagsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TagsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TagsClient) createOrUpdateCreateRequest(ctx context.Context, tagName string, options *TagsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/tagNames/{tagName}" + if tagName == "" { + return nil, errors.New("parameter tagName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagName}", url.PathEscape(tagName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TagsClient) createOrUpdateHandleResponse(resp *http.Response) (TagsClientCreateOrUpdateResponse, error) { + result := TagsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagDetails); err != nil { + return TagsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// CreateOrUpdateAtScope - This operation allows adding or replacing the entire set of tags on the specified resource or subscription. +// The specified entity can have a maximum of 50 tags. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// options - TagsClientCreateOrUpdateAtScopeOptions contains the optional parameters for the TagsClient.CreateOrUpdateAtScope +// method. +func (client *TagsClient) CreateOrUpdateAtScope(ctx context.Context, scope string, parameters TagsResource, options *TagsClientCreateOrUpdateAtScopeOptions) (TagsClientCreateOrUpdateAtScopeResponse, error) { + req, err := client.createOrUpdateAtScopeCreateRequest(ctx, scope, parameters, options) + if err != nil { + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagsClientCreateOrUpdateAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateAtScopeHandleResponse(resp) +} + +// createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. +func (client *TagsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context, scope string, parameters TagsResource, options *TagsClientCreateOrUpdateAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateAtScopeHandleResponse handles the CreateOrUpdateAtScope response. +func (client *TagsClient) createOrUpdateAtScopeHandleResponse(resp *http.Response) (TagsClientCreateOrUpdateAtScopeResponse, error) { + result := TagsClientCreateOrUpdateAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { + return TagsClientCreateOrUpdateAtScopeResponse{}, err + } + return result, nil +} + +// CreateOrUpdateValue - This operation allows adding a value to the list of predefined values for an existing predefined +// tag name. A tag value can have a maximum of 256 characters. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// tagName - The name of the tag. +// tagValue - The value of the tag to create. +// options - TagsClientCreateOrUpdateValueOptions contains the optional parameters for the TagsClient.CreateOrUpdateValue +// method. +func (client *TagsClient) CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string, options *TagsClientCreateOrUpdateValueOptions) (TagsClientCreateOrUpdateValueResponse, error) { + req, err := client.createOrUpdateValueCreateRequest(ctx, tagName, tagValue, options) + if err != nil { + return TagsClientCreateOrUpdateValueResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientCreateOrUpdateValueResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TagsClientCreateOrUpdateValueResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateValueHandleResponse(resp) +} + +// createOrUpdateValueCreateRequest creates the CreateOrUpdateValue request. +func (client *TagsClient) createOrUpdateValueCreateRequest(ctx context.Context, tagName string, tagValue string, options *TagsClientCreateOrUpdateValueOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}" + if tagName == "" { + return nil, errors.New("parameter tagName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagName}", url.PathEscape(tagName)) + if tagValue == "" { + return nil, errors.New("parameter tagValue cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagValue}", url.PathEscape(tagValue)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createOrUpdateValueHandleResponse handles the CreateOrUpdateValue response. +func (client *TagsClient) createOrUpdateValueHandleResponse(resp *http.Response) (TagsClientCreateOrUpdateValueResponse, error) { + result := TagsClientCreateOrUpdateValueResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagValue); err != nil { + return TagsClientCreateOrUpdateValueResponse{}, err + } + return result, nil +} + +// Delete - This operation allows deleting a name from the list of predefined tag names for the given subscription. The name +// being deleted must not be in use as a tag name for any resource. All predefined values +// for the given name must have already been deleted. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// tagName - The name of the tag. +// options - TagsClientDeleteOptions contains the optional parameters for the TagsClient.Delete method. +func (client *TagsClient) Delete(ctx context.Context, tagName string, options *TagsClientDeleteOptions) (TagsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, tagName, options) + if err != nil { + return TagsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TagsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TagsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TagsClient) deleteCreateRequest(ctx context.Context, tagName string, options *TagsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/tagNames/{tagName}" + if tagName == "" { + return nil, errors.New("parameter tagName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagName}", url.PathEscape(tagName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteAtScope - Deletes the entire set of tags on a resource or subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// options - TagsClientDeleteAtScopeOptions contains the optional parameters for the TagsClient.DeleteAtScope method. +func (client *TagsClient) DeleteAtScope(ctx context.Context, scope string, options *TagsClientDeleteAtScopeOptions) (TagsClientDeleteAtScopeResponse, error) { + req, err := client.deleteAtScopeCreateRequest(ctx, scope, options) + if err != nil { + return TagsClientDeleteAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientDeleteAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagsClientDeleteAtScopeResponse{}, runtime.NewResponseError(resp) + } + return TagsClientDeleteAtScopeResponse{}, nil +} + +// deleteAtScopeCreateRequest creates the DeleteAtScope request. +func (client *TagsClient) deleteAtScopeCreateRequest(ctx context.Context, scope string, options *TagsClientDeleteAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteValue - This operation allows deleting a value from the list of predefined values for an existing predefined tag +// name. The value being deleted must not be in use as a tag value for the given tag name for any +// resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// tagName - The name of the tag. +// tagValue - The value of the tag to delete. +// options - TagsClientDeleteValueOptions contains the optional parameters for the TagsClient.DeleteValue method. +func (client *TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string, options *TagsClientDeleteValueOptions) (TagsClientDeleteValueResponse, error) { + req, err := client.deleteValueCreateRequest(ctx, tagName, tagValue, options) + if err != nil { + return TagsClientDeleteValueResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientDeleteValueResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TagsClientDeleteValueResponse{}, runtime.NewResponseError(resp) + } + return TagsClientDeleteValueResponse{}, nil +} + +// deleteValueCreateRequest creates the DeleteValue request. +func (client *TagsClient) deleteValueCreateRequest(ctx context.Context, tagName string, tagValue string, options *TagsClientDeleteValueOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}" + if tagName == "" { + return nil, errors.New("parameter tagName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagName}", url.PathEscape(tagName)) + if tagValue == "" { + return nil, errors.New("parameter tagValue cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tagValue}", url.PathEscape(tagValue)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetAtScope - Gets the entire set of tags on a resource or subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// options - TagsClientGetAtScopeOptions contains the optional parameters for the TagsClient.GetAtScope method. +func (client *TagsClient) GetAtScope(ctx context.Context, scope string, options *TagsClientGetAtScopeOptions) (TagsClientGetAtScopeResponse, error) { + req, err := client.getAtScopeCreateRequest(ctx, scope, options) + if err != nil { + return TagsClientGetAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientGetAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagsClientGetAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.getAtScopeHandleResponse(resp) +} + +// getAtScopeCreateRequest creates the GetAtScope request. +func (client *TagsClient) getAtScopeCreateRequest(ctx context.Context, scope string, options *TagsClientGetAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getAtScopeHandleResponse handles the GetAtScope response. +func (client *TagsClient) getAtScopeHandleResponse(resp *http.Response) (TagsClientGetAtScopeResponse, error) { + result := TagsClientGetAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { + return TagsClientGetAtScopeResponse{}, err + } + return result, nil +} + +// NewListPager - This operation performs a union of predefined tags, resource tags, resource group tags and subscription +// tags, and returns a summary of usage for each tag name and value under the given subscription. +// In case of a large number of tags, this operation may return a previously cached result. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// options - TagsClientListOptions contains the optional parameters for the TagsClient.List method. +func (client *TagsClient) NewListPager(options *TagsClientListOptions) *runtime.Pager[TagsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TagsClientListResponse]{ + More: func(page TagsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TagsClientListResponse) (TagsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TagsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *TagsClient) listCreateRequest(ctx context.Context, options *TagsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/tagNames" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TagsClient) listHandleResponse(resp *http.Response) (TagsClientListResponse, error) { + result := TagsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagsListResult); err != nil { + return TagsClientListResponse{}, err + } + return result, nil +} + +// UpdateAtScope - This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. +// The specified entity can have a maximum of 50 tags at the end of the operation. The +// 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new +// names and updating the values of tags with existing names. The 'delete' option +// allows selectively deleting tags based on given names or name/value pairs. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-04-01 +// scope - The resource scope. +// options - TagsClientUpdateAtScopeOptions contains the optional parameters for the TagsClient.UpdateAtScope method. +func (client *TagsClient) UpdateAtScope(ctx context.Context, scope string, parameters TagsPatchResource, options *TagsClientUpdateAtScopeOptions) (TagsClientUpdateAtScopeResponse, error) { + req, err := client.updateAtScopeCreateRequest(ctx, scope, parameters, options) + if err != nil { + return TagsClientUpdateAtScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TagsClientUpdateAtScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TagsClientUpdateAtScopeResponse{}, runtime.NewResponseError(resp) + } + return client.updateAtScopeHandleResponse(resp) +} + +// updateAtScopeCreateRequest creates the UpdateAtScope request. +func (client *TagsClient) updateAtScopeCreateRequest(ctx context.Context, scope string, parameters TagsPatchResource, options *TagsClientUpdateAtScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateAtScopeHandleResponse handles the UpdateAtScope response. +func (client *TagsClient) updateAtScopeHandleResponse(resp *http.Response) (TagsClientUpdateAtScopeResponse, error) { + result := TagsClientUpdateAtScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { + return TagsClientUpdateAtScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go new file mode 100644 index 000000000..a2a2f3c79 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armresources + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/README.md b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/README.md new file mode 100644 index 000000000..05bef8a80 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/README.md @@ -0,0 +1,152 @@ +# NOTE: This module will go out of support by March 31, 2023. For authenticating with Azure AD, use module [azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) instead. For help migrating from `auth` to `azidentiy` please consult the [migration guide](https://aka.ms/azsdk/go/identity/migration). General information about the retirement of this and other legacy modules can be found [here](https://azure.microsoft.com/updates/support-for-azure-sdk-libraries-that-do-not-conform-to-our-current-azure-sdk-guidelines-will-be-retired-as-of-31-march-2023/). + +## Authentication + +Typical SDK operations must be authenticated and authorized. The `autorest.Authorizer` +interface allows use of any auth style in requests, such as inserting an OAuth2 +Authorization header and bearer token received from Azure AD. + +The SDK itself provides a simple way to get an authorizer which first checks +for OAuth client credentials in environment variables and then falls back to +Azure's [Managed Service Identity]() when available, e.g. when on an Azure +VM. The following snippet from [the previous section](#use) demonstrates +this helper. + +```go +import "github.com/Azure/go-autorest/autorest/azure/auth" + +// create a VirtualNetworks client +vnetClient := network.NewVirtualNetworksClient("") + +// create an authorizer from env vars or Azure Managed Service Idenity +authorizer, err := auth.NewAuthorizerFromEnvironment() +if err != nil { + handle(err) +} + +vnetClient.Authorizer = authorizer + +// call the VirtualNetworks CreateOrUpdate API +vnetClient.CreateOrUpdate(context.Background(), +// ... +``` + +The following environment variables help determine authentication configuration: + +- `AZURE_ENVIRONMENT`: Specifies the Azure Environment to use. If not set, it + defaults to `AzurePublicCloud`. Not applicable to authentication with Managed + Service Identity (MSI). +- `AZURE_AD_RESOURCE`: Specifies the AAD resource ID to use. If not set, it + defaults to `ResourceManagerEndpoint` for operations with Azure Resource + Manager. You can also choose an alternate resource programmatically with + `auth.NewAuthorizerFromEnvironmentWithResource(resource string)`. + +### More Authentication Details + +The previous is the first and most recommended of several authentication +options offered by the SDK because it allows seamless use of both service +principals and [Azure Managed Service Identity][]. Other options are listed +below. + +> Note: If you need to create a new service principal, run `az ad sp create-for-rbac -n ""` in the +> [azure-cli](https://github.com/Azure/azure-cli). See [these +> docs](https://docs.microsoft.com/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest) +> for more info. Copy the new principal's ID, secret, and tenant ID for use in +> your app, or consider the `--sdk-auth` parameter for serialized output. + +[azure managed service identity]: https://docs.microsoft.com/azure/active-directory/msi-overview + +- The `auth.NewAuthorizerFromEnvironment()` described above creates an authorizer + from the first available of the following configuration: + + 1. **Client Credentials**: Azure AD Application ID and Secret. + + - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate. + - `AZURE_CLIENT_ID`: Specifies the app client ID to use. + - `AZURE_CLIENT_SECRET`: Specifies the app secret to use. + + 2. **Client Certificate**: Azure AD Application ID and X.509 Certificate. + + - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate. + - `AZURE_CLIENT_ID`: Specifies the app client ID to use. + - `AZURE_CERTIFICATE_PATH`: Specifies the certificate Path to use. + - `AZURE_CERTIFICATE_PASSWORD`: Specifies the certificate password to use. + + 3. **Resource Owner Password**: Azure AD User and Password. This grant type is *not + recommended*, use device login instead if you need interactive login. + + - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate. + - `AZURE_CLIENT_ID`: Specifies the app client ID to use. + - `AZURE_USERNAME`: Specifies the username to use. + - `AZURE_PASSWORD`: Specifies the password to use. + + 4. **Azure Managed Service Identity**: Delegate credential management to the + platform. Requires that code is running in Azure, e.g. on a VM. All + configuration is handled by Azure. See [Azure Managed Service + Identity](https://docs.microsoft.com/azure/active-directory/msi-overview) + for more details. + +- The `auth.NewAuthorizerFromFile()` method creates an authorizer using + credentials from an auth file created by the [Azure CLI][]. Follow these + steps to utilize: + + 1. Create a service principal and output an auth file using `az ad sp create-for-rbac --sdk-auth > client_credentials.json`. + 2. Set environment variable `AZURE_AUTH_LOCATION` to the path of the saved + output file. + 3. Use the authorizer returned by `auth.NewAuthorizerFromFile()` in your + client as described above. + +- The `auth.NewAuthorizerFromCLI()` method creates an authorizer which + uses [Azure CLI][] to obtain its credentials. + + The default audience being requested is `https://management.azure.com` (Azure ARM API). + To specify your own audience, export `AZURE_AD_RESOURCE` as an evironment variable. + This is read by `auth.NewAuthorizerFromCLI()` and passed to Azure CLI to acquire the access token. + + For example, to request an access token for Azure Key Vault, export + ``` + AZURE_AD_RESOURCE="https://vault.azure.net" + ``` + +- `auth.NewAuthorizerFromCLIWithResource(AUDIENCE_URL_OR_APPLICATION_ID)` - this method is self contained and does + not require exporting environment variables. For example, to request an access token for Azure Key Vault: + ``` + auth.NewAuthorizerFromCLIWithResource("https://vault.azure.net") + ``` + + To use `NewAuthorizerFromCLI()` or `NewAuthorizerFromCLIWithResource()`, follow these steps: + + 1. Install [Azure CLI v2.0.12](https://docs.microsoft.com/cli/azure/install-azure-cli) or later. Upgrade earlier versions. + 2. Use `az login` to sign in to Azure. + + If you receive an error, use `az account get-access-token` to verify access. + + If Azure CLI is not installed to the default directory, you may receive an error + reporting that `az` cannot be found. + Use the `AzureCLIPath` environment variable to define the Azure CLI installation folder. + + If you are signed in to Azure CLI using multiple accounts or your account has + access to multiple subscriptions, you need to specify the specific subscription + to be used. To do so, use: + + ``` + az account set --subscription + ``` + + To verify the current account settings, use: + + ``` + az account list + ``` + +[azure cli]: https://github.com/Azure/azure-cli + +- Finally, you can use OAuth's [Device Flow][] by calling + `auth.NewDeviceFlowConfig()` and extracting the Authorizer as follows: + + ```go + config := auth.NewDeviceFlowConfig(clientID, tenantID) + a, err := config.Authorizer() + ``` + +[device flow]: https://oauth.net/2/device-flow/ diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go index 5f02026b3..e97589dcd 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go @@ -16,8 +16,7 @@ package auth import ( "bytes" - "crypto/rsa" - "crypto/x509" + "context" "encoding/binary" "encoding/json" "errors" @@ -32,8 +31,8 @@ import ( "github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/cli" + "github.com/Azure/go-autorest/logger" "github.com/dimchansky/utfbom" - "golang.org/x/crypto/pkcs12" ) // The possible keys in the Values map. @@ -63,6 +62,7 @@ const ( // 3. Username password // 4. MSI func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) { + logger.Instance.Writeln(logger.LogInfo, "NewAuthorizerFromEnvironment() determining authentication mechanism") settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err @@ -76,6 +76,7 @@ func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) { // 3. Username password // 4. MSI func NewAuthorizerFromEnvironmentWithResource(resource string) (autorest.Authorizer, error) { + logger.Instance.Writeln(logger.LogInfo, "NewAuthorizerFromEnvironmentWithResource() determining authentication mechanism") settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err @@ -125,6 +126,7 @@ func (settings EnvironmentSettings) GetSubscriptionID() string { // adds the specified environment variable value to the Values map if it exists func (settings EnvironmentSettings) setValue(key string) { if v := os.Getenv(key); v != "" { + logger.Instance.Writef(logger.LogInfo, "GetSettingsFromEnvironment() found environment var %s\n", key) settings.Values[key] = v } } @@ -141,6 +143,7 @@ func (settings EnvironmentSettings) getClientAndTenant() (string, string) { func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsConfig, error) { secret := settings.Values[ClientSecret] if secret == "" { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetClientCredentials() missing client secret") return ClientCredentialsConfig{}, errors.New("missing client secret") } clientID, tenantID := settings.getClientAndTenant() @@ -161,6 +164,7 @@ func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsCon func (settings EnvironmentSettings) GetClientCertificate() (ClientCertificateConfig, error) { certPath := settings.Values[CertificatePath] if certPath == "" { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetClientCertificate() missing certificate path") return ClientCertificateConfig{}, errors.New("missing certificate path") } certPwd := settings.Values[CertificatePassword] @@ -177,6 +181,7 @@ func (settings EnvironmentSettings) GetUsernamePassword() (UsernamePasswordConfi username := settings.Values[Username] password := settings.Values[Password] if username == "" || password == "" { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetUsernamePassword() missing username and/or password") return UsernamePasswordConfig{}, errors.New("missing username/password") } clientID, tenantID := settings.getClientAndTenant() @@ -211,35 +216,55 @@ func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig { func (settings EnvironmentSettings) GetAuthorizer() (autorest.Authorizer, error) { //1.Client Credentials if c, e := settings.GetClientCredentials(); e == nil { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetAuthorizer() using client secret credentials") return c.Authorizer() } //2. Client Certificate if c, e := settings.GetClientCertificate(); e == nil { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetAuthorizer() using client certificate credentials") return c.Authorizer() } //3. Username Password if c, e := settings.GetUsernamePassword(); e == nil { + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetAuthorizer() using user name/password credentials") return c.Authorizer() } // 4. MSI + if !adal.MSIAvailable(context.Background(), nil) { + return nil, errors.New("MSI not available") + } + logger.Instance.Writeln(logger.LogInfo, "EnvironmentSettings.GetAuthorizer() using MSI authentication") return settings.GetMSI().Authorizer() } // NewAuthorizerFromFile creates an Authorizer configured from a configuration file in the following order. // 1. Client credentials // 2. Client certificate -func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) { +// The path to the configuration file must be specified in the AZURE_AUTH_LOCATION environment variable. +// resourceBaseURI - used to determine the resource type +func NewAuthorizerFromFile(resourceBaseURI string) (autorest.Authorizer, error) { settings, err := GetSettingsFromFile() if err != nil { return nil, err } - if a, err := settings.ClientCredentialsAuthorizer(baseURI); err == nil { + return settings.GetAuthorizer(resourceBaseURI) +} + +// GetAuthorizer create an Authorizer in the following order. +// 1. Client credentials +// 2. Client certificate +// resourceBaseURI - used to determine the resource type +func (settings FileSettings) GetAuthorizer(resourceBaseURI string) (autorest.Authorizer, error) { + if resourceBaseURI == "" { + resourceBaseURI = azure.PublicCloud.ServiceManagementEndpoint + } + if a, err := settings.ClientCredentialsAuthorizer(resourceBaseURI); err == nil { return a, err } - if a, err := settings.ClientCertificateAuthorizer(baseURI); err == nil { + if a, err := settings.ClientCertificateAuthorizer(resourceBaseURI); err == nil { return a, err } return nil, errors.New("auth file missing client and certificate credentials") @@ -248,6 +273,7 @@ func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) { // NewAuthorizerFromFileWithResource creates an Authorizer configured from a configuration file in the following order. // 1. Client credentials // 2. Client certificate +// The path to the configuration file must be specified in the AZURE_AUTH_LOCATION environment variable. func NewAuthorizerFromFileWithResource(resource string) (autorest.Authorizer, error) { s, err := GetSettingsFromFile() if err != nil { @@ -466,7 +492,7 @@ func decode(b []byte) ([]byte, error) { } func (settings FileSettings) getResourceForToken(baseURI string) (string, error) { - // Compare dafault base URI from the SDK to the endpoints from the public cloud + // Compare default base URI from the SDK to the endpoints from the public cloud // Base URI and token resource are the same string. This func finds the authentication // file field that matches the SDK base URI. The SDK defines the public cloud // endpoint as its default base URI @@ -544,7 +570,7 @@ func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig { } } -//AuthorizerConfig provides an authorizer from the configuration provided. +// AuthorizerConfig provides an authorizer from the configuration provided. type AuthorizerConfig interface { Authorizer() (autorest.Authorizer, error) } @@ -599,6 +625,7 @@ type ClientCertificateConfig struct { CertificatePath string CertificatePassword string TenantID string + AuxTenants []string AADEndpoint string Resource string } @@ -613,20 +640,44 @@ func (ccc ClientCertificateConfig) ServicePrincipalToken() (*adal.ServicePrincip if err != nil { return nil, fmt.Errorf("failed to read the certificate file (%s): %v", ccc.CertificatePath, err) } - certificate, rsaPrivateKey, err := decodePkcs12(certData, ccc.CertificatePassword) + certificate, rsaPrivateKey, err := adal.DecodePfxCertificateData(certData, ccc.CertificatePassword) if err != nil { return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) } return adal.NewServicePrincipalTokenFromCertificate(*oauthConfig, ccc.ClientID, certificate, rsaPrivateKey, ccc.Resource) } +// MultiTenantServicePrincipalToken creates a MultiTenantServicePrincipalToken from client certificate. +func (ccc ClientCertificateConfig) MultiTenantServicePrincipalToken() (*adal.MultiTenantServicePrincipalToken, error) { + oauthConfig, err := adal.NewMultiTenantOAuthConfig(ccc.AADEndpoint, ccc.TenantID, ccc.AuxTenants, adal.OAuthOptions{}) + if err != nil { + return nil, err + } + certData, err := ioutil.ReadFile(ccc.CertificatePath) + if err != nil { + return nil, fmt.Errorf("failed to read the certificate file (%s): %v", ccc.CertificatePath, err) + } + certificate, rsaPrivateKey, err := adal.DecodePfxCertificateData(certData, ccc.CertificatePassword) + if err != nil { + return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) + } + return adal.NewMultiTenantServicePrincipalTokenFromCertificate(oauthConfig, ccc.ClientID, certificate, rsaPrivateKey, ccc.Resource) +} + // Authorizer gets an authorizer object from client certificate. func (ccc ClientCertificateConfig) Authorizer() (autorest.Authorizer, error) { - spToken, err := ccc.ServicePrincipalToken() + if len(ccc.AuxTenants) == 0 { + spToken, err := ccc.ServicePrincipalToken() + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from certificate auth: %v", err) + } + return autorest.NewBearerAuthorizer(spToken), nil + } + mtSPT, err := ccc.MultiTenantServicePrincipalToken() if err != nil { - return nil, fmt.Errorf("failed to get oauth token from certificate auth: %v", err) + return nil, fmt.Errorf("failed to get multitenant SPT from certificate auth: %v", err) } - return autorest.NewBearerAuthorizer(spToken), nil + return autorest.NewMultiTenantServicePrincipalTokenAuthorizer(mtSPT), nil } // DeviceFlowConfig provides the options to get a bearer authorizer using device flow authentication. @@ -665,20 +716,6 @@ func (dfc DeviceFlowConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken return adal.NewServicePrincipalTokenFromManualToken(*oauthConfig, dfc.ClientID, dfc.Resource, *token) } -func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { - privateKey, certificate, err := pkcs12.Decode(pkcs, password) - if err != nil { - return nil, nil, err - } - - rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) - if !isRsaKey { - return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key") - } - - return certificate, rsaPrivateKey, nil -} - // UsernamePasswordConfig provides the options to get a bearer authorizer from a username and a password. type UsernamePasswordConfig struct { ClientID string @@ -713,25 +750,23 @@ type MSIConfig struct { ClientID string } +// ServicePrincipalToken creates a ServicePrincipalToken from MSI. +func (mc MSIConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { + spToken, err := adal.NewServicePrincipalTokenFromManagedIdentity(mc.Resource, &adal.ManagedIdentityOptions{ + ClientID: mc.ClientID, + }) + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from MSI: %v", err) + } + return spToken, nil +} + // Authorizer gets the authorizer from MSI. func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) { - msiEndpoint, err := adal.GetMSIEndpoint() + spToken, err := mc.ServicePrincipalToken() if err != nil { return nil, err } - var spToken *adal.ServicePrincipalToken - if mc.ClientID == "" { - spToken, err = adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource) - if err != nil { - return nil, fmt.Errorf("failed to get oauth token from MSI: %v", err) - } - } else { - spToken, err = adal.NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, mc.Resource, mc.ClientID) - if err != nil { - return nil, fmt.Errorf("failed to get oauth token from MSI for user assigned identity: %v", err) - } - } - return autorest.NewBearerAuthorizer(spToken), nil } diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go_mod_tidy_hack.go index 2f09cd177..f7eb26fd3 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go_mod_tidy_hack.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go_mod_tidy_hack.go @@ -1,3 +1,4 @@ +//go:build modhack // +build modhack package auth @@ -16,9 +17,9 @@ package auth // See the License for the specific language governing permissions and // limitations under the License. -// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of +// This file, and the github.com/Azure/go-autorest import, won't actually become part of // the resultant binary. // Necessary for safely adding multi-module repo. // See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest/autorest" +import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go_mod_tidy_hack.go index 618bed392..50d6f0391 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go_mod_tidy_hack.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go_mod_tidy_hack.go @@ -1,3 +1,4 @@ +//go:build modhack // +build modhack package cli @@ -16,9 +17,9 @@ package cli // See the License for the specific language governing permissions and // limitations under the License. -// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of +// This file, and the github.com/Azure/go-autorest import, won't actually become part of // the resultant binary. // Necessary for safely adding multi-module repo. // See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest/autorest" +import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go index 44ff446f6..486619111 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go @@ -124,24 +124,91 @@ func LoadTokens(path string) ([]Token, error) { // GetTokenFromCLI gets a token using Azure CLI 2.0 for local development scenarios. func GetTokenFromCLI(resource string) (*Token, error) { - // This is the path that a developer can set to tell this class what the install path for Azure CLI is. - const azureCLIPath = "AzureCLIPath" + return GetTokenFromCLIWithParams(GetAccessTokenParams{Resource: resource}) +} - // The default install paths are used to find Azure CLI. This is for security, so that any path in the calling program's Path environment is not used to execute Azure CLI. - azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) +// GetAccessTokenParams is the parameter struct of GetTokenFromCLIWithParams +type GetAccessTokenParams struct { + Resource string + ResourceType string + Subscription string + Tenant string +} - // Default path for non-Windows. - const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" +// GetTokenFromCLIWithParams gets a token using Azure CLI 2.0 for local development scenarios. +func GetTokenFromCLIWithParams(params GetAccessTokenParams) (*Token, error) { + cliCmd := GetAzureCLICommand() - // Validate resource, since it gets sent as a command line argument to Azure CLI - const invalidResourceErrorTemplate = "Resource %s is not in expected format. Only alphanumeric characters, [dot], [colon], [hyphen], and [forward slash] are allowed." - match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", resource) + cliCmd.Args = append(cliCmd.Args, "account", "get-access-token", "-o", "json") + if params.Resource != "" { + if err := validateParameter(params.Resource); err != nil { + return nil, err + } + cliCmd.Args = append(cliCmd.Args, "--resource", params.Resource) + } + if params.ResourceType != "" { + if err := validateParameter(params.ResourceType); err != nil { + return nil, err + } + cliCmd.Args = append(cliCmd.Args, "--resource-type", params.ResourceType) + } + if params.Subscription != "" { + if err := validateParameter(params.Subscription); err != nil { + return nil, err + } + cliCmd.Args = append(cliCmd.Args, "--subscription", params.Subscription) + } + if params.Tenant != "" { + if err := validateParameter(params.Tenant); err != nil { + return nil, err + } + cliCmd.Args = append(cliCmd.Args, "--tenant", params.Tenant) + } + + var stderr bytes.Buffer + cliCmd.Stderr = &stderr + + output, err := cliCmd.Output() + if err != nil { + if stderr.Len() > 0 { + return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %s", stderr.String()) + } + + return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %s", err.Error()) + } + + tokenResponse := Token{} + err = json.Unmarshal(output, &tokenResponse) if err != nil { return nil, err } + + return &tokenResponse, err +} + +func validateParameter(param string) error { + // Validate parameters, since it gets sent as a command line argument to Azure CLI + const invalidResourceErrorTemplate = "Parameter %s is not in expected format. Only alphanumeric characters, [dot], [colon], [hyphen], and [forward slash] are allowed." + match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", param) + if err != nil { + return err + } if !match { - return nil, fmt.Errorf(invalidResourceErrorTemplate, resource) + return fmt.Errorf(invalidResourceErrorTemplate, param) } + return nil +} + +// GetAzureCLICommand can be used to run arbitrary Azure CLI command +func GetAzureCLICommand() *exec.Cmd { + // This is the path that a developer can set to tell this class what the install path for Azure CLI is. + const azureCLIPath = "AzureCLIPath" + + // The default install paths are used to find Azure CLI. This is for security, so that any path in the calling program's Path environment is not used to execute Azure CLI. + azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) + + // Default path for non-Windows. + const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" // Execute Azure CLI to get token var cliCmd *exec.Cmd @@ -155,21 +222,6 @@ func GetTokenFromCLI(resource string) (*Token, error) { cliCmd.Env = os.Environ() cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s:%s", os.Getenv(azureCLIPath), azureCLIDefaultPath)) } - cliCmd.Args = append(cliCmd.Args, "account", "get-access-token", "-o", "json", "--resource", resource) - var stderr bytes.Buffer - cliCmd.Stderr = &stderr - - output, err := cliCmd.Output() - if err != nil { - return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %s", stderr.String()) - } - - tokenResponse := Token{} - err = json.Unmarshal(output, &tokenResponse) - if err != nil { - return nil, err - } - - return &tokenResponse, err + return cliCmd } diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/LICENSE b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/LICENSE new file mode 100644 index 000000000..3d8b93bc7 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache/cache.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache/cache.go new file mode 100644 index 000000000..259ca6d56 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache/cache.go @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package cache allows third parties to implement external storage for caching token data +for distributed systems or multiple local applications access. + +The data stored and extracted will represent the entire cache. Therefore it is recommended +one msal instance per user. This data is considered opaque and there are no guarantees to +implementers on the format being passed. +*/ +package cache + +// Marshaler marshals data from an internal cache to bytes that can be stored. +type Marshaler interface { + Marshal() ([]byte, error) +} + +// Unmarshaler unmarshals data from a storage medium into the internal cache, overwriting it. +type Unmarshaler interface { + Unmarshal([]byte) error +} + +// Serializer can serialize the cache to binary or from binary into the cache. +type Serializer interface { + Marshaler + Unmarshaler +} + +// ExportReplace is used export or replace what is in the cache. +type ExportReplace interface { + // Replace replaces the cache with what is in external storage. + // key is the suggested key which can be used for partioning the cache + Replace(cache Unmarshaler, key string) + // Export writes the binary representation of the cache (cache.Marshal()) to + // external storage. This is considered opaque. + // key is the suggested key which can be used for partioning the cache + Export(cache Marshaler, key string) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go new file mode 100644 index 000000000..11a33de73 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package confidential provides a client for authentication of "confidential" applications. +A "confidential" application is defined as an app that run on servers. They are considered +difficult to access and for that reason capable of keeping an application secret. +Confidential clients can hold configuration-time secrets. +*/ +package confidential + +import ( + "context" + "crypto" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "errors" + "fmt" + "net/url" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +/* +Design note: + +confidential.Client uses base.Client as an embedded type. base.Client statically assigns its attributes +during creation. As it doesn't have any pointers in it, anything borrowed from it, such as +Base.AuthParams is a copy that is free to be manipulated here. + +Duplicate Calls shared between public.Client and this package: +There is some duplicate call options provided here that are the same as in public.Client . This +is a design choices. Go proverb(https://www.youtube.com/watch?v=PAAkCSZUG1c&t=9m28s): +"a little copying is better than a little dependency". Yes, we could have another package with +shared options (fail). That divides like 2 options from all others which makes the user look +through more docs. We can have all clients in one package, but I think separate packages +here makes for better naming (public.Client vs client.PublicClient). So I chose a little +duplication. + +.Net People, Take note on X509: +This uses x509.Certificates and private keys. x509 does not store private keys. .Net +has some x509.Certificate2 thing that has private keys, but that is just some bullcrap that .Net +added, it doesn't exist in real life. Seriously, "x509.Certificate2", bahahahaha. As such I've +put a PEM decoder into here. +*/ + +// TODO(msal): This should have example code for each method on client using Go's example doc framework. +// base usage details should be include in the package documentation. + +// AuthResult contains the results of one token acquisition operation. +// For details see https://aka.ms/msal-net-authenticationresult +type AuthResult = base.AuthResult + +type Account = shared.Account + +// CertFromPEM converts a PEM file (.pem or .key) for use with NewCredFromCert(). The file +// must contain the public certificate and the private key. If a PEM block is encrypted and +// password is not an empty string, it attempts to decrypt the PEM blocks using the password. +// Multiple certs are due to certificate chaining for use cases like TLS that sign from root to leaf. +func CertFromPEM(pemData []byte, password string) ([]*x509.Certificate, crypto.PrivateKey, error) { + var certs []*x509.Certificate + var priv crypto.PrivateKey + for { + block, rest := pem.Decode(pemData) + if block == nil { + break + } + + //nolint:staticcheck // x509.IsEncryptedPEMBlock and x509.DecryptPEMBlock are deprecated. They are used here only to support a usecase. + if x509.IsEncryptedPEMBlock(block) { + b, err := x509.DecryptPEMBlock(block, []byte(password)) + if err != nil { + return nil, nil, fmt.Errorf("could not decrypt encrypted PEM block: %v", err) + } + block, _ = pem.Decode(b) + if block == nil { + return nil, nil, fmt.Errorf("encounter encrypted PEM block that did not decode") + } + } + + switch block.Type { + case "CERTIFICATE": + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return nil, nil, fmt.Errorf("block labelled 'CERTIFICATE' could not be parsed by x509: %v", err) + } + certs = append(certs, cert) + case "PRIVATE KEY": + if priv != nil { + return nil, nil, errors.New("found multiple private key blocks") + } + + var err error + priv, err = x509.ParsePKCS8PrivateKey(block.Bytes) + if err != nil { + return nil, nil, fmt.Errorf("could not decode private key: %v", err) + } + case "RSA PRIVATE KEY": + if priv != nil { + return nil, nil, errors.New("found multiple private key blocks") + } + var err error + priv, err = x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + return nil, nil, fmt.Errorf("could not decode private key: %v", err) + } + } + pemData = rest + } + + if len(certs) == 0 { + return nil, nil, fmt.Errorf("no certificates found") + } + + if priv == nil { + return nil, nil, fmt.Errorf("no private key found") + } + + return certs, priv, nil +} + +// AssertionRequestOptions has required information for client assertion claims +type AssertionRequestOptions = exported.AssertionRequestOptions + +// Credential represents the credential used in confidential client flows. +type Credential struct { + secret string + + cert *x509.Certificate + key crypto.PrivateKey + x5c []string + + assertionCallback func(context.Context, AssertionRequestOptions) (string, error) + + tokenProvider func(context.Context, TokenProviderParameters) (TokenProviderResult, error) +} + +// toInternal returns the accesstokens.Credential that is used internally. The current structure of the +// code requires that client.go, requests.go and confidential.go share a credential type without +// having import recursion. That requires the type used between is in a shared package. Therefore +// we have this. +func (c Credential) toInternal() (*accesstokens.Credential, error) { + if c.secret != "" { + return &accesstokens.Credential{Secret: c.secret}, nil + } + if c.cert != nil { + if c.key == nil { + return nil, errors.New("missing private key for certificate") + } + return &accesstokens.Credential{Cert: c.cert, Key: c.key, X5c: c.x5c}, nil + } + if c.key != nil { + return nil, errors.New("missing certificate for private key") + } + if c.assertionCallback != nil { + return &accesstokens.Credential{AssertionCallback: c.assertionCallback}, nil + } + if c.tokenProvider != nil { + return &accesstokens.Credential{TokenProvider: c.tokenProvider}, nil + } + return nil, errors.New("invalid credential") +} + +// NewCredFromSecret creates a Credential from a secret. +func NewCredFromSecret(secret string) (Credential, error) { + if secret == "" { + return Credential{}, errors.New("secret can't be empty string") + } + return Credential{secret: secret}, nil +} + +// NewCredFromAssertion creates a Credential from a signed assertion. +// +// Deprecated: a Credential created by this function can't refresh the +// assertion when it expires. Use NewCredFromAssertionCallback instead. +func NewCredFromAssertion(assertion string) (Credential, error) { + if assertion == "" { + return Credential{}, errors.New("assertion can't be empty string") + } + return NewCredFromAssertionCallback(func(context.Context, AssertionRequestOptions) (string, error) { return assertion, nil }), nil +} + +// NewCredFromAssertionCallback creates a Credential that invokes a callback to get assertions +// authenticating the application. The callback must be thread safe. +func NewCredFromAssertionCallback(callback func(context.Context, AssertionRequestOptions) (string, error)) Credential { + return Credential{assertionCallback: callback} +} + +// NewCredFromCert creates a Credential from an x509.Certificate and an RSA private key. +// CertFromPEM() can be used to get these values from a PEM file. +func NewCredFromCert(cert *x509.Certificate, key crypto.PrivateKey) Credential { + cred, _ := NewCredFromCertChain([]*x509.Certificate{cert}, key) + return cred +} + +// NewCredFromCertChain creates a Credential from a chain of x509.Certificates and an RSA private key +// as returned by CertFromPEM(). +func NewCredFromCertChain(certs []*x509.Certificate, key crypto.PrivateKey) (Credential, error) { + cred := Credential{key: key} + k, ok := key.(*rsa.PrivateKey) + if !ok { + return cred, errors.New("key must be an RSA key") + } + for _, cert := range certs { + if cert == nil { + // not returning an error here because certs may still contain a sufficient cert/key pair + continue + } + certKey, ok := cert.PublicKey.(*rsa.PublicKey) + if ok && k.E == certKey.E && k.N.Cmp(certKey.N) == 0 { + // We know this is the signing cert because its public key matches the given private key. + // This cert must be first in x5c. + cred.cert = cert + cred.x5c = append([]string{base64.StdEncoding.EncodeToString(cert.Raw)}, cred.x5c...) + } else { + cred.x5c = append(cred.x5c, base64.StdEncoding.EncodeToString(cert.Raw)) + } + } + if cred.cert == nil { + return cred, errors.New("key doesn't match any certificate") + } + return cred, nil +} + +// TokenProviderParameters is the authentication parameters passed to token providers +type TokenProviderParameters = exported.TokenProviderParameters + +// TokenProviderResult is the authentication result returned by custom token providers +type TokenProviderResult = exported.TokenProviderResult + +// NewCredFromTokenProvider creates a Credential from a function that provides access tokens. The function +// must be concurrency safe. This is intended only to allow the Azure SDK to cache MSI tokens. It isn't +// useful to applications in general because the token provider must implement all authentication logic. +func NewCredFromTokenProvider(provider func(context.Context, TokenProviderParameters) (TokenProviderResult, error)) Credential { + return Credential{tokenProvider: provider} +} + +// AutoDetectRegion instructs MSAL Go to auto detect region for Azure regional token service. +func AutoDetectRegion() string { + return "TryAutoDetect" +} + +// Client is a representation of authentication client for confidential applications as defined in the +// package doc. A new Client should be created PER SERVICE USER. +// For more information, visit https://docs.microsoft.com/azure/active-directory/develop/msal-client-applications +type Client struct { + base base.Client + + cred *accesstokens.Credential + + // userID is some unique identifier for a user. It actually isn't used by us at all, it + // simply acts as another hint that a confidential.Client is for a single user. + userID string +} + +// Options are optional settings for New(). These options are set using various functions +// returning Option calls. +type Options struct { + // Accessor controls cache persistence. + // By default there is no cache persistence. This can be set using the WithAccessor() option. + Accessor cache.ExportReplace + + // The host of the Azure Active Directory authority. + // The default is https://login.microsoftonline.com/common. This can be changed using the + // WithAuthority() option. + Authority string + + // The HTTP client used for making requests. + // It defaults to a shared http.Client. + HTTPClient ops.HTTPClient + + // SendX5C specifies if x5c claim(public key of the certificate) should be sent to STS. + SendX5C bool + + // Instructs MSAL Go to use an Azure regional token service with sepcified AzureRegion. + AzureRegion string +} + +func (o Options) validate() error { + u, err := url.Parse(o.Authority) + if err != nil { + return fmt.Errorf("the Authority(%s) does not parse as a valid URL", o.Authority) + } + if u.Scheme != "https" { + return fmt.Errorf("the Authority(%s) does not appear to use https", o.Authority) + } + return nil +} + +// Option is an optional argument to New(). +type Option func(o *Options) + +// WithAuthority allows you to provide a custom authority for use in the client. +func WithAuthority(authority string) Option { + return func(o *Options) { + o.Authority = authority + } +} + +// WithAccessor provides a cache accessor that will read and write to some externally managed cache +// that may or may not be shared with other applications. +func WithAccessor(accessor cache.ExportReplace) Option { + return func(o *Options) { + o.Accessor = accessor + } +} + +// WithHTTPClient allows for a custom HTTP client to be set. +func WithHTTPClient(httpClient ops.HTTPClient) Option { + return func(o *Options) { + o.HTTPClient = httpClient + } +} + +// WithX5C specifies if x5c claim(public key of the certificate) should be sent to STS to enable Subject Name Issuer Authentication. +func WithX5C() Option { + return func(o *Options) { + o.SendX5C = true + } +} + +// WithAzureRegion sets the region(preferred) or Confidential.AutoDetectRegion() for auto detecting region. +// Region names as per https://azure.microsoft.com/en-ca/global-infrastructure/geographies/. +// See https://aka.ms/region-map for more details on region names. +// The region value should be short region name for the region where the service is deployed. +// For example "centralus" is short name for region Central US. +// Not all auth flows can use the regional token service. +// Service To Service (client credential flow) tokens can be obtained from the regional service. +// Requires configuration at the tenant level. +// Auto-detection works on a limited number of Azure artifacts (VMs, Azure functions). +// If auto-detection fails, the non-regional endpoint will be used. +// If an invalid region name is provided, the non-regional endpoint MIGHT be used or the token request MIGHT fail. +func WithAzureRegion(val string) Option { + return func(o *Options) { + o.AzureRegion = val + } +} + +// New is the constructor for Client. userID is the unique identifier of the user this client +// will store credentials for (a Client is per user). clientID is the Azure clientID and cred is +// the type of credential to use. +func New(clientID string, cred Credential, options ...Option) (Client, error) { + internalCred, err := cred.toInternal() + if err != nil { + return Client{}, err + } + + opts := Options{ + Authority: base.AuthorityPublicCloud, + HTTPClient: shared.DefaultClient, + } + + for _, o := range options { + o(&opts) + } + if err := opts.validate(); err != nil { + return Client{}, err + } + + baseOpts := []base.Option{ + base.WithCacheAccessor(opts.Accessor), + base.WithRegionDetection(opts.AzureRegion), + base.WithX5C(opts.SendX5C), + } + if cred.tokenProvider != nil { + // The caller will handle all details of authentication, using Client only as a token cache. + // Declaring the authority host known prevents unnecessary metadata discovery requests. (The + // authority is irrelevant to Client and friends because the token provider is responsible + // for authentication.) + parsed, err := url.Parse(opts.Authority) + if err != nil { + return Client{}, errors.New("invalid authority") + } + baseOpts = append(baseOpts, base.WithKnownAuthorityHosts([]string{parsed.Hostname()})) + } + base, err := base.New(clientID, opts.Authority, oauth.New(opts.HTTPClient), baseOpts...) + if err != nil { + return Client{}, err + } + + return Client{base: base, cred: internalCred}, nil +} + +// UserID is the unique user identifier this client if for. +func (cca Client) UserID() string { + return cca.userID +} + +// AuthCodeURL creates a URL used to acquire an authorization code. Users need to call CreateAuthorizationCodeURLParameters and pass it in. +func (cca Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string) (string, error) { + return cca.base.AuthCodeURL(ctx, clientID, redirectURI, scopes, cca.base.AuthParams) +} + +// AcquireTokenSilentOptions are all the optional settings to an AcquireTokenSilent() call. +// These are set by using various AcquireTokenSilentOption functions. +type AcquireTokenSilentOptions struct { + // Account represents the account to use. To set, use the WithSilentAccount() option. + Account Account +} + +// AcquireTokenSilentOption changes options inside AcquireTokenSilentOptions used in .AcquireTokenSilent(). +type AcquireTokenSilentOption func(a *AcquireTokenSilentOptions) + +// WithSilentAccount uses the passed account during an AcquireTokenSilent() call. +func WithSilentAccount(account Account) AcquireTokenSilentOption { + return func(a *AcquireTokenSilentOptions) { + a.Account = account + } +} + +// AcquireTokenSilent acquires a token from either the cache or using a refresh token. +func (cca Client) AcquireTokenSilent(ctx context.Context, scopes []string, options ...AcquireTokenSilentOption) (AuthResult, error) { + opts := AcquireTokenSilentOptions{} + for _, o := range options { + o(&opts) + } + var isAppCache bool + if opts.Account.IsZero() { + isAppCache = true + } + + silentParameters := base.AcquireTokenSilentParameters{ + Scopes: scopes, + Account: opts.Account, + RequestType: accesstokens.ATConfidential, + Credential: cca.cred, + IsAppCache: isAppCache, + } + + return cca.base.AcquireTokenSilent(ctx, silentParameters) +} + +// AcquireTokenByAuthCodeOptions contains the optional parameters used to acquire an access token using the authorization code flow. +type AcquireTokenByAuthCodeOptions struct { + Challenge string +} + +// AcquireTokenByAuthCodeOption changes options inside AcquireTokenByAuthCodeOptions used in .AcquireTokenByAuthCode(). +type AcquireTokenByAuthCodeOption func(a *AcquireTokenByAuthCodeOptions) + +// WithChallenge allows you to provide a challenge for the .AcquireTokenByAuthCode() call. +func WithChallenge(challenge string) AcquireTokenByAuthCodeOption { + return func(a *AcquireTokenByAuthCodeOptions) { + a.Challenge = challenge + } +} + +// AcquireTokenByAuthCode is a request to acquire a security token from the authority, using an authorization code. +// The specified redirect URI must be the same URI that was used when the authorization code was requested. +func (cca Client) AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, options ...AcquireTokenByAuthCodeOption) (AuthResult, error) { + opts := AcquireTokenByAuthCodeOptions{} + for _, o := range options { + o(&opts) + } + + params := base.AcquireTokenAuthCodeParameters{ + Scopes: scopes, + Code: code, + Challenge: opts.Challenge, + AppType: accesstokens.ATConfidential, + Credential: cca.cred, // This setting differs from public.Client.AcquireTokenByAuthCode + RedirectURI: redirectURI, + } + + return cca.base.AcquireTokenByAuthCode(ctx, params) +} + +// AcquireTokenByCredential acquires a security token from the authority, using the client credentials grant. +func (cca Client) AcquireTokenByCredential(ctx context.Context, scopes []string) (AuthResult, error) { + authParams := cca.base.AuthParams + authParams.Scopes = scopes + authParams.AuthorizationType = authority.ATClientCredentials + + token, err := cca.base.Token.Credential(ctx, authParams, cca.cred) + if err != nil { + return AuthResult{}, err + } + return cca.base.AuthResultFromToken(ctx, authParams, token, true) +} + +// AcquireTokenOnBehalfOf acquires a security token for an app using middle tier apps access token. +// Refer https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow. +func (cca Client) AcquireTokenOnBehalfOf(ctx context.Context, userAssertion string, scopes []string) (AuthResult, error) { + params := base.AcquireTokenOnBehalfOfParameters{ + Scopes: scopes, + UserAssertion: userAssertion, + Credential: cca.cred, + } + return cca.base.AcquireTokenOnBehalfOf(ctx, params) +} + +// Account gets the account in the token cache with the specified homeAccountID. +func (cca Client) Account(homeAccountID string) Account { + return cca.base.Account(homeAccountID) +} + +// RemoveAccount signs the account out and forgets account from token cache. +func (cca Client) RemoveAccount(account Account) error { + cca.base.RemoveAccount(account) + return nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/error_design.md b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/error_design.md new file mode 100644 index 000000000..34a699f48 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/error_design.md @@ -0,0 +1,111 @@ +# MSAL Error Design + +Author: Abhidnya Patil(abhidnya.patil@microsoft.com) + +Contributors: + +- John Doak(jdoak@microsoft.com) +- Keegan Caruso(Keegan.Caruso@microsoft.com) +- Joel Hendrix(jhendrix@microsoft.com) + +## Background + +Errors in MSAL are intended for app developers to troubleshoot and not for displaying to end-users. + +### Go error handling vs other MSAL languages + +Most modern languages use exception based errors. Simply put, you "throw" an exception and it must be caught at some routine in the upper stack or it will eventually crash the program. + +Go doesn't use exceptions, instead it relies on multiple return values, one of which can be the builtin error interface type. It is up to the user to decide what to do. + +### Go custom error types + +Errors can be created in Go by simply using errors.New() or fmt.Errorf() to create an "error". + +Custom errors can be created in multiple ways. One of the more robust ways is simply to satisfy the error interface: + +```go +type MyCustomErr struct { + Msg string +} +func (m MyCustomErr) Error() string { // This implements "error" + return m.Msg +} +``` + +### MSAL Error Goals + +- Provide diagnostics to the user and for tickets that can be used to track down bugs or client misconfigurations +- Detect errors that are transitory and can be retried +- Allow the user to identify certain errors that the program can respond to, such a informing the user for the need to do an enrollment + +## Implementing Client Side Errors + +Client side errors indicate a misconfiguration or passing of bad arguments that is non-recoverable. Retrying isn't possible. + +These errors can simply be standard Go errors created by errors.New() or fmt.Errorf(). If down the line we need a custom error, we can introduce it, but for now the error messages just need to be clear on what the issue was. + +## Implementing Service Side Errors + +Service side errors occur when an external RPC responds either with an HTTP error code or returns a message that includes an error. + +These errors can be transitory (please slow down) or permanent (HTTP 404). To provide our diagnostic goals, we require the ability to differentiate these errors from other errors. + +The current implementation includes a specialized type that captures any error from the server: + +```go +// CallErr represents an HTTP call error. Has a Verbose() method that allows getting the +// http.Request and Response objects. Implements error. +type CallErr struct { + Req *http.Request + Resp *http.Response + Err error +} + +// Errors implements error.Error(). +func (e CallErr) Error() string { + return e.Err.Error() +} + +// Verbose prints a versbose error message with the request or response. +func (e CallErr) Verbose() string { + e.Resp.Request = nil // This brings in a bunch of TLS crap we don't need + e.Resp.TLS = nil // Same + return fmt.Sprintf("%s:\nRequest:\n%s\nResponse:\n%s", e.Err, prettyConf.Sprint(e.Req), prettyConf.Sprint(e.Resp)) +} +``` + +A user will always receive the most concise error we provide. They can tell if it is a server side error using Go error package: + +```go +var callErr CallErr +if errors.As(err, &callErr) { + ... +} +``` + +We provide a Verbose() function that can retrieve the most verbose message from any error we provide: + +```go +fmt.Println(errors.Verbose(err)) +``` + +If further differentiation is required, we can add custom errors that use Go error wrapping on top of CallErr to achieve our diagnostic goals (such as detecting when to retry a call due to transient errors). + +CallErr is always thrown from the comm package (which handles all http requests) and looks similar to: + +```go +return nil, errors.CallErr{ + Req: req, + Resp: reply, + Err: fmt.Errorf("http call(%s)(%s) error: reply status code was %d:\n%s", req.URL.String(), req.Method, reply.StatusCode, ErrorResponse), //ErrorResponse is the json body extracted from the http response + } +``` + +## Future Decisions + +The ability to retry calls needs to have centralized responsibility. Either the user is doing it or the client is doing it. + +If the user should be responsible, our errors package will include a CanRetry() function that will inform the user if the error provided to them is retryable. This is based on the http error code and possibly the type of error that was returned. It would also include a sleep time if the server returned an amount of time to wait. + +Otherwise we will do this internally and retries will be left to us. diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/errors.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/errors.go new file mode 100644 index 000000000..c9b8dbed0 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors/errors.go @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package errors + +import ( + "errors" + "fmt" + "io" + "net/http" + "reflect" + "strings" + + "github.com/kylelemons/godebug/pretty" +) + +var prettyConf = &pretty.Config{ + IncludeUnexported: false, + SkipZeroFields: true, + TrackCycles: true, + Formatter: map[reflect.Type]interface{}{ + reflect.TypeOf((*io.Reader)(nil)).Elem(): func(r io.Reader) string { + b, err := io.ReadAll(r) + if err != nil { + return "could not read io.Reader content" + } + return string(b) + }, + }, +} + +type verboser interface { + Verbose() string +} + +// Verbose prints the most verbose error that the error message has. +func Verbose(err error) string { + build := strings.Builder{} + for { + if err == nil { + break + } + if v, ok := err.(verboser); ok { + build.WriteString(v.Verbose()) + } else { + build.WriteString(err.Error()) + } + err = errors.Unwrap(err) + } + return build.String() +} + +// New is equivalent to errors.New(). +func New(text string) error { + return errors.New(text) +} + +// CallErr represents an HTTP call error. Has a Verbose() method that allows getting the +// http.Request and Response objects. Implements error. +type CallErr struct { + Req *http.Request + // Resp contains response body + Resp *http.Response + Err error +} + +// Errors implements error.Error(). +func (e CallErr) Error() string { + return e.Err.Error() +} + +// Verbose prints a versbose error message with the request or response. +func (e CallErr) Verbose() string { + e.Resp.Request = nil // This brings in a bunch of TLS crap we don't need + e.Resp.TLS = nil // Same + return fmt.Sprintf("%s:\nRequest:\n%s\nResponse:\n%s", e.Err, prettyConf.Sprint(e.Req), prettyConf.Sprint(e.Resp)) +} + +// Is reports whether any error in errors chain matches target. +func Is(err, target error) bool { + return errors.Is(err, target) +} + +// As finds the first error in errors chain that matches target, +// and if so, sets target to that error value and returns true. +// Otherwise, it returns false. +func As(err error, target interface{}) bool { + return errors.As(err, target) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go new file mode 100644 index 000000000..a86f06400 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go @@ -0,0 +1,406 @@ +// Package base contains a "Base" client that is used by the external public.Client and confidential.Client. +// Base holds shared attributes that must be available to both clients and methods that act as +// shared calls. +package base + +import ( + "context" + "errors" + "fmt" + "net/url" + "reflect" + "strings" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +const ( + // AuthorityPublicCloud is the default AAD authority host + AuthorityPublicCloud = "https://login.microsoftonline.com/common" + scopeSeparator = " " +) + +// manager provides an internal cache. It is defined to allow faking the cache in tests. +// In all production use it is a *storage.Manager. +type manager interface { + Read(ctx context.Context, authParameters authority.AuthParams, account shared.Account) (storage.TokenResponse, error) + Write(authParameters authority.AuthParams, tokenResponse accesstokens.TokenResponse) (shared.Account, error) + AllAccounts() []shared.Account + Account(homeAccountID string) shared.Account + RemoveAccount(account shared.Account, clientID string) +} + +// partitionedManager provides an internal cache. It is defined to allow faking the cache in tests. +// In all production use it is a *storage.PartitionedManager. +type partitionedManager interface { + Read(ctx context.Context, authParameters authority.AuthParams) (storage.TokenResponse, error) + Write(authParameters authority.AuthParams, tokenResponse accesstokens.TokenResponse) (shared.Account, error) +} + +type noopCacheAccessor struct{} + +func (n noopCacheAccessor) Replace(cache cache.Unmarshaler, key string) {} +func (n noopCacheAccessor) Export(cache cache.Marshaler, key string) {} + +// AcquireTokenSilentParameters contains the parameters to acquire a token silently (from cache). +type AcquireTokenSilentParameters struct { + Scopes []string + Account shared.Account + RequestType accesstokens.AppType + Credential *accesstokens.Credential + IsAppCache bool + UserAssertion string + AuthorizationType authority.AuthorizeType +} + +// AcquireTokenAuthCodeParameters contains the parameters required to acquire an access token using the auth code flow. +// To use PKCE, set the CodeChallengeParameter. +// Code challenges are used to secure authorization code grants; for more information, visit +// https://tools.ietf.org/html/rfc7636. +type AcquireTokenAuthCodeParameters struct { + Scopes []string + Code string + Challenge string + RedirectURI string + AppType accesstokens.AppType + Credential *accesstokens.Credential +} + +type AcquireTokenOnBehalfOfParameters struct { + Scopes []string + Credential *accesstokens.Credential + UserAssertion string +} + +// AuthResult contains the results of one token acquisition operation in PublicClientApplication +// or ConfidentialClientApplication. For details see https://aka.ms/msal-net-authenticationresult +type AuthResult struct { + Account shared.Account + IDToken accesstokens.IDToken + AccessToken string + ExpiresOn time.Time + GrantedScopes []string + DeclinedScopes []string +} + +// AuthResultFromStorage creates an AuthResult from a storage token response (which is generated from the cache). +func AuthResultFromStorage(storageTokenResponse storage.TokenResponse) (AuthResult, error) { + if err := storageTokenResponse.AccessToken.Validate(); err != nil { + return AuthResult{}, fmt.Errorf("problem with access token in StorageTokenResponse: %w", err) + } + + account := storageTokenResponse.Account + accessToken := storageTokenResponse.AccessToken.Secret + grantedScopes := strings.Split(storageTokenResponse.AccessToken.Scopes, scopeSeparator) + + // Checking if there was an ID token in the cache; this will throw an error in the case of confidential client applications. + var idToken accesstokens.IDToken + if !storageTokenResponse.IDToken.IsZero() { + err := idToken.UnmarshalJSON([]byte(storageTokenResponse.IDToken.Secret)) + if err != nil { + return AuthResult{}, fmt.Errorf("problem decoding JWT token: %w", err) + } + } + return AuthResult{account, idToken, accessToken, storageTokenResponse.AccessToken.ExpiresOn.T, grantedScopes, nil}, nil +} + +// NewAuthResult creates an AuthResult. +func NewAuthResult(tokenResponse accesstokens.TokenResponse, account shared.Account) (AuthResult, error) { + if len(tokenResponse.DeclinedScopes) > 0 { + return AuthResult{}, fmt.Errorf("token response failed because declined scopes are present: %s", strings.Join(tokenResponse.DeclinedScopes, ",")) + } + return AuthResult{ + Account: account, + IDToken: tokenResponse.IDToken, + AccessToken: tokenResponse.AccessToken, + ExpiresOn: tokenResponse.ExpiresOn.T, + GrantedScopes: tokenResponse.GrantedScopes.Slice, + }, nil +} + +// Client is a base client that provides access to common methods and primatives that +// can be used by multiple clients. +type Client struct { + Token *oauth.Client + manager manager // *storage.Manager or fakeManager in tests + pmanager partitionedManager // *storage.PartitionedManager or fakeManager in tests + + AuthParams authority.AuthParams // DO NOT EVER MAKE THIS A POINTER! See "Note" in New(). + cacheAccessor cache.ExportReplace +} + +// Option is an optional argument to the New constructor. +type Option func(c *Client) + +// WithCacheAccessor allows you to set some type of cache for storing authentication tokens. +func WithCacheAccessor(ca cache.ExportReplace) Option { + return func(c *Client) { + if ca != nil { + c.cacheAccessor = ca + } + } +} + +// WithKnownAuthorityHosts specifies hosts Client shouldn't validate or request metadata for because they're known to the user +func WithKnownAuthorityHosts(hosts []string) Option { + return func(c *Client) { + cp := make([]string, len(hosts)) + copy(cp, hosts) + c.AuthParams.KnownAuthorityHosts = cp + } +} + +// WithX5C specifies if x5c claim(public key of the certificate) should be sent to STS to enable Subject Name Issuer Authentication. +func WithX5C(sendX5C bool) Option { + return func(c *Client) { + c.AuthParams.SendX5C = sendX5C + } +} + +func WithRegionDetection(region string) Option { + return func(c *Client) { + c.AuthParams.AuthorityInfo.Region = region + } +} + +// New is the constructor for Base. +func New(clientID string, authorityURI string, token *oauth.Client, options ...Option) (Client, error) { + authInfo, err := authority.NewInfoFromAuthorityURI(authorityURI, true) + if err != nil { + return Client{}, err + } + authParams := authority.NewAuthParams(clientID, authInfo) + client := Client{ // Note: Hey, don't even THINK about making Base into *Base. See "design notes" in public.go and confidential.go + Token: token, + AuthParams: authParams, + cacheAccessor: noopCacheAccessor{}, + manager: storage.New(token), + pmanager: storage.NewPartitionedManager(token), + } + for _, o := range options { + o(&client) + } + return client, nil + +} + +// AuthCodeURL creates a URL used to acquire an authorization code. +func (b Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string, authParams authority.AuthParams) (string, error) { + endpoints, err := b.Token.ResolveEndpoints(ctx, authParams.AuthorityInfo, "") + if err != nil { + return "", err + } + + baseURL, err := url.Parse(endpoints.AuthorizationEndpoint) + if err != nil { + return "", err + } + + v := url.Values{} + v.Add("client_id", clientID) + v.Add("response_type", "code") + v.Add("redirect_uri", redirectURI) + v.Add("scope", strings.Join(scopes, scopeSeparator)) + if authParams.State != "" { + v.Add("state", authParams.State) + } + if authParams.CodeChallenge != "" { + v.Add("code_challenge", authParams.CodeChallenge) + } + if authParams.CodeChallengeMethod != "" { + v.Add("code_challenge_method", authParams.CodeChallengeMethod) + } + if authParams.Prompt != "" { + v.Add("prompt", authParams.Prompt) + } + // There were left over from an implementation that didn't use any of these. We may + // need to add them later, but as of now aren't needed. + /* + if p.ResponseMode != "" { + urlParams.Add("response_mode", p.ResponseMode) + } + if p.LoginHint != "" { + urlParams.Add("login_hint", p.LoginHint) + } + if p.DomainHint != "" { + urlParams.Add("domain_hint", p.DomainHint) + } + */ + baseURL.RawQuery = v.Encode() + return baseURL.String(), nil +} + +func (b Client) AcquireTokenSilent(ctx context.Context, silent AcquireTokenSilentParameters) (AuthResult, error) { + authParams := b.AuthParams // This is a copy, as we dont' have a pointer receiver and authParams is not a pointer. + authParams.Scopes = silent.Scopes + authParams.HomeAccountID = silent.Account.HomeAccountID + authParams.AuthorizationType = silent.AuthorizationType + authParams.UserAssertion = silent.UserAssertion + + var storageTokenResponse storage.TokenResponse + var err error + if authParams.AuthorizationType == authority.ATOnBehalfOf { + if s, ok := b.pmanager.(cache.Serializer); ok { + suggestedCacheKey := authParams.CacheKey(silent.IsAppCache) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + storageTokenResponse, err = b.pmanager.Read(ctx, authParams) + if err != nil { + return AuthResult{}, err + } + } else { + if s, ok := b.manager.(cache.Serializer); ok { + suggestedCacheKey := authParams.CacheKey(silent.IsAppCache) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + authParams.AuthorizationType = authority.ATRefreshToken + storageTokenResponse, err = b.manager.Read(ctx, authParams, silent.Account) + if err != nil { + return AuthResult{}, err + } + } + + result, err := AuthResultFromStorage(storageTokenResponse) + if err != nil { + if reflect.ValueOf(storageTokenResponse.RefreshToken).IsZero() { + return AuthResult{}, errors.New("no token found") + } + + var cc *accesstokens.Credential + if silent.RequestType == accesstokens.ATConfidential { + cc = silent.Credential + } + + token, err := b.Token.Refresh(ctx, silent.RequestType, authParams, cc, storageTokenResponse.RefreshToken) + if err != nil { + return AuthResult{}, err + } + + return b.AuthResultFromToken(ctx, authParams, token, true) + } + return result, nil +} + +func (b Client) AcquireTokenByAuthCode(ctx context.Context, authCodeParams AcquireTokenAuthCodeParameters) (AuthResult, error) { + authParams := b.AuthParams // This is a copy, as we dont' have a pointer receiver and .AuthParams is not a pointer. + authParams.Scopes = authCodeParams.Scopes + authParams.Redirecturi = authCodeParams.RedirectURI + authParams.AuthorizationType = authority.ATAuthCode + + var cc *accesstokens.Credential + if authCodeParams.AppType == accesstokens.ATConfidential { + cc = authCodeParams.Credential + authParams.IsConfidentialClient = true + } + + req, err := accesstokens.NewCodeChallengeRequest(authParams, authCodeParams.AppType, cc, authCodeParams.Code, authCodeParams.Challenge) + if err != nil { + return AuthResult{}, err + } + + token, err := b.Token.AuthCode(ctx, req) + if err != nil { + return AuthResult{}, err + } + + return b.AuthResultFromToken(ctx, authParams, token, true) +} + +// AcquireTokenOnBehalfOf acquires a security token for an app using middle tier apps access token. +func (b Client) AcquireTokenOnBehalfOf(ctx context.Context, onBehalfOfParams AcquireTokenOnBehalfOfParameters) (AuthResult, error) { + authParams := b.AuthParams // This is a copy, as we dont' have a pointer receiver and .AuthParams is not a pointer. + authParams.Scopes = onBehalfOfParams.Scopes + authParams.AuthorizationType = authority.ATOnBehalfOf + authParams.UserAssertion = onBehalfOfParams.UserAssertion + + silentParameters := AcquireTokenSilentParameters{ + Scopes: onBehalfOfParams.Scopes, + RequestType: accesstokens.ATConfidential, + Credential: onBehalfOfParams.Credential, + UserAssertion: onBehalfOfParams.UserAssertion, + AuthorizationType: authority.ATOnBehalfOf, + } + token, err := b.AcquireTokenSilent(ctx, silentParameters) + if err != nil { + fmt.Println("Acquire Token Silent failed ") + token, err := b.Token.OnBehalfOf(ctx, authParams, onBehalfOfParams.Credential) + if err != nil { + return AuthResult{}, err + } + return b.AuthResultFromToken(ctx, authParams, token, true) + } + return token, err +} + +func (b Client) AuthResultFromToken(ctx context.Context, authParams authority.AuthParams, token accesstokens.TokenResponse, cacheWrite bool) (AuthResult, error) { + if !cacheWrite { + return NewAuthResult(token, shared.Account{}) + } + + var account shared.Account + var err error + if authParams.AuthorizationType == authority.ATOnBehalfOf { + if s, ok := b.pmanager.(cache.Serializer); ok { + suggestedCacheKey := token.CacheKey(authParams) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + account, err = b.pmanager.Write(authParams, token) + if err != nil { + return AuthResult{}, err + } + } else { + if s, ok := b.manager.(cache.Serializer); ok { + suggestedCacheKey := token.CacheKey(authParams) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + account, err = b.manager.Write(authParams, token) + if err != nil { + return AuthResult{}, err + } + } + return NewAuthResult(token, account) +} + +func (b Client) AllAccounts() []shared.Account { + if s, ok := b.manager.(cache.Serializer); ok { + suggestedCacheKey := b.AuthParams.CacheKey(false) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + + accounts := b.manager.AllAccounts() + return accounts +} + +func (b Client) Account(homeAccountID string) shared.Account { + authParams := b.AuthParams // This is a copy, as we dont' have a pointer receiver and .AuthParams is not a pointer. + authParams.AuthorizationType = authority.AccountByID + authParams.HomeAccountID = homeAccountID + if s, ok := b.manager.(cache.Serializer); ok { + suggestedCacheKey := b.AuthParams.CacheKey(false) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + account := b.manager.Account(homeAccountID) + return account +} + +// RemoveAccount removes all the ATs, RTs and IDTs from the cache associated with this account. +func (b Client) RemoveAccount(account shared.Account) { + if s, ok := b.manager.(cache.Serializer); ok { + suggestedCacheKey := b.AuthParams.CacheKey(false) + b.cacheAccessor.Replace(s, suggestedCacheKey) + defer b.cacheAccessor.Export(s, suggestedCacheKey) + } + b.manager.RemoveAccount(account, b.AuthParams.ClientID) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/items.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/items.go new file mode 100644 index 000000000..548c2faeb --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/items.go @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package storage + +import ( + "errors" + "fmt" + "reflect" + "strings" + "time" + + internalTime "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +// Contract is the JSON structure that is written to any storage medium when serializing +// the internal cache. This design is shared between MSAL versions in many languages. +// This cannot be changed without design that includes other SDKs. +type Contract struct { + AccessTokens map[string]AccessToken `json:"AccessToken,omitempty"` + RefreshTokens map[string]accesstokens.RefreshToken `json:"RefreshToken,omitempty"` + IDTokens map[string]IDToken `json:"IdToken,omitempty"` + Accounts map[string]shared.Account `json:"Account,omitempty"` + AppMetaData map[string]AppMetaData `json:"AppMetadata,omitempty"` + + AdditionalFields map[string]interface{} +} + +// Contract is the JSON structure that is written to any storage medium when serializing +// the internal cache. This design is shared between MSAL versions in many languages. +// This cannot be changed without design that includes other SDKs. +type InMemoryContract struct { + AccessTokensPartition map[string]map[string]AccessToken + RefreshTokensPartition map[string]map[string]accesstokens.RefreshToken + IDTokensPartition map[string]map[string]IDToken + AccountsPartition map[string]map[string]shared.Account + AppMetaData map[string]AppMetaData +} + +// NewContract is the constructor for Contract. +func NewInMemoryContract() *InMemoryContract { + return &InMemoryContract{ + AccessTokensPartition: map[string]map[string]AccessToken{}, + RefreshTokensPartition: map[string]map[string]accesstokens.RefreshToken{}, + IDTokensPartition: map[string]map[string]IDToken{}, + AccountsPartition: map[string]map[string]shared.Account{}, + AppMetaData: map[string]AppMetaData{}, + } +} + +// NewContract is the constructor for Contract. +func NewContract() *Contract { + return &Contract{ + AccessTokens: map[string]AccessToken{}, + RefreshTokens: map[string]accesstokens.RefreshToken{}, + IDTokens: map[string]IDToken{}, + Accounts: map[string]shared.Account{}, + AppMetaData: map[string]AppMetaData{}, + AdditionalFields: map[string]interface{}{}, + } +} + +// AccessToken is the JSON representation of a MSAL access token for encoding to storage. +type AccessToken struct { + HomeAccountID string `json:"home_account_id,omitempty"` + Environment string `json:"environment,omitempty"` + Realm string `json:"realm,omitempty"` + CredentialType string `json:"credential_type,omitempty"` + ClientID string `json:"client_id,omitempty"` + Secret string `json:"secret,omitempty"` + Scopes string `json:"target,omitempty"` + ExpiresOn internalTime.Unix `json:"expires_on,omitempty"` + ExtendedExpiresOn internalTime.Unix `json:"extended_expires_on,omitempty"` + CachedAt internalTime.Unix `json:"cached_at,omitempty"` + UserAssertionHash string `json:"user_assertion_hash,omitempty"` + + AdditionalFields map[string]interface{} +} + +// NewAccessToken is the constructor for AccessToken. +func NewAccessToken(homeID, env, realm, clientID string, cachedAt, expiresOn, extendedExpiresOn time.Time, scopes, token string) AccessToken { + return AccessToken{ + HomeAccountID: homeID, + Environment: env, + Realm: realm, + CredentialType: "AccessToken", + ClientID: clientID, + Secret: token, + Scopes: scopes, + CachedAt: internalTime.Unix{T: cachedAt.UTC()}, + ExpiresOn: internalTime.Unix{T: expiresOn.UTC()}, + ExtendedExpiresOn: internalTime.Unix{T: extendedExpiresOn.UTC()}, + } +} + +// Key outputs the key that can be used to uniquely look up this entry in a map. +func (a AccessToken) Key() string { + return strings.Join( + []string{a.HomeAccountID, a.Environment, a.CredentialType, a.ClientID, a.Realm, a.Scopes}, + shared.CacheKeySeparator, + ) +} + +// FakeValidate enables tests to fake access token validation +var FakeValidate func(AccessToken) error + +// Validate validates that this AccessToken can be used. +func (a AccessToken) Validate() error { + if FakeValidate != nil { + return FakeValidate(a) + } + if a.CachedAt.T.After(time.Now()) { + return errors.New("access token isn't valid, it was cached at a future time") + } + if a.ExpiresOn.T.Before(time.Now().Add(5 * time.Minute)) { + return fmt.Errorf("access token is expired") + } + if a.CachedAt.T.IsZero() { + return fmt.Errorf("access token does not have CachedAt set") + } + return nil +} + +// IDToken is the JSON representation of an MSAL id token for encoding to storage. +type IDToken struct { + HomeAccountID string `json:"home_account_id,omitempty"` + Environment string `json:"environment,omitempty"` + Realm string `json:"realm,omitempty"` + CredentialType string `json:"credential_type,omitempty"` + ClientID string `json:"client_id,omitempty"` + Secret string `json:"secret,omitempty"` + UserAssertionHash string `json:"user_assertion_hash,omitempty"` + AdditionalFields map[string]interface{} +} + +// IsZero determines if IDToken is the zero value. +func (i IDToken) IsZero() bool { + v := reflect.ValueOf(i) + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if !field.IsZero() { + switch field.Kind() { + case reflect.Map, reflect.Slice: + if field.Len() == 0 { + continue + } + } + return false + } + } + return true +} + +// NewIDToken is the constructor for IDToken. +func NewIDToken(homeID, env, realm, clientID, idToken string) IDToken { + return IDToken{ + HomeAccountID: homeID, + Environment: env, + Realm: realm, + CredentialType: "IDToken", + ClientID: clientID, + Secret: idToken, + } +} + +// Key outputs the key that can be used to uniquely look up this entry in a map. +func (id IDToken) Key() string { + return strings.Join( + []string{id.HomeAccountID, id.Environment, id.CredentialType, id.ClientID, id.Realm}, + shared.CacheKeySeparator, + ) +} + +// AppMetaData is the JSON representation of application metadata for encoding to storage. +type AppMetaData struct { + FamilyID string `json:"family_id,omitempty"` + ClientID string `json:"client_id,omitempty"` + Environment string `json:"environment,omitempty"` + + AdditionalFields map[string]interface{} +} + +// NewAppMetaData is the constructor for AppMetaData. +func NewAppMetaData(familyID, clientID, environment string) AppMetaData { + return AppMetaData{ + FamilyID: familyID, + ClientID: clientID, + Environment: environment, + } +} + +// Key outputs the key that can be used to uniquely look up this entry in a map. +func (a AppMetaData) Key() string { + return strings.Join( + []string{"AppMetaData", a.Environment, a.ClientID}, + shared.CacheKeySeparator, + ) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/partitioned_storage.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/partitioned_storage.go new file mode 100644 index 000000000..d17e7c034 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/partitioned_storage.go @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package storage + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +// PartitionedManager is a partitioned in-memory cache of access tokens, accounts and meta data. +type PartitionedManager struct { + contract *InMemoryContract + contractMu sync.RWMutex + requests aadInstanceDiscoveryer // *oauth.Token + + aadCacheMu sync.RWMutex + aadCache map[string]authority.InstanceDiscoveryMetadata +} + +// NewPartitionedManager is the constructor for PartitionedManager. +func NewPartitionedManager(requests *oauth.Client) *PartitionedManager { + m := &PartitionedManager{requests: requests, aadCache: make(map[string]authority.InstanceDiscoveryMetadata)} + m.contract = NewInMemoryContract() + return m +} + +// Read reads a storage token from the cache if it exists. +func (m *PartitionedManager) Read(ctx context.Context, authParameters authority.AuthParams) (TokenResponse, error) { + realm := authParameters.AuthorityInfo.Tenant + clientID := authParameters.ClientID + scopes := authParameters.Scopes + + metadata, err := m.getMetadataEntry(ctx, authParameters.AuthorityInfo) + if err != nil { + return TokenResponse{}, err + } + userAssertionHash := authParameters.AssertionHash() + partitionKeyFromRequest := userAssertionHash + + accessToken, err := m.readAccessToken(metadata.Aliases, realm, clientID, userAssertionHash, scopes, partitionKeyFromRequest) + if err != nil { + return TokenResponse{}, err + } + + AppMetaData, err := m.readAppMetaData(metadata.Aliases, clientID) + if err != nil { + return TokenResponse{}, err + } + familyID := AppMetaData.FamilyID + + refreshToken, err := m.readRefreshToken(metadata.Aliases, familyID, clientID, userAssertionHash, partitionKeyFromRequest) + if err != nil { + return TokenResponse{}, err + } + + idToken, err := m.readIDToken(metadata.Aliases, realm, clientID, userAssertionHash, getPartitionKeyIDTokenRead(accessToken)) + if err != nil { + return TokenResponse{}, err + } + + account, err := m.readAccount(metadata.Aliases, realm, userAssertionHash, idToken.HomeAccountID) + if err != nil { + return TokenResponse{}, err + } + return TokenResponse{ + AccessToken: accessToken, + RefreshToken: refreshToken, + IDToken: idToken, + Account: account, + }, nil +} + +// Write writes a token response to the cache and returns the account information the token is stored with. +func (m *PartitionedManager) Write(authParameters authority.AuthParams, tokenResponse accesstokens.TokenResponse) (shared.Account, error) { + authParameters.HomeAccountID = tokenResponse.ClientInfo.HomeAccountID() + homeAccountID := authParameters.HomeAccountID + environment := authParameters.AuthorityInfo.Host + realm := authParameters.AuthorityInfo.Tenant + clientID := authParameters.ClientID + target := strings.Join(tokenResponse.GrantedScopes.Slice, scopeSeparator) + userAssertionHash := authParameters.AssertionHash() + cachedAt := time.Now() + + var account shared.Account + + if len(tokenResponse.RefreshToken) > 0 { + refreshToken := accesstokens.NewRefreshToken(homeAccountID, environment, clientID, tokenResponse.RefreshToken, tokenResponse.FamilyID) + if authParameters.AuthorizationType == authority.ATOnBehalfOf { + refreshToken.UserAssertionHash = userAssertionHash + } + if err := m.writeRefreshToken(refreshToken, getPartitionKeyRefreshToken(refreshToken)); err != nil { + return account, err + } + } + + if len(tokenResponse.AccessToken) > 0 { + accessToken := NewAccessToken( + homeAccountID, + environment, + realm, + clientID, + cachedAt, + tokenResponse.ExpiresOn.T, + tokenResponse.ExtExpiresOn.T, + target, + tokenResponse.AccessToken, + ) + if authParameters.AuthorizationType == authority.ATOnBehalfOf { + accessToken.UserAssertionHash = userAssertionHash // get Hash method on this + } + + // Since we have a valid access token, cache it before moving on. + if err := accessToken.Validate(); err == nil { + if err := m.writeAccessToken(accessToken, getPartitionKeyAccessToken(accessToken)); err != nil { + return account, err + } + } else { + return shared.Account{}, err + } + } + + idTokenJwt := tokenResponse.IDToken + if !idTokenJwt.IsZero() { + idToken := NewIDToken(homeAccountID, environment, realm, clientID, idTokenJwt.RawToken) + if authParameters.AuthorizationType == authority.ATOnBehalfOf { + idToken.UserAssertionHash = userAssertionHash + } + if err := m.writeIDToken(idToken, getPartitionKeyIDToken(idToken)); err != nil { + return shared.Account{}, err + } + + localAccountID := idTokenJwt.LocalAccountID() + authorityType := authParameters.AuthorityInfo.AuthorityType + + account = shared.NewAccount( + homeAccountID, + environment, + realm, + localAccountID, + authorityType, + idTokenJwt.PreferredUsername, + ) + if authParameters.AuthorizationType == authority.ATOnBehalfOf { + account.UserAssertionHash = userAssertionHash + } + if err := m.writeAccount(account, getPartitionKeyAccount(account)); err != nil { + return shared.Account{}, err + } + } + + AppMetaData := NewAppMetaData(tokenResponse.FamilyID, clientID, environment) + + if err := m.writeAppMetaData(AppMetaData); err != nil { + return shared.Account{}, err + } + return account, nil +} + +func (m *PartitionedManager) getMetadataEntry(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + md, err := m.aadMetadataFromCache(ctx, authorityInfo) + if err != nil { + // not in the cache, retrieve it + md, err = m.aadMetadata(ctx, authorityInfo) + } + return md, err +} + +func (m *PartitionedManager) aadMetadataFromCache(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + m.aadCacheMu.RLock() + defer m.aadCacheMu.RUnlock() + metadata, ok := m.aadCache[authorityInfo.Host] + if ok { + return metadata, nil + } + return metadata, errors.New("not found") +} + +func (m *PartitionedManager) aadMetadata(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + discoveryResponse, err := m.requests.AADInstanceDiscovery(ctx, authorityInfo) + if err != nil { + return authority.InstanceDiscoveryMetadata{}, err + } + + m.aadCacheMu.Lock() + defer m.aadCacheMu.Unlock() + + for _, metadataEntry := range discoveryResponse.Metadata { + for _, aliasedAuthority := range metadataEntry.Aliases { + m.aadCache[aliasedAuthority] = metadataEntry + } + } + if _, ok := m.aadCache[authorityInfo.Host]; !ok { + m.aadCache[authorityInfo.Host] = authority.InstanceDiscoveryMetadata{ + PreferredNetwork: authorityInfo.Host, + PreferredCache: authorityInfo.Host, + } + } + return m.aadCache[authorityInfo.Host], nil +} + +func (m *PartitionedManager) readAccessToken(envAliases []string, realm, clientID, userAssertionHash string, scopes []string, partitionKey string) (AccessToken, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + if accessTokens, ok := m.contract.AccessTokensPartition[partitionKey]; ok { + // TODO: linear search (over a map no less) is slow for a large number (thousands) of tokens. + // this shows up as the dominating node in a profile. for real-world scenarios this likely isn't + // an issue, however if it does become a problem then we know where to look. + for _, at := range accessTokens { + if at.Realm == realm && at.ClientID == clientID && at.UserAssertionHash == userAssertionHash { + if checkAlias(at.Environment, envAliases) { + if isMatchingScopes(scopes, at.Scopes) { + return at, nil + } + } + } + } + } + return AccessToken{}, fmt.Errorf("access token not found") +} + +func (m *PartitionedManager) writeAccessToken(accessToken AccessToken, partitionKey string) error { + m.contractMu.Lock() + defer m.contractMu.Unlock() + key := accessToken.Key() + if m.contract.AccessTokensPartition[partitionKey] == nil { + m.contract.AccessTokensPartition[partitionKey] = make(map[string]AccessToken) + } + m.contract.AccessTokensPartition[partitionKey][key] = accessToken + return nil +} + +func matchFamilyRefreshTokenObo(rt accesstokens.RefreshToken, userAssertionHash string, envAliases []string) bool { + return rt.UserAssertionHash == userAssertionHash && checkAlias(rt.Environment, envAliases) && rt.FamilyID != "" +} + +func matchClientIDRefreshTokenObo(rt accesstokens.RefreshToken, userAssertionHash string, envAliases []string, clientID string) bool { + return rt.UserAssertionHash == userAssertionHash && checkAlias(rt.Environment, envAliases) && rt.ClientID == clientID +} + +func (m *PartitionedManager) readRefreshToken(envAliases []string, familyID, clientID, userAssertionHash, partitionKey string) (accesstokens.RefreshToken, error) { + byFamily := func(rt accesstokens.RefreshToken) bool { + return matchFamilyRefreshTokenObo(rt, userAssertionHash, envAliases) + } + byClient := func(rt accesstokens.RefreshToken) bool { + return matchClientIDRefreshTokenObo(rt, userAssertionHash, envAliases, clientID) + } + + var matchers []func(rt accesstokens.RefreshToken) bool + if familyID == "" { + matchers = []func(rt accesstokens.RefreshToken) bool{ + byClient, byFamily, + } + } else { + matchers = []func(rt accesstokens.RefreshToken) bool{ + byFamily, byClient, + } + } + + // TODO(keegan): All the tests here pass, but Bogdan says this is + // more complicated. I'm opening an issue for this to have him + // review the tests and suggest tests that would break this so + // we can re-write against good tests. His comments as follow: + // The algorithm is a bit more complex than this, I assume there are some tests covering everything. I would keep the order as is. + // The algorithm is: + // If application is NOT part of the family, search by client_ID + // If app is part of the family or if we DO NOT KNOW if it's part of the family, search by family ID, then by client_id (we will know if an app is part of the family after the first token response). + // https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/311fe8b16e7c293462806f397e189a6aa1159769/src/client/Microsoft.Identity.Client/Internal/Requests/Silent/CacheSilentStrategy.cs#L95 + m.contractMu.RLock() + defer m.contractMu.RUnlock() + for _, matcher := range matchers { + for _, rt := range m.contract.RefreshTokensPartition[partitionKey] { + if matcher(rt) { + return rt, nil + } + } + } + + return accesstokens.RefreshToken{}, fmt.Errorf("refresh token not found") +} + +func (m *PartitionedManager) writeRefreshToken(refreshToken accesstokens.RefreshToken, partitionKey string) error { + m.contractMu.Lock() + defer m.contractMu.Unlock() + key := refreshToken.Key() + if m.contract.AccessTokensPartition[partitionKey] == nil { + m.contract.RefreshTokensPartition[partitionKey] = make(map[string]accesstokens.RefreshToken) + } + m.contract.RefreshTokensPartition[partitionKey][key] = refreshToken + return nil +} + +func (m *PartitionedManager) readIDToken(envAliases []string, realm, clientID, userAssertionHash, partitionKey string) (IDToken, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + for _, idt := range m.contract.IDTokensPartition[partitionKey] { + if idt.Realm == realm && idt.ClientID == clientID && idt.UserAssertionHash == userAssertionHash { + if checkAlias(idt.Environment, envAliases) { + return idt, nil + } + } + } + return IDToken{}, fmt.Errorf("token not found") +} + +func (m *PartitionedManager) writeIDToken(idToken IDToken, partitionKey string) error { + key := idToken.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + if m.contract.IDTokensPartition[partitionKey] == nil { + m.contract.IDTokensPartition[partitionKey] = make(map[string]IDToken) + } + m.contract.IDTokensPartition[partitionKey][key] = idToken + return nil +} + +func (m *PartitionedManager) readAccount(envAliases []string, realm, UserAssertionHash, partitionKey string) (shared.Account, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + // You might ask why, if cache.Accounts is a map, we would loop through all of these instead of using a key. + // We only use a map because the storage contract shared between all language implementations says use a map. + // We can't change that. The other is because the keys are made using a specific "env", but here we are allowing + // a match in multiple envs (envAlias). That means we either need to hash each possible keyand do the lookup + // or just statically check. Since the design is to have a storage.Manager per user, the amount of keys stored + // is really low (say 2). Each hash is more expensive than the entire iteration. + for _, acc := range m.contract.AccountsPartition[partitionKey] { + if checkAlias(acc.Environment, envAliases) && acc.UserAssertionHash == UserAssertionHash && acc.Realm == realm { + return acc, nil + } + } + return shared.Account{}, fmt.Errorf("account not found") +} + +func (m *PartitionedManager) writeAccount(account shared.Account, partitionKey string) error { + key := account.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + if m.contract.AccountsPartition[partitionKey] == nil { + m.contract.AccountsPartition[partitionKey] = make(map[string]shared.Account) + } + m.contract.AccountsPartition[partitionKey][key] = account + return nil +} + +func (m *PartitionedManager) readAppMetaData(envAliases []string, clientID string) (AppMetaData, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + for _, app := range m.contract.AppMetaData { + if checkAlias(app.Environment, envAliases) && app.ClientID == clientID { + return app, nil + } + } + return AppMetaData{}, fmt.Errorf("not found") +} + +func (m *PartitionedManager) writeAppMetaData(AppMetaData AppMetaData) error { + key := AppMetaData.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract.AppMetaData[key] = AppMetaData + return nil +} + +// update updates the internal cache object. This is for use in tests, other uses are not +// supported. +func (m *PartitionedManager) update(cache *InMemoryContract) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract = cache +} + +// Marshal implements cache.Marshaler. +func (m *PartitionedManager) Marshal() ([]byte, error) { + return json.Marshal(m.contract) +} + +// Unmarshal implements cache.Unmarshaler. +func (m *PartitionedManager) Unmarshal(b []byte) error { + m.contractMu.Lock() + defer m.contractMu.Unlock() + + contract := NewInMemoryContract() + + err := json.Unmarshal(b, contract) + if err != nil { + return err + } + + m.contract = contract + + return nil +} + +func getPartitionKeyAccessToken(item AccessToken) string { + if item.UserAssertionHash != "" { + return item.UserAssertionHash + } + return item.HomeAccountID +} + +func getPartitionKeyRefreshToken(item accesstokens.RefreshToken) string { + if item.UserAssertionHash != "" { + return item.UserAssertionHash + } + return item.HomeAccountID +} + +func getPartitionKeyIDToken(item IDToken) string { + return item.HomeAccountID +} + +func getPartitionKeyAccount(item shared.Account) string { + return item.HomeAccountID +} + +func getPartitionKeyIDTokenRead(item AccessToken) string { + return item.HomeAccountID +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/storage.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/storage.go new file mode 100644 index 000000000..b759408b5 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/storage.go @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package storage holds all cached token information for MSAL. This storage can be +// augmented with third-party extensions to provide persistent storage. In that case, +// reads and writes in upper packages will call Marshal() to take the entire in-memory +// representation and write it to storage and Unmarshal() to update the entire in-memory +// storage with what was in the persistent storage. The persistent storage can only be +// accessed in this way because multiple MSAL clients written in multiple languages can +// access the same storage and must adhere to the same method that was defined +// previously. +package storage + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +// aadInstanceDiscoveryer allows faking in tests. +// It is implemented in production by ops/authority.Client +type aadInstanceDiscoveryer interface { + AADInstanceDiscovery(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryResponse, error) +} + +// TokenResponse mimics a token response that was pulled from the cache. +type TokenResponse struct { + RefreshToken accesstokens.RefreshToken + IDToken IDToken // *Credential + AccessToken AccessToken + Account shared.Account +} + +// Manager is an in-memory cache of access tokens, accounts and meta data. This data is +// updated on read/write calls. Unmarshal() replaces all data stored here with whatever +// was given to it on each call. +type Manager struct { + contract *Contract + contractMu sync.RWMutex + requests aadInstanceDiscoveryer // *oauth.Token + + aadCacheMu sync.RWMutex + aadCache map[string]authority.InstanceDiscoveryMetadata +} + +// New is the constructor for Manager. +func New(requests *oauth.Client) *Manager { + m := &Manager{requests: requests, aadCache: make(map[string]authority.InstanceDiscoveryMetadata)} + m.contract = NewContract() + return m +} + +func checkAlias(alias string, aliases []string) bool { + for _, v := range aliases { + if alias == v { + return true + } + } + return false +} + +func isMatchingScopes(scopesOne []string, scopesTwo string) bool { + newScopesTwo := strings.Split(scopesTwo, scopeSeparator) + scopeCounter := 0 + for _, scope := range scopesOne { + for _, otherScope := range newScopesTwo { + if strings.EqualFold(scope, otherScope) { + scopeCounter++ + continue + } + } + } + return scopeCounter == len(scopesOne) +} + +// Read reads a storage token from the cache if it exists. +func (m *Manager) Read(ctx context.Context, authParameters authority.AuthParams, account shared.Account) (TokenResponse, error) { + homeAccountID := authParameters.HomeAccountID + realm := authParameters.AuthorityInfo.Tenant + clientID := authParameters.ClientID + scopes := authParameters.Scopes + + // fetch metadata if and only if the authority isn't explicitly trusted + aliases := authParameters.KnownAuthorityHosts + if len(aliases) == 0 { + metadata, err := m.getMetadataEntry(ctx, authParameters.AuthorityInfo) + if err != nil { + return TokenResponse{}, err + } + aliases = metadata.Aliases + } + + accessToken := m.readAccessToken(homeAccountID, aliases, realm, clientID, scopes) + + if account.IsZero() { + return TokenResponse{ + AccessToken: accessToken, + RefreshToken: accesstokens.RefreshToken{}, + IDToken: IDToken{}, + Account: shared.Account{}, + }, nil + } + idToken, err := m.readIDToken(homeAccountID, aliases, realm, clientID) + if err != nil { + return TokenResponse{}, err + } + + AppMetaData, err := m.readAppMetaData(aliases, clientID) + if err != nil { + return TokenResponse{}, err + } + familyID := AppMetaData.FamilyID + + refreshToken, err := m.readRefreshToken(homeAccountID, aliases, familyID, clientID) + if err != nil { + return TokenResponse{}, err + } + account, err = m.readAccount(homeAccountID, aliases, realm) + if err != nil { + return TokenResponse{}, err + } + return TokenResponse{ + AccessToken: accessToken, + RefreshToken: refreshToken, + IDToken: idToken, + Account: account, + }, nil +} + +const scopeSeparator = " " + +// Write writes a token response to the cache and returns the account information the token is stored with. +func (m *Manager) Write(authParameters authority.AuthParams, tokenResponse accesstokens.TokenResponse) (shared.Account, error) { + authParameters.HomeAccountID = tokenResponse.ClientInfo.HomeAccountID() + homeAccountID := authParameters.HomeAccountID + environment := authParameters.AuthorityInfo.Host + realm := authParameters.AuthorityInfo.Tenant + clientID := authParameters.ClientID + target := strings.Join(tokenResponse.GrantedScopes.Slice, scopeSeparator) + + cachedAt := time.Now() + + var account shared.Account + + if len(tokenResponse.RefreshToken) > 0 { + refreshToken := accesstokens.NewRefreshToken(homeAccountID, environment, clientID, tokenResponse.RefreshToken, tokenResponse.FamilyID) + if err := m.writeRefreshToken(refreshToken); err != nil { + return account, err + } + } + + if len(tokenResponse.AccessToken) > 0 { + accessToken := NewAccessToken( + homeAccountID, + environment, + realm, + clientID, + cachedAt, + tokenResponse.ExpiresOn.T, + tokenResponse.ExtExpiresOn.T, + target, + tokenResponse.AccessToken, + ) + + // Since we have a valid access token, cache it before moving on. + if err := accessToken.Validate(); err == nil { + if err := m.writeAccessToken(accessToken); err != nil { + return account, err + } + } + } + + idTokenJwt := tokenResponse.IDToken + if !idTokenJwt.IsZero() { + idToken := NewIDToken(homeAccountID, environment, realm, clientID, idTokenJwt.RawToken) + if err := m.writeIDToken(idToken); err != nil { + return shared.Account{}, err + } + + localAccountID := idTokenJwt.LocalAccountID() + authorityType := authParameters.AuthorityInfo.AuthorityType + + account = shared.NewAccount( + homeAccountID, + environment, + realm, + localAccountID, + authorityType, + idTokenJwt.PreferredUsername, + ) + if err := m.writeAccount(account); err != nil { + return shared.Account{}, err + } + } + + AppMetaData := NewAppMetaData(tokenResponse.FamilyID, clientID, environment) + + if err := m.writeAppMetaData(AppMetaData); err != nil { + return shared.Account{}, err + } + return account, nil +} + +func (m *Manager) getMetadataEntry(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + md, err := m.aadMetadataFromCache(ctx, authorityInfo) + if err != nil { + // not in the cache, retrieve it + md, err = m.aadMetadata(ctx, authorityInfo) + } + return md, err +} + +func (m *Manager) aadMetadataFromCache(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + m.aadCacheMu.RLock() + defer m.aadCacheMu.RUnlock() + metadata, ok := m.aadCache[authorityInfo.Host] + if ok { + return metadata, nil + } + return metadata, errors.New("not found") +} + +func (m *Manager) aadMetadata(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryMetadata, error) { + m.aadCacheMu.Lock() + defer m.aadCacheMu.Unlock() + discoveryResponse, err := m.requests.AADInstanceDiscovery(ctx, authorityInfo) + if err != nil { + return authority.InstanceDiscoveryMetadata{}, err + } + + for _, metadataEntry := range discoveryResponse.Metadata { + for _, aliasedAuthority := range metadataEntry.Aliases { + m.aadCache[aliasedAuthority] = metadataEntry + } + } + if _, ok := m.aadCache[authorityInfo.Host]; !ok { + m.aadCache[authorityInfo.Host] = authority.InstanceDiscoveryMetadata{ + PreferredNetwork: authorityInfo.Host, + PreferredCache: authorityInfo.Host, + } + } + return m.aadCache[authorityInfo.Host], nil +} + +func (m *Manager) readAccessToken(homeID string, envAliases []string, realm, clientID string, scopes []string) AccessToken { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + // TODO: linear search (over a map no less) is slow for a large number (thousands) of tokens. + // this shows up as the dominating node in a profile. for real-world scenarios this likely isn't + // an issue, however if it does become a problem then we know where to look. + for _, at := range m.contract.AccessTokens { + if at.HomeAccountID == homeID && at.Realm == realm && at.ClientID == clientID { + if checkAlias(at.Environment, envAliases) { + if isMatchingScopes(scopes, at.Scopes) { + return at + } + } + } + } + return AccessToken{} +} + +func (m *Manager) writeAccessToken(accessToken AccessToken) error { + m.contractMu.Lock() + defer m.contractMu.Unlock() + key := accessToken.Key() + m.contract.AccessTokens[key] = accessToken + return nil +} + +func (m *Manager) readRefreshToken(homeID string, envAliases []string, familyID, clientID string) (accesstokens.RefreshToken, error) { + byFamily := func(rt accesstokens.RefreshToken) bool { + return matchFamilyRefreshToken(rt, homeID, envAliases) + } + byClient := func(rt accesstokens.RefreshToken) bool { + return matchClientIDRefreshToken(rt, homeID, envAliases, clientID) + } + + var matchers []func(rt accesstokens.RefreshToken) bool + if familyID == "" { + matchers = []func(rt accesstokens.RefreshToken) bool{ + byClient, byFamily, + } + } else { + matchers = []func(rt accesstokens.RefreshToken) bool{ + byFamily, byClient, + } + } + + // TODO(keegan): All the tests here pass, but Bogdan says this is + // more complicated. I'm opening an issue for this to have him + // review the tests and suggest tests that would break this so + // we can re-write against good tests. His comments as follow: + // The algorithm is a bit more complex than this, I assume there are some tests covering everything. I would keep the order as is. + // The algorithm is: + // If application is NOT part of the family, search by client_ID + // If app is part of the family or if we DO NOT KNOW if it's part of the family, search by family ID, then by client_id (we will know if an app is part of the family after the first token response). + // https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/311fe8b16e7c293462806f397e189a6aa1159769/src/client/Microsoft.Identity.Client/Internal/Requests/Silent/CacheSilentStrategy.cs#L95 + m.contractMu.RLock() + defer m.contractMu.RUnlock() + for _, matcher := range matchers { + for _, rt := range m.contract.RefreshTokens { + if matcher(rt) { + return rt, nil + } + } + } + + return accesstokens.RefreshToken{}, fmt.Errorf("refresh token not found") +} + +func matchFamilyRefreshToken(rt accesstokens.RefreshToken, homeID string, envAliases []string) bool { + return rt.HomeAccountID == homeID && checkAlias(rt.Environment, envAliases) && rt.FamilyID != "" +} + +func matchClientIDRefreshToken(rt accesstokens.RefreshToken, homeID string, envAliases []string, clientID string) bool { + return rt.HomeAccountID == homeID && checkAlias(rt.Environment, envAliases) && rt.ClientID == clientID +} + +func (m *Manager) writeRefreshToken(refreshToken accesstokens.RefreshToken) error { + key := refreshToken.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract.RefreshTokens[key] = refreshToken + return nil +} + +func (m *Manager) readIDToken(homeID string, envAliases []string, realm, clientID string) (IDToken, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + for _, idt := range m.contract.IDTokens { + if idt.HomeAccountID == homeID && idt.Realm == realm && idt.ClientID == clientID { + if checkAlias(idt.Environment, envAliases) { + return idt, nil + } + } + } + return IDToken{}, fmt.Errorf("token not found") +} + +func (m *Manager) writeIDToken(idToken IDToken) error { + key := idToken.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract.IDTokens[key] = idToken + return nil +} + +func (m *Manager) AllAccounts() []shared.Account { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + var accounts []shared.Account + for _, v := range m.contract.Accounts { + accounts = append(accounts, v) + } + + return accounts +} + +func (m *Manager) Account(homeAccountID string) shared.Account { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + for _, v := range m.contract.Accounts { + if v.HomeAccountID == homeAccountID { + return v + } + } + + return shared.Account{} +} + +func (m *Manager) readAccount(homeAccountID string, envAliases []string, realm string) (shared.Account, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + // You might ask why, if cache.Accounts is a map, we would loop through all of these instead of using a key. + // We only use a map because the storage contract shared between all language implementations says use a map. + // We can't change that. The other is because the keys are made using a specific "env", but here we are allowing + // a match in multiple envs (envAlias). That means we either need to hash each possible keyand do the lookup + // or just statically check. Since the design is to have a storage.Manager per user, the amount of keys stored + // is really low (say 2). Each hash is more expensive than the entire iteration. + for _, acc := range m.contract.Accounts { + if acc.HomeAccountID == homeAccountID && checkAlias(acc.Environment, envAliases) && acc.Realm == realm { + return acc, nil + } + } + return shared.Account{}, fmt.Errorf("account not found") +} + +func (m *Manager) writeAccount(account shared.Account) error { + key := account.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract.Accounts[key] = account + return nil +} + +func (m *Manager) readAppMetaData(envAliases []string, clientID string) (AppMetaData, error) { + m.contractMu.RLock() + defer m.contractMu.RUnlock() + + for _, app := range m.contract.AppMetaData { + if checkAlias(app.Environment, envAliases) && app.ClientID == clientID { + return app, nil + } + } + return AppMetaData{}, fmt.Errorf("not found") +} + +func (m *Manager) writeAppMetaData(AppMetaData AppMetaData) error { + key := AppMetaData.Key() + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract.AppMetaData[key] = AppMetaData + return nil +} + +// RemoveAccount removes all the associated ATs, RTs and IDTs from the cache associated with this account. +func (m *Manager) RemoveAccount(account shared.Account, clientID string) { + m.removeRefreshTokens(account.HomeAccountID, account.Environment, clientID) + m.removeAccessTokens(account.HomeAccountID, account.Environment) + m.removeIDTokens(account.HomeAccountID, account.Environment) + m.removeAccounts(account.HomeAccountID, account.Environment) +} + +func (m *Manager) removeRefreshTokens(homeID string, env string, clientID string) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + for key, rt := range m.contract.RefreshTokens { + // Check for RTs associated with the account. + if rt.HomeAccountID == homeID && rt.Environment == env { + // Do RT's app ownership check as a precaution, in case family apps + // and 3rd-party apps share same token cache, although they should not. + if rt.ClientID == clientID || rt.FamilyID != "" { + delete(m.contract.RefreshTokens, key) + } + } + } +} + +func (m *Manager) removeAccessTokens(homeID string, env string) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + for key, at := range m.contract.AccessTokens { + // Remove AT's associated with the account + if at.HomeAccountID == homeID && at.Environment == env { + // # To avoid the complexity of locating sibling family app's AT, we skip AT's app ownership check. + // It means ATs for other apps will also be removed, it is OK because: + // non-family apps are not supposed to share token cache to begin with; + // Even if it happens, we keep other app's RT already, so SSO still works. + delete(m.contract.AccessTokens, key) + } + } +} + +func (m *Manager) removeIDTokens(homeID string, env string) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + for key, idt := range m.contract.IDTokens { + // Remove ID tokens associated with the account. + if idt.HomeAccountID == homeID && idt.Environment == env { + delete(m.contract.IDTokens, key) + } + } +} + +func (m *Manager) removeAccounts(homeID string, env string) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + for key, acc := range m.contract.Accounts { + // Remove the specified account. + if acc.HomeAccountID == homeID && acc.Environment == env { + delete(m.contract.Accounts, key) + } + } +} + +// update updates the internal cache object. This is for use in tests, other uses are not +// supported. +func (m *Manager) update(cache *Contract) { + m.contractMu.Lock() + defer m.contractMu.Unlock() + m.contract = cache +} + +// Marshal implements cache.Marshaler. +func (m *Manager) Marshal() ([]byte, error) { + return json.Marshal(m.contract) +} + +// Unmarshal implements cache.Unmarshaler. +func (m *Manager) Unmarshal(b []byte) error { + m.contractMu.Lock() + defer m.contractMu.Unlock() + + contract := NewContract() + + err := json.Unmarshal(b, contract) + if err != nil { + return err + } + + m.contract = contract + + return nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/test_serialized_cache.json b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/test_serialized_cache.json new file mode 100644 index 000000000..1d8181924 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage/test_serialized_cache.json @@ -0,0 +1,56 @@ +{ + "Account": { + "uid.utid-login.windows.net-contoso": { + "username": "John Doe", + "local_account_id": "object1234", + "realm": "contoso", + "environment": "login.windows.net", + "home_account_id": "uid.utid", + "authority_type": "MSSTS" + } + }, + "RefreshToken": { + "uid.utid-login.windows.net-refreshtoken-my_client_id--s2 s1 s3": { + "target": "s2 s1 s3", + "environment": "login.windows.net", + "credential_type": "RefreshToken", + "secret": "a refresh token", + "client_id": "my_client_id", + "home_account_id": "uid.utid" + } + }, + "AccessToken": { + "an-entry": { + "foo": "bar" + }, + "uid.utid-login.windows.net-accesstoken-my_client_id-contoso-s2 s1 s3": { + "environment": "login.windows.net", + "credential_type": "AccessToken", + "secret": "an access token", + "realm": "contoso", + "target": "s2 s1 s3", + "client_id": "my_client_id", + "cached_at": "1000", + "home_account_id": "uid.utid", + "extended_expires_on": "4600", + "expires_on": "4600" + } + }, + "IdToken": { + "uid.utid-login.windows.net-idtoken-my_client_id-contoso-": { + "realm": "contoso", + "environment": "login.windows.net", + "credential_type": "IdToken", + "secret": "header.eyJvaWQiOiAib2JqZWN0MTIzNCIsICJwcmVmZXJyZWRfdXNlcm5hbWUiOiAiSm9obiBEb2UiLCAic3ViIjogInN1YiJ9.signature", + "client_id": "my_client_id", + "home_account_id": "uid.utid" + } + }, + "unknownEntity": {"field1":"1","field2":"whats"}, + "AppMetadata": { + "AppMetadata-login.windows.net-my_client_id": { + "environment": "login.windows.net", + "client_id": "my_client_id" + } + } + } \ No newline at end of file diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported/exported.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported/exported.go new file mode 100644 index 000000000..7b673e3fe --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported/exported.go @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// package exported contains internal types that are re-exported from a public package +package exported + +// AssertionRequestOptions has information required to generate a client assertion +type AssertionRequestOptions struct { + // ClientID identifies the application for which an assertion is requested. Used as the assertion's "iss" and "sub" claims. + ClientID string + + // TokenEndpoint is the intended token endpoint. Used as the assertion's "aud" claim. + TokenEndpoint string +} + +// TokenProviderParameters is the authentication parameters passed to token providers +type TokenProviderParameters struct { + // Claims contains any additional claims requested for the token + Claims string + // CorrelationID of the authentication request + CorrelationID string + // Scopes requested for the token + Scopes []string + // TenantID identifies the tenant in which to authenticate + TenantID string +} + +// TokenProviderResult is the authentication result returned by custom token providers +type TokenProviderResult struct { + // AccessToken is the requested token + AccessToken string + // ExpiresInSeconds is the lifetime of the token in seconds + ExpiresInSeconds int +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/design.md b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/design.md new file mode 100644 index 000000000..09edb01b7 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/design.md @@ -0,0 +1,140 @@ +# JSON Package Design +Author: John Doak(jdoak@microsoft.com) + +## Why? + +This project needs a special type of marshal/unmarshal not directly supported +by the encoding/json package. + +The need revolves around a few key wants/needs: +- unmarshal and marshal structs representing JSON messages +- fields in the messgage not in the struct must be maintained when unmarshalled +- those same fields must be marshalled back when encoded again + +The initial version used map[string]interface{} to put in the keys that +were known and then any other keys were put into a field called AdditionalFields. + +This has a few negatives: +- Dual marshaling/unmarshalling is required +- Adding a struct field requires manually adding a key by name to be encoded/decoded from the map (which is a loosely coupled construct), which can lead to bugs that aren't detected or have bad side effects +- Tests can become quickly disconnected if those keys aren't put +in tests as well. So you think you have support working, but you +don't. Existing tests were found that didn't test the marshalling output. +- There is no enforcement that if AdditionalFields is required on one struct, it should be on all containers +that don't have custom marshal/unmarshal. + +This package aims to support our needs by providing custom Marshal()/Unmarshal() functions. + +This prevents all the negatives in the initial solution listed above. However, it does add its own negative: +- Custom encoding/decoding via reflection is messy (as can be seen in encoding/json itself) + +Go proverb: Reflection is never clear +Suggested reading: https://blog.golang.org/laws-of-reflection + +## Important design decisions + +- We don't want to understand all JSON decoding rules +- We don't want to deal with all the quoting, commas, etc on decode +- Need support for json.Marshaler/Unmarshaler, so we can support types like time.Time +- If struct does not implement json.Unmarshaler, it must have AdditionalFields defined +- We only support root level objects that are \*struct or struct + +To faciliate these goals, we will utilize the json.Encoder and json.Decoder. +They provide streaming processing (efficient) and return errors on bad JSON. + +Support for json.Marshaler/Unmarshaler allows for us to use non-basic types +that must be specially encoded/decoded (like time.Time objects). + +We don't support types that can't customer unmarshal or have AdditionalFields +in order to prevent future devs from forgetting that important field and +generating bad return values. + +Support for root level objects of \*struct or struct simply acknowledges the +fact that this is designed only for the purposes listed in the Introduction. +Outside that (like encoding a lone number) should be done with the +regular json package (as it will not have additional fields). + +We don't support a few things on json supported reference types and structs: +- \*map: no need for pointers to maps +- \*slice: no need for pointers to slices +- any further pointers on struct after \*struct + +There should never be a need for this in Go. + +## Design + +## State Machines + +This uses state machine designs that based upon the Rob Pike talk on +lexers and parsers: https://www.youtube.com/watch?v=HxaD_trXwRE + +This is the most common pattern for state machines in Go and +the model to follow closesly when dealing with streaming +processing of textual data. + +Our state machines are based on the type: +```go +type stateFn func() (stateFn, error) +``` + +The state machine itself is simply a struct that has methods that +satisfy stateFn. + +Our state machines have a few standard calls +- run(): runs the state machine +- start(): always the first stateFn to be called + +All state machines have the following logic: +* run() is called +* start() is called and returns the next stateFn or error +* stateFn is called + - If returned stateFn(next state) is non-nil, call it + - If error is non-nil, run() returns the error + - If stateFn == nil and err == nil, run() return err == nil + +## Supporting types + +Marshalling/Unmarshalling must support(within top level struct): +- struct +- \*struct +- []struct +- []\*struct +- []map[string]structContainer +- [][]structContainer + +**Term note:** structContainer == type that has a struct or \*struct inside it + +We specifically do not support []interface or map[string]interface +where the interface value would hold some value with a struct in it. + +Those will still marshal/unmarshal, but without support for +AdditionalFields. + +## Marshalling + +The marshalling design will be based around a statemachine design. + +The basic logic is as follows: + +* If struct has custom marshaller, call it and return +* If struct has field "AdditionalFields", it must be a map[string]interface{} +* If struct does not have "AdditionalFields", give an error +* Get struct tag detailing json names to go names, create mapping +* For each public field name + - Write field name out + - If field value is a struct, recursively call our state machine + - Otherwise, use the json.Encoder to write out the value + +## Unmarshalling + +The unmarshalling desin is also based around a statemachine design. The +basic logic is as follows: + +* If struct has custom marhaller, call it +* If struct has field "AdditionalFields", it must be a map[string]interface{} +* Get struct tag detailing json names to go names, create mapping +* For each key found + - If key exists, + - If value is basic type, extract value into struct field using Decoder + - If value is struct type, recursively call statemachine + - If key doesn't exist, add it to AdditionalFields if it exists using Decoder diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/json.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/json.go new file mode 100644 index 000000000..2238521f5 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/json.go @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package json provide functions for marshalling an unmarshalling types to JSON. These functions are meant to +// be utilized inside of structs that implement json.Unmarshaler and json.Marshaler interfaces. +// This package provides the additional functionality of writing fields that are not in the struct when marshalling +// to a field called AdditionalFields if that field exists and is a map[string]interface{}. +// When marshalling, if the struct has all the same prerequisites, it will uses the keys in AdditionalFields as +// extra fields. This package uses encoding/json underneath. +package json + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strings" +) + +const addField = "AdditionalFields" +const ( + marshalJSON = "MarshalJSON" + unmarshalJSON = "UnmarshalJSON" +) + +var ( + leftBrace = []byte("{")[0] + rightBrace = []byte("}")[0] + comma = []byte(",")[0] + leftParen = []byte("[")[0] + rightParen = []byte("]")[0] +) + +var mapStrInterType = reflect.TypeOf(map[string]interface{}{}) + +// stateFn defines a state machine function. This will be used in all state +// machines in this package. +type stateFn func() (stateFn, error) + +// Marshal is used to marshal a type into its JSON representation. It +// wraps the stdlib calls in order to marshal a struct or *struct so +// that a field called "AdditionalFields" of type map[string]interface{} +// with "-" used inside struct tag `json:"-"` can be marshalled as if +// they were fields within the struct. +func Marshal(i interface{}) ([]byte, error) { + buff := bytes.Buffer{} + enc := json.NewEncoder(&buff) + enc.SetEscapeHTML(false) + enc.SetIndent("", "") + + v := reflect.ValueOf(i) + if v.Kind() != reflect.Ptr && v.CanAddr() { + v = v.Addr() + } + err := marshalStruct(v, &buff, enc) + if err != nil { + return nil, err + } + return buff.Bytes(), nil +} + +// Unmarshal unmarshals a []byte representing JSON into i, which must be a *struct. In addition, if the struct has +// a field called AdditionalFields of type map[string]interface{}, JSON data representing fields not in the struct +// will be written as key/value pairs to AdditionalFields. +func Unmarshal(b []byte, i interface{}) error { + if len(b) == 0 { + return nil + } + + jdec := json.NewDecoder(bytes.NewBuffer(b)) + jdec.UseNumber() + return unmarshalStruct(jdec, i) +} + +// MarshalRaw marshals i into a json.RawMessage. If I cannot be marshalled, +// this will panic. This is exposed to help test AdditionalField values +// which are stored as json.RawMessage. +func MarshalRaw(i interface{}) json.RawMessage { + b, err := json.Marshal(i) + if err != nil { + panic(err) + } + return json.RawMessage(b) +} + +// isDelim simply tests to see if a json.Token is a delimeter. +func isDelim(got json.Token) bool { + switch got.(type) { + case json.Delim: + return true + } + return false +} + +// delimIs tests got to see if it is want. +func delimIs(got json.Token, want rune) bool { + switch v := got.(type) { + case json.Delim: + if v == json.Delim(want) { + return true + } + } + return false +} + +// hasMarshalJSON will determine if the value or a pointer to this value has +// the MarshalJSON method. +func hasMarshalJSON(v reflect.Value) bool { + if method := v.MethodByName(marshalJSON); method.Kind() != reflect.Invalid { + _, ok := v.Interface().(json.Marshaler) + return ok + } + + if v.Kind() == reflect.Ptr { + v = v.Elem() + } else { + if !v.CanAddr() { + return false + } + v = v.Addr() + } + + if method := v.MethodByName(marshalJSON); method.Kind() != reflect.Invalid { + _, ok := v.Interface().(json.Marshaler) + return ok + } + return false +} + +// callMarshalJSON will call MarshalJSON() method on the value or a pointer to this value. +// This will panic if the method is not defined. +func callMarshalJSON(v reflect.Value) ([]byte, error) { + if method := v.MethodByName(marshalJSON); method.Kind() != reflect.Invalid { + marsh := v.Interface().(json.Marshaler) + return marsh.MarshalJSON() + } + + if v.Kind() == reflect.Ptr { + v = v.Elem() + } else { + if v.CanAddr() { + v = v.Addr() + } + } + + if method := v.MethodByName(unmarshalJSON); method.Kind() != reflect.Invalid { + marsh := v.Interface().(json.Marshaler) + return marsh.MarshalJSON() + } + + panic(fmt.Sprintf("callMarshalJSON called on type %T that does not have MarshalJSON defined", v.Interface())) +} + +// hasUnmarshalJSON will determine if the value or a pointer to this value has +// the UnmarshalJSON method. +func hasUnmarshalJSON(v reflect.Value) bool { + // You can't unmarshal on a non-pointer type. + if v.Kind() != reflect.Ptr { + if !v.CanAddr() { + return false + } + v = v.Addr() + } + + if method := v.MethodByName(unmarshalJSON); method.Kind() != reflect.Invalid { + _, ok := v.Interface().(json.Unmarshaler) + return ok + } + + return false +} + +// hasOmitEmpty indicates if the field has instructed us to not output +// the field if omitempty is set on the tag. tag is the string +// returned by reflect.StructField.Tag().Get(). +func hasOmitEmpty(tag string) bool { + sl := strings.Split(tag, ",") + for _, str := range sl { + if str == "omitempty" { + return true + } + } + return false +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/mapslice.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/mapslice.go new file mode 100644 index 000000000..cef442f25 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/mapslice.go @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package json + +import ( + "encoding/json" + "fmt" + "reflect" +) + +// unmarshalMap unmarshal's a map. +func unmarshalMap(dec *json.Decoder, m reflect.Value) error { + if m.Kind() != reflect.Ptr || m.Elem().Kind() != reflect.Map { + panic("unmarshalMap called on non-*map value") + } + mapValueType := m.Elem().Type().Elem() + walk := mapWalk{dec: dec, m: m, valueType: mapValueType} + if err := walk.run(); err != nil { + return err + } + return nil +} + +type mapWalk struct { + dec *json.Decoder + key string + m reflect.Value + valueType reflect.Type +} + +// run runs our decoder state machine. +func (m *mapWalk) run() error { + var state = m.start + var err error + for { + state, err = state() + if err != nil { + return err + } + if state == nil { + return nil + } + } +} + +func (m *mapWalk) start() (stateFn, error) { + // maps can have custom unmarshaler's. + if hasUnmarshalJSON(m.m) { + err := m.dec.Decode(m.m.Interface()) + if err != nil { + return nil, err + } + return nil, nil + } + + // We only want to use this if the map value is: + // *struct/struct/map/slice + // otherwise use standard decode + t, _ := m.valueBaseType() + switch t.Kind() { + case reflect.Struct, reflect.Map, reflect.Slice: + delim, err := m.dec.Token() + if err != nil { + return nil, err + } + // This indicates the value was set to JSON null. + if delim == nil { + return nil, nil + } + if !delimIs(delim, '{') { + return nil, fmt.Errorf("Unmarshal expected opening {, received %v", delim) + } + return m.next, nil + case reflect.Ptr: + return nil, fmt.Errorf("do not support maps with values of '**type' or '*reference") + } + + // This is a basic map type, so just use Decode(). + if err := m.dec.Decode(m.m.Interface()); err != nil { + return nil, err + } + + return nil, nil +} + +func (m *mapWalk) next() (stateFn, error) { + if m.dec.More() { + key, err := m.dec.Token() + if err != nil { + return nil, err + } + m.key = key.(string) + return m.storeValue, nil + } + // No more entries, so remove final }. + _, err := m.dec.Token() + if err != nil { + return nil, err + } + return nil, nil +} + +func (m *mapWalk) storeValue() (stateFn, error) { + v := m.valueType + for { + switch v.Kind() { + case reflect.Ptr: + v = v.Elem() + continue + case reflect.Struct: + return m.storeStruct, nil + case reflect.Map: + return m.storeMap, nil + case reflect.Slice: + return m.storeSlice, nil + } + return nil, fmt.Errorf("bug: mapWalk.storeValue() called on unsupported type: %v", v.Kind()) + } +} + +func (m *mapWalk) storeStruct() (stateFn, error) { + v := newValue(m.valueType) + if err := unmarshalStruct(m.dec, v.Interface()); err != nil { + return nil, err + } + + if m.valueType.Kind() == reflect.Ptr { + m.m.Elem().SetMapIndex(reflect.ValueOf(m.key), v) + return m.next, nil + } + m.m.Elem().SetMapIndex(reflect.ValueOf(m.key), v.Elem()) + + return m.next, nil +} + +func (m *mapWalk) storeMap() (stateFn, error) { + v := reflect.MakeMap(m.valueType) + ptr := newValue(v.Type()) + ptr.Elem().Set(v) + if err := unmarshalMap(m.dec, ptr); err != nil { + return nil, err + } + + m.m.Elem().SetMapIndex(reflect.ValueOf(m.key), v) + + return m.next, nil +} + +func (m *mapWalk) storeSlice() (stateFn, error) { + v := newValue(m.valueType) + if err := unmarshalSlice(m.dec, v); err != nil { + return nil, err + } + + m.m.Elem().SetMapIndex(reflect.ValueOf(m.key), v.Elem()) + + return m.next, nil +} + +// valueType returns the underlying Type. So a *struct would yield +// struct, etc... +func (m *mapWalk) valueBaseType() (reflect.Type, bool) { + ptr := false + v := m.valueType + if v.Kind() == reflect.Ptr { + ptr = true + v = v.Elem() + } + return v, ptr +} + +// unmarshalSlice unmarshal's the next value, which must be a slice, into +// ptrSlice, which must be a pointer to a slice. newValue() can be use to +// create the slice. +func unmarshalSlice(dec *json.Decoder, ptrSlice reflect.Value) error { + if ptrSlice.Kind() != reflect.Ptr || ptrSlice.Elem().Kind() != reflect.Slice { + panic("unmarshalSlice called on non-*[]slice value") + } + sliceValueType := ptrSlice.Elem().Type().Elem() + walk := sliceWalk{ + dec: dec, + s: ptrSlice, + valueType: sliceValueType, + } + if err := walk.run(); err != nil { + return err + } + + return nil +} + +type sliceWalk struct { + dec *json.Decoder + s reflect.Value // *[]slice + valueType reflect.Type +} + +// run runs our decoder state machine. +func (s *sliceWalk) run() error { + var state = s.start + var err error + for { + state, err = state() + if err != nil { + return err + } + if state == nil { + return nil + } + } +} + +func (s *sliceWalk) start() (stateFn, error) { + // slices can have custom unmarshaler's. + if hasUnmarshalJSON(s.s) { + err := s.dec.Decode(s.s.Interface()) + if err != nil { + return nil, err + } + return nil, nil + } + + // We only want to use this if the slice value is: + // []*struct/[]struct/[]map/[]slice + // otherwise use standard decode + t := s.valueBaseType() + + switch t.Kind() { + case reflect.Ptr: + return nil, fmt.Errorf("cannot unmarshal into a ** or *") + case reflect.Struct, reflect.Map, reflect.Slice: + delim, err := s.dec.Token() + if err != nil { + return nil, err + } + // This indicates the value was set to nil. + if delim == nil { + return nil, nil + } + if !delimIs(delim, '[') { + return nil, fmt.Errorf("Unmarshal expected opening [, received %v", delim) + } + return s.next, nil + } + + if err := s.dec.Decode(s.s.Interface()); err != nil { + return nil, err + } + return nil, nil +} + +func (s *sliceWalk) next() (stateFn, error) { + if s.dec.More() { + return s.storeValue, nil + } + // Nothing left in the slice, remove closing ] + _, err := s.dec.Token() + return nil, err +} + +func (s *sliceWalk) storeValue() (stateFn, error) { + t := s.valueBaseType() + switch t.Kind() { + case reflect.Ptr: + return nil, fmt.Errorf("do not support 'pointer to pointer' or 'pointer to reference' types") + case reflect.Struct: + return s.storeStruct, nil + case reflect.Map: + return s.storeMap, nil + case reflect.Slice: + return s.storeSlice, nil + } + return nil, fmt.Errorf("bug: sliceWalk.storeValue() called on unsupported type: %v", t.Kind()) +} + +func (s *sliceWalk) storeStruct() (stateFn, error) { + v := newValue(s.valueType) + if err := unmarshalStruct(s.dec, v.Interface()); err != nil { + return nil, err + } + + if s.valueType.Kind() == reflect.Ptr { + s.s.Elem().Set(reflect.Append(s.s.Elem(), v)) + return s.next, nil + } + + s.s.Elem().Set(reflect.Append(s.s.Elem(), v.Elem())) + return s.next, nil +} + +func (s *sliceWalk) storeMap() (stateFn, error) { + v := reflect.MakeMap(s.valueType) + ptr := newValue(v.Type()) + ptr.Elem().Set(v) + + if err := unmarshalMap(s.dec, ptr); err != nil { + return nil, err + } + + s.s.Elem().Set(reflect.Append(s.s.Elem(), v)) + + return s.next, nil +} + +func (s *sliceWalk) storeSlice() (stateFn, error) { + v := newValue(s.valueType) + if err := unmarshalSlice(s.dec, v); err != nil { + return nil, err + } + + s.s.Elem().Set(reflect.Append(s.s.Elem(), v.Elem())) + + return s.next, nil +} + +// valueType returns the underlying Type. So a *struct would yield +// struct, etc... +func (s *sliceWalk) valueBaseType() reflect.Type { + v := s.valueType + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + return v +} + +// newValue() returns a new *type that represents type passed. +func newValue(valueType reflect.Type) reflect.Value { + if valueType.Kind() == reflect.Ptr { + return reflect.New(valueType.Elem()) + } + return reflect.New(valueType) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/marshal.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/marshal.go new file mode 100644 index 000000000..df5dc6e11 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/marshal.go @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package json + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "unicode" +) + +// marshalStruct takes in i, which must be a *struct or struct and marshals its content +// as JSON into buff (sometimes with writes to buff directly, sometimes via enc). +// This call is recursive for all fields of *struct or struct type. +func marshalStruct(v reflect.Value, buff *bytes.Buffer, enc *json.Encoder) error { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + // We only care about custom Marshalling a struct. + if v.Kind() != reflect.Struct { + return fmt.Errorf("bug: marshal() received a non *struct or struct, received type %T", v.Interface()) + } + + if hasMarshalJSON(v) { + b, err := callMarshalJSON(v) + if err != nil { + return err + } + buff.Write(b) + return nil + } + + t := v.Type() + + // If it has an AdditionalFields field make sure its the right type. + f := v.FieldByName(addField) + if f.Kind() != reflect.Invalid { + if f.Kind() != reflect.Map { + return fmt.Errorf("type %T has field 'AdditionalFields' that is not a map[string]interface{}", v.Interface()) + } + if !f.Type().AssignableTo(mapStrInterType) { + return fmt.Errorf("type %T has field 'AdditionalFields' that is not a map[string]interface{}", v.Interface()) + } + } + + translator, err := findFields(v) + if err != nil { + return err + } + + buff.WriteByte(leftBrace) + for x := 0; x < v.NumField(); x++ { + field := v.Field(x) + + // We don't access private fields. + if unicode.IsLower(rune(t.Field(x).Name[0])) { + continue + } + + if t.Field(x).Name == addField { + if v.Field(x).Len() > 0 { + if err := writeAddFields(field.Interface(), buff, enc); err != nil { + return err + } + buff.WriteByte(comma) + } + continue + } + + // If they have omitempty set, we don't write out the field if + // it is the zero value. + if hasOmitEmpty(t.Field(x).Tag.Get("json")) { + if v.Field(x).IsZero() { + continue + } + } + + // Write out the field name part. + jsonName := translator.jsonName(t.Field(x).Name) + buff.WriteString(fmt.Sprintf("%q:", jsonName)) + + if field.Kind() == reflect.Ptr { + field = field.Elem() + } + + if err := marshalStructField(field, buff, enc); err != nil { + return err + } + } + + buff.Truncate(buff.Len() - 1) // Remove final comma + buff.WriteByte(rightBrace) + + return nil +} + +func marshalStructField(field reflect.Value, buff *bytes.Buffer, enc *json.Encoder) error { + // Determine if we need a trailing comma. + defer buff.WriteByte(comma) + + switch field.Kind() { + // If it was a *struct or struct, we need to recursively all marshal(). + case reflect.Struct: + if field.CanAddr() { + field = field.Addr() + } + return marshalStruct(field, buff, enc) + case reflect.Map: + return marshalMap(field, buff, enc) + case reflect.Slice: + return marshalSlice(field, buff, enc) + } + + // It is just a basic type, so encode it. + if err := enc.Encode(field.Interface()); err != nil { + return err + } + buff.Truncate(buff.Len() - 1) // Remove Encode() added \n + + return nil +} + +func marshalMap(v reflect.Value, buff *bytes.Buffer, enc *json.Encoder) error { + if v.Kind() != reflect.Map { + return fmt.Errorf("bug: marshalMap() called on %T", v.Interface()) + } + if v.Len() == 0 { + buff.WriteByte(leftBrace) + buff.WriteByte(rightBrace) + return nil + } + encoder := mapEncode{m: v, buff: buff, enc: enc} + return encoder.run() +} + +type mapEncode struct { + m reflect.Value + buff *bytes.Buffer + enc *json.Encoder + + valueBaseType reflect.Type +} + +// run runs our encoder state machine. +func (m *mapEncode) run() error { + var state = m.start + var err error + for { + state, err = state() + if err != nil { + return err + } + if state == nil { + return nil + } + } +} + +func (m *mapEncode) start() (stateFn, error) { + if hasMarshalJSON(m.m) { + b, err := callMarshalJSON(m.m) + if err != nil { + return nil, err + } + m.buff.Write(b) + return nil, nil + } + + valueBaseType := m.m.Type().Elem() + if valueBaseType.Kind() == reflect.Ptr { + valueBaseType = valueBaseType.Elem() + } + m.valueBaseType = valueBaseType + + switch valueBaseType.Kind() { + case reflect.Ptr: + return nil, fmt.Errorf("Marshal does not support ** or *") + case reflect.Struct, reflect.Map, reflect.Slice: + return m.encode, nil + } + + // If the map value doesn't have a struct/map/slice, just Encode() it. + if err := m.enc.Encode(m.m.Interface()); err != nil { + return nil, err + } + m.buff.Truncate(m.buff.Len() - 1) // Remove Encode() added \n + return nil, nil +} + +func (m *mapEncode) encode() (stateFn, error) { + m.buff.WriteByte(leftBrace) + + iter := m.m.MapRange() + for iter.Next() { + // Write the key. + k := iter.Key() + m.buff.WriteString(fmt.Sprintf("%q:", k.String())) + + v := iter.Value() + switch m.valueBaseType.Kind() { + case reflect.Struct: + if v.CanAddr() { + v = v.Addr() + } + if err := marshalStruct(v, m.buff, m.enc); err != nil { + return nil, err + } + case reflect.Map: + if err := marshalMap(v, m.buff, m.enc); err != nil { + return nil, err + } + case reflect.Slice: + if err := marshalSlice(v, m.buff, m.enc); err != nil { + return nil, err + } + default: + panic(fmt.Sprintf("critical bug: mapEncode.encode() called with value base type: %v", m.valueBaseType.Kind())) + } + m.buff.WriteByte(comma) + } + m.buff.Truncate(m.buff.Len() - 1) // Remove final comma + m.buff.WriteByte(rightBrace) + + return nil, nil +} + +func marshalSlice(v reflect.Value, buff *bytes.Buffer, enc *json.Encoder) error { + if v.Kind() != reflect.Slice { + return fmt.Errorf("bug: marshalSlice() called on %T", v.Interface()) + } + if v.Len() == 0 { + buff.WriteByte(leftParen) + buff.WriteByte(rightParen) + return nil + } + encoder := sliceEncode{s: v, buff: buff, enc: enc} + return encoder.run() +} + +type sliceEncode struct { + s reflect.Value + buff *bytes.Buffer + enc *json.Encoder + + valueBaseType reflect.Type +} + +// run runs our encoder state machine. +func (s *sliceEncode) run() error { + var state = s.start + var err error + for { + state, err = state() + if err != nil { + return err + } + if state == nil { + return nil + } + } +} + +func (s *sliceEncode) start() (stateFn, error) { + if hasMarshalJSON(s.s) { + b, err := callMarshalJSON(s.s) + if err != nil { + return nil, err + } + s.buff.Write(b) + return nil, nil + } + + valueBaseType := s.s.Type().Elem() + if valueBaseType.Kind() == reflect.Ptr { + valueBaseType = valueBaseType.Elem() + } + s.valueBaseType = valueBaseType + + switch valueBaseType.Kind() { + case reflect.Ptr: + return nil, fmt.Errorf("Marshal does not support ** or *") + case reflect.Struct, reflect.Map, reflect.Slice: + return s.encode, nil + } + + // If the map value doesn't have a struct/map/slice, just Encode() it. + if err := s.enc.Encode(s.s.Interface()); err != nil { + return nil, err + } + s.buff.Truncate(s.buff.Len() - 1) // Remove Encode added \n + + return nil, nil +} + +func (s *sliceEncode) encode() (stateFn, error) { + s.buff.WriteByte(leftParen) + for i := 0; i < s.s.Len(); i++ { + v := s.s.Index(i) + switch s.valueBaseType.Kind() { + case reflect.Struct: + if v.CanAddr() { + v = v.Addr() + } + if err := marshalStruct(v, s.buff, s.enc); err != nil { + return nil, err + } + case reflect.Map: + if err := marshalMap(v, s.buff, s.enc); err != nil { + return nil, err + } + case reflect.Slice: + if err := marshalSlice(v, s.buff, s.enc); err != nil { + return nil, err + } + default: + panic(fmt.Sprintf("critical bug: mapEncode.encode() called with value base type: %v", s.valueBaseType.Kind())) + } + s.buff.WriteByte(comma) + } + s.buff.Truncate(s.buff.Len() - 1) // Remove final comma + s.buff.WriteByte(rightParen) + return nil, nil +} + +// writeAddFields writes the AdditionalFields struct field out to JSON as field +// values. i must be a map[string]interface{} or this will panic. +func writeAddFields(i interface{}, buff *bytes.Buffer, enc *json.Encoder) error { + m := i.(map[string]interface{}) + + x := 0 + for k, v := range m { + buff.WriteString(fmt.Sprintf("%q:", k)) + if err := enc.Encode(v); err != nil { + return err + } + buff.Truncate(buff.Len() - 1) // Remove Encode() added \n + + if x+1 != len(m) { + buff.WriteByte(comma) + } + x++ + } + return nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/struct.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/struct.go new file mode 100644 index 000000000..07751544a --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/struct.go @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package json + +import ( + "encoding/json" + "fmt" + "reflect" + "strings" +) + +func unmarshalStruct(jdec *json.Decoder, i interface{}) error { + v := reflect.ValueOf(i) + if v.Kind() != reflect.Ptr { + return fmt.Errorf("Unmarshal() received type %T, which is not a *struct", i) + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return fmt.Errorf("Unmarshal() received type %T, which is not a *struct", i) + } + + if hasUnmarshalJSON(v) { + // Indicates that this type has a custom Unmarshaler. + return jdec.Decode(v.Addr().Interface()) + } + + f := v.FieldByName(addField) + if f.Kind() == reflect.Invalid { + return fmt.Errorf("Unmarshal(%T) only supports structs that have the field AdditionalFields or implements json.Unmarshaler", i) + } + + if f.Kind() != reflect.Map || !f.Type().AssignableTo(mapStrInterType) { + return fmt.Errorf("type %T has field 'AdditionalFields' that is not a map[string]interface{}", i) + } + + dec := newDecoder(jdec, v) + return dec.run() +} + +type decoder struct { + dec *json.Decoder + value reflect.Value // This will be a reflect.Struct + translator translateFields + key string +} + +func newDecoder(dec *json.Decoder, value reflect.Value) *decoder { + return &decoder{value: value, dec: dec} +} + +// run runs our decoder state machine. +func (d *decoder) run() error { + var state = d.start + var err error + for { + state, err = state() + if err != nil { + return err + } + if state == nil { + return nil + } + } +} + +// start looks for our opening delimeter '{' and then transitions to looping through our fields. +func (d *decoder) start() (stateFn, error) { + var err error + d.translator, err = findFields(d.value) + if err != nil { + return nil, err + } + + delim, err := d.dec.Token() + if err != nil { + return nil, err + } + if !delimIs(delim, '{') { + return nil, fmt.Errorf("Unmarshal expected opening {, received %v", delim) + } + + return d.next, nil +} + +// next gets the next struct field name from the raw json or stops the machine if we get our closing }. +func (d *decoder) next() (stateFn, error) { + if !d.dec.More() { + // Remove the closing }. + if _, err := d.dec.Token(); err != nil { + return nil, err + } + return nil, nil + } + + key, err := d.dec.Token() + if err != nil { + return nil, err + } + + d.key = key.(string) + return d.storeValue, nil +} + +// storeValue takes the next value and stores it our struct. If the field can't be found +// in the struct, it pushes the operation to storeAdditional(). +func (d *decoder) storeValue() (stateFn, error) { + goName := d.translator.goName(d.key) + if goName == "" { + goName = d.key + } + + // We don't have the field in the struct, so it goes in AdditionalFields. + f := d.value.FieldByName(goName) + if f.Kind() == reflect.Invalid { + return d.storeAdditional, nil + } + + // Indicates that this type has a custom Unmarshaler. + if hasUnmarshalJSON(f) { + err := d.dec.Decode(f.Addr().Interface()) + if err != nil { + return nil, err + } + return d.next, nil + } + + t, isPtr, err := fieldBaseType(d.value, goName) + if err != nil { + return nil, fmt.Errorf("type(%s) had field(%s) %w", d.value.Type().Name(), goName, err) + } + + switch t.Kind() { + // We need to recursively call ourselves on any *struct or struct. + case reflect.Struct: + if isPtr { + if f.IsNil() { + f.Set(reflect.New(t)) + } + } else { + f = f.Addr() + } + if err := unmarshalStruct(d.dec, f.Interface()); err != nil { + return nil, err + } + return d.next, nil + case reflect.Map: + v := reflect.MakeMap(f.Type()) + ptr := newValue(f.Type()) + ptr.Elem().Set(v) + if err := unmarshalMap(d.dec, ptr); err != nil { + return nil, err + } + f.Set(ptr.Elem()) + return d.next, nil + case reflect.Slice: + v := reflect.MakeSlice(f.Type(), 0, 0) + ptr := newValue(f.Type()) + ptr.Elem().Set(v) + if err := unmarshalSlice(d.dec, ptr); err != nil { + return nil, err + } + f.Set(ptr.Elem()) + return d.next, nil + } + + if !isPtr { + f = f.Addr() + } + + // For values that are pointers, we need them to be non-nil in order + // to decode into them. + if f.IsNil() { + f.Set(reflect.New(t)) + } + + if err := d.dec.Decode(f.Interface()); err != nil { + return nil, err + } + + return d.next, nil +} + +// storeAdditional pushes the key/value into our .AdditionalFields map. +func (d *decoder) storeAdditional() (stateFn, error) { + rw := json.RawMessage{} + if err := d.dec.Decode(&rw); err != nil { + return nil, err + } + field := d.value.FieldByName(addField) + if field.IsNil() { + field.Set(reflect.MakeMap(field.Type())) + } + field.SetMapIndex(reflect.ValueOf(d.key), reflect.ValueOf(rw)) + return d.next, nil +} + +func fieldBaseType(v reflect.Value, fieldName string) (t reflect.Type, isPtr bool, err error) { + sf, ok := v.Type().FieldByName(fieldName) + if !ok { + return nil, false, fmt.Errorf("bug: fieldBaseType() lookup of field(%s) on type(%s): do not have field", fieldName, v.Type().Name()) + } + t = sf.Type + if t.Kind() == reflect.Ptr { + t = t.Elem() + isPtr = true + } + if t.Kind() == reflect.Ptr { + return nil, isPtr, fmt.Errorf("received pointer to pointer type, not supported") + } + return t, isPtr, nil +} + +type translateField struct { + jsonName string + goName string +} + +// translateFields is a list of translateFields with a handy lookup method. +type translateFields []translateField + +// goName loops through a list of fields looking for one contaning the jsonName and +// returning the goName. If not found, returns the empty string. +// Note: not a map because at this size slices are faster even in tight loops. +func (t translateFields) goName(jsonName string) string { + for _, entry := range t { + if entry.jsonName == jsonName { + return entry.goName + } + } + return "" +} + +// jsonName loops through a list of fields looking for one contaning the goName and +// returning the jsonName. If not found, returns the empty string. +// Note: not a map because at this size slices are faster even in tight loops. +func (t translateFields) jsonName(goName string) string { + for _, entry := range t { + if entry.goName == goName { + return entry.jsonName + } + } + return "" +} + +var umarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() + +// findFields parses a struct and writes the field tags for lookup. It will return an error +// if any field has a type of *struct or struct that does not implement json.Marshaler. +func findFields(v reflect.Value) (translateFields, error) { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + return nil, fmt.Errorf("findFields received a %s type, expected *struct or struct", v.Type().Name()) + } + tfs := make([]translateField, 0, v.NumField()) + for i := 0; i < v.NumField(); i++ { + tf := translateField{ + goName: v.Type().Field(i).Name, + jsonName: parseTag(v.Type().Field(i).Tag.Get("json")), + } + switch tf.jsonName { + case "", "-": + tf.jsonName = tf.goName + } + tfs = append(tfs, tf) + + f := v.Field(i) + if f.Kind() == reflect.Ptr { + f = f.Elem() + } + if f.Kind() == reflect.Struct { + if f.Type().Implements(umarshalerType) { + return nil, fmt.Errorf("struct type %q which has field %q which "+ + "doesn't implement json.Unmarshaler", v.Type().Name(), v.Type().Field(i).Name) + } + } + } + return tfs, nil +} + +// parseTag just returns the first entry in the tag. tag is the string +// returned by reflect.StructField.Tag().Get(). +func parseTag(tag string) string { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx] + } + return tag +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time/time.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time/time.go new file mode 100644 index 000000000..a1c99621e --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time/time.go @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package time provides for custom types to translate time from JSON and other formats +// into time.Time objects. +package time + +import ( + "fmt" + "strconv" + "strings" + "time" +) + +// Unix provides a type that can marshal and unmarshal a string representation +// of the unix epoch into a time.Time object. +type Unix struct { + T time.Time +} + +// MarshalJSON implements encoding/json.MarshalJSON(). +func (u Unix) MarshalJSON() ([]byte, error) { + if u.T.IsZero() { + return []byte(""), nil + } + return []byte(fmt.Sprintf("%q", strconv.FormatInt(u.T.Unix(), 10))), nil +} + +// UnmarshalJSON implements encoding/json.UnmarshalJSON(). +func (u *Unix) UnmarshalJSON(b []byte) error { + i, err := strconv.Atoi(strings.Trim(string(b), `"`)) + if err != nil { + return fmt.Errorf("unix time(%s) could not be converted from string to int: %w", string(b), err) + } + u.T = time.Unix(int64(i), 0) + return nil +} + +// DurationTime provides a type that can marshal and unmarshal a string representation +// of a duration from now into a time.Time object. +// Note: I'm not sure this is the best way to do this. What happens is we get a field +// called "expires_in" that represents the seconds from now that this expires. We +// turn that into a time we call .ExpiresOn. But maybe we should be recording +// when the token was received at .TokenRecieved and .ExpiresIn should remain as a duration. +// Then we could have a method called ExpiresOn(). Honestly, the whole thing is +// bad because the server doesn't return a concrete time. I think this is +// cleaner, but its not great either. +type DurationTime struct { + T time.Time +} + +// MarshalJSON implements encoding/json.MarshalJSON(). +func (d DurationTime) MarshalJSON() ([]byte, error) { + if d.T.IsZero() { + return []byte(""), nil + } + + dt := time.Until(d.T) + return []byte(fmt.Sprintf("%d", int64(dt*time.Second))), nil +} + +// UnmarshalJSON implements encoding/json.UnmarshalJSON(). +func (d *DurationTime) UnmarshalJSON(b []byte) error { + i, err := strconv.Atoi(strings.Trim(string(b), `"`)) + if err != nil { + return fmt.Errorf("unix time(%s) could not be converted from string to int: %w", string(b), err) + } + d.T = time.Now().Add(time.Duration(i) * time.Second) + return nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go new file mode 100644 index 000000000..04236ff31 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package local contains a local HTTP server used with interactive authentication. +package local + +import ( + "context" + "fmt" + "net" + "net/http" + "strconv" + "strings" + "time" +) + +var okPage = []byte(` + + + + + Authentication Complete + + +

    Authentication complete. You can return to the application. Feel free to close this browser tab.

    + + +`) + +const failPage = ` + + + + + Authentication Failed + + +

    Authentication failed. You can return to the application. Feel free to close this browser tab.

    +

    Error details: error %s error_description: %s

    + + +` + +// Result is the result from the redirect. +type Result struct { + // Code is the code sent by the authority server. + Code string + // Err is set if there was an error. + Err error +} + +// Server is an HTTP server. +type Server struct { + // Addr is the address the server is listening on. + Addr string + resultCh chan Result + s *http.Server + reqState string +} + +// New creates a local HTTP server and starts it. +func New(reqState string, port int) (*Server, error) { + var l net.Listener + var err error + var portStr string + if port > 0 { + // use port provided by caller + l, err = net.Listen("tcp", fmt.Sprintf("localhost:%d", port)) + portStr = strconv.FormatInt(int64(port), 10) + } else { + // find a free port + for i := 0; i < 10; i++ { + l, err = net.Listen("tcp", "localhost:0") + if err != nil { + continue + } + addr := l.Addr().String() + portStr = addr[strings.LastIndex(addr, ":")+1:] + break + } + } + if err != nil { + return nil, err + } + + serv := &Server{ + Addr: fmt.Sprintf("http://localhost:%s", portStr), + s: &http.Server{Addr: "localhost:0", ReadHeaderTimeout: time.Second}, + reqState: reqState, + resultCh: make(chan Result, 1), + } + serv.s.Handler = http.HandlerFunc(serv.handler) + + if err := serv.start(l); err != nil { + return nil, err + } + + return serv, nil +} + +func (s *Server) start(l net.Listener) error { + go func() { + err := s.s.Serve(l) + if err != nil { + select { + case s.resultCh <- Result{Err: err}: + default: + } + } + }() + + return nil +} + +// Result gets the result of the redirect operation. Once a single result is returned, the server +// is shutdown. ctx deadline will be honored. +func (s *Server) Result(ctx context.Context) Result { + select { + case <-ctx.Done(): + return Result{Err: ctx.Err()} + case r := <-s.resultCh: + return r + } +} + +// Shutdown shuts down the server. +func (s *Server) Shutdown() { + // Note: You might get clever and think you can do this in handler() as a defer, you can't. + _ = s.s.Shutdown(context.Background()) +} + +func (s *Server) putResult(r Result) { + select { + case s.resultCh <- r: + default: + } +} + +func (s *Server) handler(w http.ResponseWriter, r *http.Request) { + q := r.URL.Query() + + headerErr := q.Get("error") + if headerErr != "" { + desc := q.Get("error_description") + // Note: It is a little weird we handle some errors by not going to the failPage. If they all should, + // change this to s.error() and make s.error() write the failPage instead of an error code. + _, _ = w.Write([]byte(fmt.Sprintf(failPage, headerErr, desc))) + s.putResult(Result{Err: fmt.Errorf(desc)}) + return + } + + respState := q.Get("state") + switch respState { + case s.reqState: + case "": + s.error(w, http.StatusInternalServerError, "server didn't send OAuth state") + return + default: + s.error(w, http.StatusInternalServerError, "mismatched OAuth state, req(%s), resp(%s)", s.reqState, respState) + return + } + + code := q.Get("code") + if code == "" { + s.error(w, http.StatusInternalServerError, "authorization code missing in query string") + return + } + + _, _ = w.Write(okPage) + s.putResult(Result{Code: code}) +} + +func (s *Server) error(w http.ResponseWriter, code int, str string, i ...interface{}) { + err := fmt.Errorf(str, i...) + http.Error(w, err.Error(), code) + s.putResult(Result{Err: err}) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/oauth.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/oauth.go new file mode 100644 index 000000000..6b4016c11 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/oauth.go @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package oauth + +import ( + "context" + "encoding/json" + "fmt" + "io" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported" + internalTime "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs" + "github.com/google/uuid" +) + +// ResolveEndpointer contains the methods for resolving authority endpoints. +type ResolveEndpointer interface { + ResolveEndpoints(ctx context.Context, authorityInfo authority.Info, userPrincipalName string) (authority.Endpoints, error) +} + +// AccessTokens contains the methods for fetching tokens from different sources. +type AccessTokens interface { + DeviceCodeResult(ctx context.Context, authParameters authority.AuthParams) (accesstokens.DeviceCodeResult, error) + FromUsernamePassword(ctx context.Context, authParameters authority.AuthParams) (accesstokens.TokenResponse, error) + FromAuthCode(ctx context.Context, req accesstokens.AuthCodeRequest) (accesstokens.TokenResponse, error) + FromRefreshToken(ctx context.Context, appType accesstokens.AppType, authParams authority.AuthParams, cc *accesstokens.Credential, refreshToken string) (accesstokens.TokenResponse, error) + FromClientSecret(ctx context.Context, authParameters authority.AuthParams, clientSecret string) (accesstokens.TokenResponse, error) + FromAssertion(ctx context.Context, authParameters authority.AuthParams, assertion string) (accesstokens.TokenResponse, error) + FromUserAssertionClientSecret(ctx context.Context, authParameters authority.AuthParams, userAssertion string, clientSecret string) (accesstokens.TokenResponse, error) + FromUserAssertionClientCertificate(ctx context.Context, authParameters authority.AuthParams, userAssertion string, assertion string) (accesstokens.TokenResponse, error) + FromDeviceCodeResult(ctx context.Context, authParameters authority.AuthParams, deviceCodeResult accesstokens.DeviceCodeResult) (accesstokens.TokenResponse, error) + FromSamlGrant(ctx context.Context, authParameters authority.AuthParams, samlGrant wstrust.SamlTokenInfo) (accesstokens.TokenResponse, error) +} + +// FetchAuthority will be implemented by authority.Authority. +type FetchAuthority interface { + UserRealm(context.Context, authority.AuthParams) (authority.UserRealm, error) + AADInstanceDiscovery(context.Context, authority.Info) (authority.InstanceDiscoveryResponse, error) +} + +// FetchWSTrust contains the methods for interacting with WSTrust endpoints. +type FetchWSTrust interface { + Mex(ctx context.Context, federationMetadataURL string) (defs.MexDocument, error) + SAMLTokenInfo(ctx context.Context, authParameters authority.AuthParams, cloudAudienceURN string, endpoint defs.Endpoint) (wstrust.SamlTokenInfo, error) +} + +// Client provides tokens for various types of token requests. +type Client struct { + Resolver ResolveEndpointer + AccessTokens AccessTokens + Authority FetchAuthority + WSTrust FetchWSTrust +} + +// New is the constructor for Token. +func New(httpClient ops.HTTPClient) *Client { + r := ops.New(httpClient) + return &Client{ + Resolver: newAuthorityEndpoint(r), + AccessTokens: r.AccessTokens(), + Authority: r.Authority(), + WSTrust: r.WSTrust(), + } +} + +// ResolveEndpoints gets the authorization and token endpoints and creates an AuthorityEndpoints instance. +func (t *Client) ResolveEndpoints(ctx context.Context, authorityInfo authority.Info, userPrincipalName string) (authority.Endpoints, error) { + return t.Resolver.ResolveEndpoints(ctx, authorityInfo, userPrincipalName) +} + +func (t *Client) AADInstanceDiscovery(ctx context.Context, authorityInfo authority.Info) (authority.InstanceDiscoveryResponse, error) { + return t.Authority.AADInstanceDiscovery(ctx, authorityInfo) +} + +// AuthCode returns a token based on an authorization code. +func (t *Client) AuthCode(ctx context.Context, req accesstokens.AuthCodeRequest) (accesstokens.TokenResponse, error) { + if err := t.resolveEndpoint(ctx, &req.AuthParams, ""); err != nil { + return accesstokens.TokenResponse{}, err + } + + tResp, err := t.AccessTokens.FromAuthCode(ctx, req) + if err != nil { + return accesstokens.TokenResponse{}, fmt.Errorf("could not retrieve token from auth code: %w", err) + } + return tResp, nil +} + +// Credential acquires a token from the authority using a client credentials grant. +func (t *Client) Credential(ctx context.Context, authParams authority.AuthParams, cred *accesstokens.Credential) (accesstokens.TokenResponse, error) { + if cred.TokenProvider != nil { + now := time.Now() + scopes := make([]string, len(authParams.Scopes)) + copy(scopes, authParams.Scopes) + params := exported.TokenProviderParameters{ + CorrelationID: uuid.New().String(), + Scopes: scopes, + } + tr, err := cred.TokenProvider(ctx, params) + if err != nil { + return accesstokens.TokenResponse{}, err + } + return accesstokens.TokenResponse{ + AccessToken: tr.AccessToken, + ExpiresOn: internalTime.DurationTime{ + T: now.Add(time.Duration(tr.ExpiresInSeconds) * time.Second), + }, + GrantedScopes: accesstokens.Scopes{Slice: authParams.Scopes}, + }, nil + } + + if err := t.resolveEndpoint(ctx, &authParams, ""); err != nil { + return accesstokens.TokenResponse{}, err + } + + if cred.Secret != "" { + return t.AccessTokens.FromClientSecret(ctx, authParams, cred.Secret) + } + jwt, err := cred.JWT(ctx, authParams) + if err != nil { + return accesstokens.TokenResponse{}, err + } + return t.AccessTokens.FromAssertion(ctx, authParams, jwt) +} + +// Credential acquires a token from the authority using a client credentials grant. +func (t *Client) OnBehalfOf(ctx context.Context, authParams authority.AuthParams, cred *accesstokens.Credential) (accesstokens.TokenResponse, error) { + if err := t.resolveEndpoint(ctx, &authParams, ""); err != nil { + return accesstokens.TokenResponse{}, err + } + + if cred.Secret != "" { + return t.AccessTokens.FromUserAssertionClientSecret(ctx, authParams, authParams.UserAssertion, cred.Secret) + + } + jwt, err := cred.JWT(ctx, authParams) + if err != nil { + return accesstokens.TokenResponse{}, err + } + return t.AccessTokens.FromUserAssertionClientCertificate(ctx, authParams, authParams.UserAssertion, jwt) +} + +func (t *Client) Refresh(ctx context.Context, reqType accesstokens.AppType, authParams authority.AuthParams, cc *accesstokens.Credential, refreshToken accesstokens.RefreshToken) (accesstokens.TokenResponse, error) { + if err := t.resolveEndpoint(ctx, &authParams, ""); err != nil { + return accesstokens.TokenResponse{}, err + } + + return t.AccessTokens.FromRefreshToken(ctx, reqType, authParams, cc, refreshToken.Secret) +} + +// UsernamePassword retrieves a token where a username and password is used. However, if this is +// a user realm of "Federated", this uses SAML tokens. If "Managed", uses normal username/password. +func (t *Client) UsernamePassword(ctx context.Context, authParams authority.AuthParams) (accesstokens.TokenResponse, error) { + if authParams.AuthorityInfo.AuthorityType == authority.ADFS { + if err := t.resolveEndpoint(ctx, &authParams, authParams.Username); err != nil { + return accesstokens.TokenResponse{}, err + } + return t.AccessTokens.FromUsernamePassword(ctx, authParams) + } + if err := t.resolveEndpoint(ctx, &authParams, ""); err != nil { + return accesstokens.TokenResponse{}, err + } + + userRealm, err := t.Authority.UserRealm(ctx, authParams) + if err != nil { + return accesstokens.TokenResponse{}, fmt.Errorf("problem getting user realm(user: %s) from authority: %w", authParams.Username, err) + } + + switch userRealm.AccountType { + case authority.Federated: + mexDoc, err := t.WSTrust.Mex(ctx, userRealm.FederationMetadataURL) + if err != nil { + return accesstokens.TokenResponse{}, fmt.Errorf("problem getting mex doc from federated url(%s): %w", userRealm.FederationMetadataURL, err) + } + + saml, err := t.WSTrust.SAMLTokenInfo(ctx, authParams, userRealm.CloudAudienceURN, mexDoc.UsernamePasswordEndpoint) + if err != nil { + return accesstokens.TokenResponse{}, fmt.Errorf("problem getting SAML token info: %w", err) + } + return t.AccessTokens.FromSamlGrant(ctx, authParams, saml) + case authority.Managed: + return t.AccessTokens.FromUsernamePassword(ctx, authParams) + } + return accesstokens.TokenResponse{}, errors.New("unknown account type") +} + +// DeviceCode is the result of a call to Token.DeviceCode(). +type DeviceCode struct { + // Result is the device code result from the first call in the device code flow. This allows + // the caller to retrieve the displayed code that is used to authorize on the second device. + Result accesstokens.DeviceCodeResult + authParams authority.AuthParams + + accessTokens AccessTokens +} + +// Token returns a token AFTER the user uses the user code on the second device. This will block +// until either: (1) the code is input by the user and the service releases a token, (2) the token +// expires, (3) the Context passed to .DeviceCode() is cancelled or expires, (4) some other service +// error occurs. +func (d DeviceCode) Token(ctx context.Context) (accesstokens.TokenResponse, error) { + if d.accessTokens == nil { + return accesstokens.TokenResponse{}, fmt.Errorf("DeviceCode was either created outside its package or the creating method had an error. DeviceCode is not valid") + } + + var cancel context.CancelFunc + d.Result.ExpiresOn.Sub(time.Now().UTC()) + if deadline, ok := ctx.Deadline(); !ok || d.Result.ExpiresOn.Before(deadline) { + ctx, cancel = context.WithDeadline(ctx, d.Result.ExpiresOn) + } else { + ctx, cancel = context.WithCancel(ctx) + } + defer cancel() + + var interval = 50 * time.Millisecond + timer := time.NewTimer(interval) + defer timer.Stop() + + for { + timer.Reset(interval) + select { + case <-ctx.Done(): + return accesstokens.TokenResponse{}, ctx.Err() + case <-timer.C: + interval += interval * 2 + if interval > 5*time.Second { + interval = 5 * time.Second + } + } + + token, err := d.accessTokens.FromDeviceCodeResult(ctx, d.authParams, d.Result) + if err != nil && isWaitDeviceCodeErr(err) { + continue + } + return token, err // This handles if it was a non-wait error or success + } +} + +type deviceCodeError struct { + Error string `json:"error"` +} + +func isWaitDeviceCodeErr(err error) bool { + var c errors.CallErr + if !errors.As(err, &c) { + return false + } + if c.Resp.StatusCode != 400 { + return false + } + var dCErr deviceCodeError + defer c.Resp.Body.Close() + body, err := io.ReadAll(c.Resp.Body) + if err != nil { + return false + } + err = json.Unmarshal(body, &dCErr) + if err != nil { + return false + } + if dCErr.Error == "authorization_pending" || dCErr.Error == "slow_down" { + return true + } + return false +} + +// DeviceCode returns a DeviceCode object that can be used to get the code that must be entered on the second +// device and optionally the token once the code has been entered on the second device. +func (t *Client) DeviceCode(ctx context.Context, authParams authority.AuthParams) (DeviceCode, error) { + if err := t.resolveEndpoint(ctx, &authParams, ""); err != nil { + return DeviceCode{}, err + } + + dcr, err := t.AccessTokens.DeviceCodeResult(ctx, authParams) + if err != nil { + return DeviceCode{}, err + } + + return DeviceCode{Result: dcr, authParams: authParams, accessTokens: t.AccessTokens}, nil +} + +func (t *Client) resolveEndpoint(ctx context.Context, authParams *authority.AuthParams, userPrincipalName string) error { + endpoints, err := t.Resolver.ResolveEndpoints(ctx, authParams.AuthorityInfo, userPrincipalName) + if err != nil { + return fmt.Errorf("unable to resolve an endpoint: %s", err) + } + authParams.Endpoints = endpoints + return nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/accesstokens.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/accesstokens.go new file mode 100644 index 000000000..eaeb2ef5f --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/accesstokens.go @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package accesstokens exposes a REST client for querying backend systems to get various types of +access tokens (oauth) for use in authentication. + +These calls are of type "application/x-www-form-urlencoded". This means we use url.Values to +represent arguments and then encode them into the POST body message. We receive JSON in +return for the requests. The request definition is defined in https://tools.ietf.org/html/rfc7521#section-4.2 . +*/ +package accesstokens + +import ( + "context" + "crypto" + + /* #nosec */ + "crypto/sha1" + "crypto/x509" + "encoding/base64" + "encoding/json" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust" + "github.com/golang-jwt/jwt/v4" + "github.com/google/uuid" +) + +const ( + grantType = "grant_type" + deviceCode = "device_code" + clientID = "client_id" + clientInfo = "client_info" + clientInfoVal = "1" + username = "username" + password = "password" +) + +//go:generate stringer -type=AppType + +// AppType is whether the authorization code flow is for a public or confidential client. +type AppType int8 + +const ( + // ATUnknown is the zero value when the type hasn't been set. + ATUnknown AppType = iota + // ATPublic indicates this if for the Public.Client. + ATPublic + // ATConfidential indicates this if for the Confidential.Client. + ATConfidential +) + +type urlFormCaller interface { + URLFormCall(ctx context.Context, endpoint string, qv url.Values, resp interface{}) error +} + +// DeviceCodeResponse represents the HTTP response received from the device code endpoint +type DeviceCodeResponse struct { + authority.OAuthResponseBase + + UserCode string `json:"user_code"` + DeviceCode string `json:"device_code"` + VerificationURL string `json:"verification_url"` + ExpiresIn int `json:"expires_in"` + Interval int `json:"interval"` + Message string `json:"message"` + + AdditionalFields map[string]interface{} +} + +// Convert converts the DeviceCodeResponse to a DeviceCodeResult +func (dcr DeviceCodeResponse) Convert(clientID string, scopes []string) DeviceCodeResult { + expiresOn := time.Now().UTC().Add(time.Duration(dcr.ExpiresIn) * time.Second) + return NewDeviceCodeResult(dcr.UserCode, dcr.DeviceCode, dcr.VerificationURL, expiresOn, dcr.Interval, dcr.Message, clientID, scopes) +} + +// Credential represents the credential used in confidential client flows. This can be either +// a Secret or Cert/Key. +type Credential struct { + // Secret contains the credential secret if we are doing auth by secret. + Secret string + + // Cert is the public certificate, if we're authenticating by certificate. + Cert *x509.Certificate + // Key is the private key for signing, if we're authenticating by certificate. + Key crypto.PrivateKey + // X5c is the JWT assertion's x5c header value, required for SN/I authentication. + X5c []string + + // AssertionCallback is a function provided by the application, if we're authenticating by assertion. + AssertionCallback func(context.Context, exported.AssertionRequestOptions) (string, error) + + // TokenProvider is a function provided by the application that implements custom authentication + // logic for a confidential client + TokenProvider func(context.Context, exported.TokenProviderParameters) (exported.TokenProviderResult, error) +} + +// JWT gets the jwt assertion when the credential is not using a secret. +func (c *Credential) JWT(ctx context.Context, authParams authority.AuthParams) (string, error) { + if c.AssertionCallback != nil { + options := exported.AssertionRequestOptions{ + ClientID: authParams.ClientID, + TokenEndpoint: authParams.Endpoints.TokenEndpoint, + } + return c.AssertionCallback(ctx, options) + } + + token := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{ + "aud": authParams.Endpoints.TokenEndpoint, + "exp": json.Number(strconv.FormatInt(time.Now().Add(10*time.Minute).Unix(), 10)), + "iss": authParams.ClientID, + "jti": uuid.New().String(), + "nbf": json.Number(strconv.FormatInt(time.Now().Unix(), 10)), + "sub": authParams.ClientID, + }) + token.Header = map[string]interface{}{ + "alg": "RS256", + "typ": "JWT", + "x5t": base64.StdEncoding.EncodeToString(thumbprint(c.Cert)), + } + + if authParams.SendX5C { + token.Header["x5c"] = c.X5c + } + + assertion, err := token.SignedString(c.Key) + if err != nil { + return "", fmt.Errorf("unable to sign a JWT token using private key: %w", err) + } + return assertion, nil +} + +// thumbprint runs the asn1.Der bytes through sha1 for use in the x5t parameter of JWT. +// https://tools.ietf.org/html/rfc7517#section-4.8 +func thumbprint(cert *x509.Certificate) []byte { + /* #nosec */ + a := sha1.Sum(cert.Raw) + return a[:] +} + +// Client represents the REST calls to get tokens from token generator backends. +type Client struct { + // Comm provides the HTTP transport client. + Comm urlFormCaller + + testing bool +} + +// FromUsernamePassword uses a username and password to get an access token. +func (c Client) FromUsernamePassword(ctx context.Context, authParameters authority.AuthParams) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.Password) + qv.Set(username, authParameters.Username) + qv.Set(password, authParameters.Password) + qv.Set(clientID, authParameters.ClientID) + qv.Set(clientInfo, clientInfoVal) + addScopeQueryParam(qv, authParameters) + + return c.doTokenResp(ctx, authParameters, qv) +} + +// AuthCodeRequest stores the values required to request a token from the authority using an authorization code +type AuthCodeRequest struct { + AuthParams authority.AuthParams + Code string + CodeChallenge string + Credential *Credential + AppType AppType +} + +// NewCodeChallengeRequest returns an AuthCodeRequest that uses a code challenge.. +func NewCodeChallengeRequest(params authority.AuthParams, appType AppType, cc *Credential, code, challenge string) (AuthCodeRequest, error) { + if appType == ATUnknown { + return AuthCodeRequest{}, fmt.Errorf("bug: NewCodeChallengeRequest() called with AppType == ATUnknown") + } + return AuthCodeRequest{ + AuthParams: params, + AppType: appType, + Code: code, + CodeChallenge: challenge, + Credential: cc, + }, nil +} + +// FromAuthCode uses an authorization code to retrieve an access token. +func (c Client) FromAuthCode(ctx context.Context, req AuthCodeRequest) (TokenResponse, error) { + var qv url.Values + + switch req.AppType { + case ATUnknown: + return TokenResponse{}, fmt.Errorf("bug: Token.AuthCode() received request with AppType == ATUnknown") + case ATConfidential: + var err error + if req.Credential == nil { + return TokenResponse{}, fmt.Errorf("AuthCodeRequest had nil Credential for Confidential app") + } + qv, err = prepURLVals(ctx, req.Credential, req.AuthParams) + if err != nil { + return TokenResponse{}, err + } + case ATPublic: + qv = url.Values{} + default: + return TokenResponse{}, fmt.Errorf("bug: Token.AuthCode() received request with AppType == %v, which we do not recongnize", req.AppType) + } + + qv.Set(grantType, grant.AuthCode) + qv.Set("code", req.Code) + qv.Set("code_verifier", req.CodeChallenge) + qv.Set("redirect_uri", req.AuthParams.Redirecturi) + qv.Set(clientID, req.AuthParams.ClientID) + qv.Set(clientInfo, clientInfoVal) + addScopeQueryParam(qv, req.AuthParams) + + return c.doTokenResp(ctx, req.AuthParams, qv) +} + +// FromRefreshToken uses a refresh token (for refreshing credentials) to get a new access token. +func (c Client) FromRefreshToken(ctx context.Context, appType AppType, authParams authority.AuthParams, cc *Credential, refreshToken string) (TokenResponse, error) { + qv := url.Values{} + if appType == ATConfidential { + var err error + qv, err = prepURLVals(ctx, cc, authParams) + if err != nil { + return TokenResponse{}, err + } + } + qv.Set(grantType, grant.RefreshToken) + qv.Set(clientID, authParams.ClientID) + qv.Set(clientInfo, clientInfoVal) + qv.Set("refresh_token", refreshToken) + addScopeQueryParam(qv, authParams) + + return c.doTokenResp(ctx, authParams, qv) +} + +// FromClientSecret uses a client's secret (aka password) to get a new token. +func (c Client) FromClientSecret(ctx context.Context, authParameters authority.AuthParams, clientSecret string) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.ClientCredential) + qv.Set("client_secret", clientSecret) + qv.Set(clientID, authParameters.ClientID) + addScopeQueryParam(qv, authParameters) + + token, err := c.doTokenResp(ctx, authParameters, qv) + if err != nil { + return token, fmt.Errorf("FromClientSecret(): %w", err) + } + return token, nil +} + +func (c Client) FromAssertion(ctx context.Context, authParameters authority.AuthParams, assertion string) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.ClientCredential) + qv.Set("client_assertion_type", grant.ClientAssertion) + qv.Set("client_assertion", assertion) + qv.Set(clientID, authParameters.ClientID) + qv.Set(clientInfo, clientInfoVal) + addScopeQueryParam(qv, authParameters) + + token, err := c.doTokenResp(ctx, authParameters, qv) + if err != nil { + return token, fmt.Errorf("FromAssertion(): %w", err) + } + return token, nil +} + +func (c Client) FromUserAssertionClientSecret(ctx context.Context, authParameters authority.AuthParams, userAssertion string, clientSecret string) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.JWT) + qv.Set(clientID, authParameters.ClientID) + qv.Set("client_secret", clientSecret) + qv.Set("assertion", userAssertion) + qv.Set(clientInfo, clientInfoVal) + qv.Set("requested_token_use", "on_behalf_of") + addScopeQueryParam(qv, authParameters) + + return c.doTokenResp(ctx, authParameters, qv) +} + +func (c Client) FromUserAssertionClientCertificate(ctx context.Context, authParameters authority.AuthParams, userAssertion string, assertion string) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.JWT) + qv.Set("client_assertion_type", grant.ClientAssertion) + qv.Set("client_assertion", assertion) + qv.Set(clientID, authParameters.ClientID) + qv.Set("assertion", userAssertion) + qv.Set(clientInfo, clientInfoVal) + qv.Set("requested_token_use", "on_behalf_of") + addScopeQueryParam(qv, authParameters) + + return c.doTokenResp(ctx, authParameters, qv) +} + +func (c Client) DeviceCodeResult(ctx context.Context, authParameters authority.AuthParams) (DeviceCodeResult, error) { + qv := url.Values{} + qv.Set(clientID, authParameters.ClientID) + addScopeQueryParam(qv, authParameters) + + endpoint := strings.Replace(authParameters.Endpoints.TokenEndpoint, "token", "devicecode", -1) + + resp := DeviceCodeResponse{} + err := c.Comm.URLFormCall(ctx, endpoint, qv, &resp) + if err != nil { + return DeviceCodeResult{}, err + } + + return resp.Convert(authParameters.ClientID, authParameters.Scopes), nil +} + +func (c Client) FromDeviceCodeResult(ctx context.Context, authParameters authority.AuthParams, deviceCodeResult DeviceCodeResult) (TokenResponse, error) { + qv := url.Values{} + qv.Set(grantType, grant.DeviceCode) + qv.Set(deviceCode, deviceCodeResult.DeviceCode) + qv.Set(clientID, authParameters.ClientID) + qv.Set(clientInfo, clientInfoVal) + addScopeQueryParam(qv, authParameters) + + return c.doTokenResp(ctx, authParameters, qv) +} + +func (c Client) FromSamlGrant(ctx context.Context, authParameters authority.AuthParams, samlGrant wstrust.SamlTokenInfo) (TokenResponse, error) { + qv := url.Values{} + qv.Set(username, authParameters.Username) + qv.Set(password, authParameters.Password) + qv.Set(clientID, authParameters.ClientID) + qv.Set(clientInfo, clientInfoVal) + qv.Set("assertion", base64.StdEncoding.WithPadding(base64.StdPadding).EncodeToString([]byte(samlGrant.Assertion))) + addScopeQueryParam(qv, authParameters) + + switch samlGrant.AssertionType { + case grant.SAMLV1: + qv.Set(grantType, grant.SAMLV1) + case grant.SAMLV2: + qv.Set(grantType, grant.SAMLV2) + default: + return TokenResponse{}, fmt.Errorf("GetAccessTokenFromSamlGrant returned unknown SAML assertion type: %q", samlGrant.AssertionType) + } + + return c.doTokenResp(ctx, authParameters, qv) +} + +func (c Client) doTokenResp(ctx context.Context, authParams authority.AuthParams, qv url.Values) (TokenResponse, error) { + resp := TokenResponse{} + err := c.Comm.URLFormCall(ctx, authParams.Endpoints.TokenEndpoint, qv, &resp) + if err != nil { + return resp, err + } + resp.ComputeScope(authParams) + if c.testing { + return resp, nil + } + return resp, resp.Validate() +} + +// prepURLVals returns an url.Values that sets various key/values if we are doing secrets +// or JWT assertions. +func prepURLVals(ctx context.Context, cc *Credential, authParams authority.AuthParams) (url.Values, error) { + params := url.Values{} + if cc.Secret != "" { + params.Set("client_secret", cc.Secret) + return params, nil + } + + jwt, err := cc.JWT(ctx, authParams) + if err != nil { + return nil, err + } + params.Set("client_assertion", jwt) + params.Set("client_assertion_type", grant.ClientAssertion) + return params, nil +} + +// openid required to get an id token +// offline_access required to get a refresh token +// profile required to get the client_info field back +var detectDefaultScopes = map[string]bool{ + "openid": true, + "offline_access": true, + "profile": true, +} + +var defaultScopes = []string{"openid", "offline_access", "profile"} + +func AppendDefaultScopes(authParameters authority.AuthParams) []string { + scopes := make([]string, 0, len(authParameters.Scopes)+len(defaultScopes)) + for _, scope := range authParameters.Scopes { + s := strings.TrimSpace(scope) + if s == "" { + continue + } + if detectDefaultScopes[scope] { + continue + } + scopes = append(scopes, scope) + } + scopes = append(scopes, defaultScopes...) + return scopes +} + +func addScopeQueryParam(queryParams url.Values, authParameters authority.AuthParams) { + scopes := AppendDefaultScopes(authParameters) + queryParams.Set("scope", strings.Join(scopes, " ")) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/apptype_string.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/apptype_string.go new file mode 100644 index 000000000..3bec4a67c --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/apptype_string.go @@ -0,0 +1,25 @@ +// Code generated by "stringer -type=AppType"; DO NOT EDIT. + +package accesstokens + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ATUnknown-0] + _ = x[ATPublic-1] + _ = x[ATConfidential-2] +} + +const _AppType_name = "ATUnknownATPublicATConfidential" + +var _AppType_index = [...]uint8{0, 9, 17, 31} + +func (i AppType) String() string { + if i < 0 || i >= AppType(len(_AppType_index)-1) { + return "AppType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _AppType_name[_AppType_index[i]:_AppType_index[i+1]] +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/tokens.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/tokens.go new file mode 100644 index 000000000..cc8470019 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens/tokens.go @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package accesstokens + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "reflect" + "strings" + "time" + + internalTime "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" +) + +// IDToken consists of all the information used to validate a user. +// https://docs.microsoft.com/azure/active-directory/develop/id-tokens . +type IDToken struct { + PreferredUsername string `json:"preferred_username,omitempty"` + GivenName string `json:"given_name,omitempty"` + FamilyName string `json:"family_name,omitempty"` + MiddleName string `json:"middle_name,omitempty"` + Name string `json:"name,omitempty"` + Oid string `json:"oid,omitempty"` + TenantID string `json:"tid,omitempty"` + Subject string `json:"sub,omitempty"` + UPN string `json:"upn,omitempty"` + Email string `json:"email,omitempty"` + AlternativeID string `json:"alternative_id,omitempty"` + Issuer string `json:"iss,omitempty"` + Audience string `json:"aud,omitempty"` + ExpirationTime int64 `json:"exp,omitempty"` + IssuedAt int64 `json:"iat,omitempty"` + NotBefore int64 `json:"nbf,omitempty"` + RawToken string + + AdditionalFields map[string]interface{} +} + +var null = []byte("null") + +// UnmarshalJSON implements json.Unmarshaler. +func (i *IDToken) UnmarshalJSON(b []byte) error { + if bytes.Equal(null, b) { + return nil + } + + // Because we have a custom unmarshaler, you + // cannot directly call json.Unmarshal here. If you do, it will call this function + // recursively until reach our recursion limit. We have to create a new type + // that doesn't have this method in order to use json.Unmarshal. + type idToken2 IDToken + + jwt := strings.Trim(string(b), `"`) + jwtArr := strings.Split(jwt, ".") + if len(jwtArr) < 2 { + return errors.New("IDToken returned from server is invalid") + } + + jwtPart := jwtArr[1] + jwtDecoded, err := decodeJWT(jwtPart) + if err != nil { + return fmt.Errorf("unable to unmarshal IDToken, problem decoding JWT: %w", err) + } + + token := idToken2{} + err = json.Unmarshal(jwtDecoded, &token) + if err != nil { + return fmt.Errorf("unable to unmarshal IDToken: %w", err) + } + token.RawToken = jwt + + *i = IDToken(token) + return nil +} + +// IsZero indicates if the IDToken is the zero value. +func (i IDToken) IsZero() bool { + v := reflect.ValueOf(i) + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if !field.IsZero() { + switch field.Kind() { + case reflect.Map, reflect.Slice: + if field.Len() == 0 { + continue + } + } + return false + } + } + return true +} + +// LocalAccountID extracts an account's local account ID from an ID token. +func (i IDToken) LocalAccountID() string { + if i.Oid != "" { + return i.Oid + } + return i.Subject +} + +// jwtDecoder is provided to allow tests to provide their own. +var jwtDecoder = decodeJWT + +// ClientInfo is used to create a Home Account ID for an account. +type ClientInfo struct { + UID string `json:"uid"` + UTID string `json:"utid"` + + AdditionalFields map[string]interface{} +} + +// UnmarshalJSON implements json.Unmarshaler.s +func (c *ClientInfo) UnmarshalJSON(b []byte) error { + s := strings.Trim(string(b), `"`) + // Client info may be empty in some flows, e.g. certificate exchange. + if len(s) == 0 { + return nil + } + + // Because we have a custom unmarshaler, you + // cannot directly call json.Unmarshal here. If you do, it will call this function + // recursively until reach our recursion limit. We have to create a new type + // that doesn't have this method in order to use json.Unmarshal. + type clientInfo2 ClientInfo + + raw, err := jwtDecoder(s) + if err != nil { + return fmt.Errorf("TokenResponse client_info field had JWT decode error: %w", err) + } + + var c2 clientInfo2 + + err = json.Unmarshal(raw, &c2) + if err != nil { + return fmt.Errorf("was unable to unmarshal decoded JWT in TokenRespone to ClientInfo: %w", err) + } + + *c = ClientInfo(c2) + return nil +} + +// HomeAccountID creates the home account ID. +func (c ClientInfo) HomeAccountID() string { + if c.UID == "" || c.UTID == "" { + return "" + } + return fmt.Sprintf("%s.%s", c.UID, c.UTID) +} + +// Scopes represents scopes in a TokenResponse. +type Scopes struct { + Slice []string +} + +// UnmarshalJSON implements json.Unmarshal. +func (s *Scopes) UnmarshalJSON(b []byte) error { + str := strings.Trim(string(b), `"`) + if len(str) == 0 { + return nil + } + sl := strings.Split(str, " ") + s.Slice = sl + return nil +} + +// TokenResponse is the information that is returned from a token endpoint during a token acquisition flow. +type TokenResponse struct { + authority.OAuthResponseBase + + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + + FamilyID string `json:"foci"` + IDToken IDToken `json:"id_token"` + ClientInfo ClientInfo `json:"client_info"` + ExpiresOn internalTime.DurationTime `json:"expires_in"` + ExtExpiresOn internalTime.DurationTime `json:"ext_expires_in"` + GrantedScopes Scopes `json:"scope"` + DeclinedScopes []string // This is derived + + AdditionalFields map[string]interface{} + + scopesComputed bool +} + +// ComputeScope computes the final scopes based on what was granted by the server and +// what our AuthParams were from the authority server. Per OAuth spec, if no scopes are returned, the response should be treated as if all scopes were granted +// This behavior can be observed in client assertion flows, but can happen at any time, this check ensures we treat +// those special responses properly Link to spec: https://tools.ietf.org/html/rfc6749#section-3.3 +func (tr *TokenResponse) ComputeScope(authParams authority.AuthParams) { + if len(tr.GrantedScopes.Slice) == 0 { + tr.GrantedScopes = Scopes{Slice: authParams.Scopes} + } else { + tr.DeclinedScopes = findDeclinedScopes(authParams.Scopes, tr.GrantedScopes.Slice) + } + tr.scopesComputed = true +} + +// Validate validates the TokenResponse has basic valid values. It must be called +// after ComputeScopes() is called. +func (tr *TokenResponse) Validate() error { + if tr.Error != "" { + return fmt.Errorf("%s: %s", tr.Error, tr.ErrorDescription) + } + + if tr.AccessToken == "" { + return errors.New("response is missing access_token") + } + + if !tr.scopesComputed { + return fmt.Errorf("TokenResponse hasn't had ScopesComputed() called") + } + return nil +} + +func (tr *TokenResponse) CacheKey(authParams authority.AuthParams) string { + if authParams.AuthorizationType == authority.ATOnBehalfOf { + return authParams.AssertionHash() + } + if authParams.AuthorizationType == authority.ATClientCredentials { + return authParams.AppKey() + } + if authParams.IsConfidentialClient || authParams.AuthorizationType == authority.ATRefreshToken { + return tr.ClientInfo.HomeAccountID() + } + return "" +} + +func findDeclinedScopes(requestedScopes []string, grantedScopes []string) []string { + declined := []string{} + grantedMap := map[string]bool{} + for _, s := range grantedScopes { + grantedMap[strings.ToLower(s)] = true + } + // Comparing the requested scopes with the granted scopes to see if there are any scopes that have been declined. + for _, r := range requestedScopes { + if !grantedMap[strings.ToLower(r)] { + declined = append(declined, r) + } + } + return declined +} + +// decodeJWT decodes a JWT and converts it to a byte array representing a JSON object +// JWT has headers and payload base64url encoded without padding +// https://tools.ietf.org/html/rfc7519#section-3 and +// https://tools.ietf.org/html/rfc7515#section-2 +func decodeJWT(data string) ([]byte, error) { + // https://tools.ietf.org/html/rfc7515#appendix-C + return base64.RawURLEncoding.DecodeString(data) +} + +// RefreshToken is the JSON representation of a MSAL refresh token for encoding to storage. +type RefreshToken struct { + HomeAccountID string `json:"home_account_id,omitempty"` + Environment string `json:"environment,omitempty"` + CredentialType string `json:"credential_type,omitempty"` + ClientID string `json:"client_id,omitempty"` + FamilyID string `json:"family_id,omitempty"` + Secret string `json:"secret,omitempty"` + Realm string `json:"realm,omitempty"` + Target string `json:"target,omitempty"` + UserAssertionHash string `json:"user_assertion_hash,omitempty"` + + AdditionalFields map[string]interface{} +} + +// NewRefreshToken is the constructor for RefreshToken. +func NewRefreshToken(homeID, env, clientID, refreshToken, familyID string) RefreshToken { + return RefreshToken{ + HomeAccountID: homeID, + Environment: env, + CredentialType: "RefreshToken", + ClientID: clientID, + FamilyID: familyID, + Secret: refreshToken, + } +} + +// Key outputs the key that can be used to uniquely look up this entry in a map. +func (rt RefreshToken) Key() string { + var fourth = rt.FamilyID + if fourth == "" { + fourth = rt.ClientID + } + + return strings.Join( + []string{rt.HomeAccountID, rt.Environment, rt.CredentialType, fourth}, + shared.CacheKeySeparator, + ) +} + +func (rt RefreshToken) GetSecret() string { + return rt.Secret +} + +// DeviceCodeResult stores the response from the STS device code endpoint. +type DeviceCodeResult struct { + // UserCode is the code the user needs to provide when authentication at the verification URI. + UserCode string + // DeviceCode is the code used in the access token request. + DeviceCode string + // VerificationURL is the the URL where user can authenticate. + VerificationURL string + // ExpiresOn is the expiration time of device code in seconds. + ExpiresOn time.Time + // Interval is the interval at which the STS should be polled at. + Interval int + // Message is the message which should be displayed to the user. + Message string + // ClientID is the UUID issued by the authorization server for your application. + ClientID string + // Scopes is the OpenID scopes used to request access a protected API. + Scopes []string +} + +// NewDeviceCodeResult creates a DeviceCodeResult instance. +func NewDeviceCodeResult(userCode, deviceCode, verificationURL string, expiresOn time.Time, interval int, message, clientID string, scopes []string) DeviceCodeResult { + return DeviceCodeResult{userCode, deviceCode, verificationURL, expiresOn, interval, message, clientID, scopes} +} + +func (dcr DeviceCodeResult) String() string { + return fmt.Sprintf("UserCode: (%v)\nDeviceCode: (%v)\nURL: (%v)\nMessage: (%v)\n", dcr.UserCode, dcr.DeviceCode, dcr.VerificationURL, dcr.Message) + +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authority.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authority.go new file mode 100644 index 000000000..4724d944f --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authority.go @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package authority + +import ( + "context" + "crypto/sha256" + "encoding/base64" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "os" + "strings" + "time" + + "github.com/google/uuid" +) + +const ( + authorizationEndpoint = "https://%v/%v/oauth2/v2.0/authorize" + instanceDiscoveryEndpoint = "https://%v/common/discovery/instance" + tenantDiscoveryEndpointWithRegion = "https://%s.%s/%s/v2.0/.well-known/openid-configuration" + regionName = "REGION_NAME" + defaultAPIVersion = "2021-10-01" + imdsEndpoint = "http://169.254.169.254/metadata/instance/compute/location?format=text&api-version=" + defaultAPIVersion + defaultHost = "login.microsoftonline.com" + autoDetectRegion = "TryAutoDetect" +) + +type jsonCaller interface { + JSONCall(ctx context.Context, endpoint string, headers http.Header, qv url.Values, body, resp interface{}) error +} + +var aadTrustedHostList = map[string]bool{ + "login.windows.net": true, // Microsoft Azure Worldwide - Used in validation scenarios where host is not this list + "login.chinacloudapi.cn": true, // Microsoft Azure China + "login.microsoftonline.de": true, // Microsoft Azure Blackforest + "login-us.microsoftonline.com": true, // Microsoft Azure US Government - Legacy + "login.microsoftonline.us": true, // Microsoft Azure US Government + "login.microsoftonline.com": true, // Microsoft Azure Worldwide + "login.cloudgovapi.us": true, // Microsoft Azure US Government +} + +// TrustedHost checks if an AAD host is trusted/valid. +func TrustedHost(host string) bool { + if _, ok := aadTrustedHostList[host]; ok { + return true + } + return false +} + +type OAuthResponseBase struct { + Error string `json:"error"` + SubError string `json:"suberror"` + ErrorDescription string `json:"error_description"` + ErrorCodes []int `json:"error_codes"` + CorrelationID string `json:"correlation_id"` + Claims string `json:"claims"` +} + +// TenantDiscoveryResponse is the tenant endpoints from the OpenID configuration endpoint. +type TenantDiscoveryResponse struct { + OAuthResponseBase + + AuthorizationEndpoint string `json:"authorization_endpoint"` + TokenEndpoint string `json:"token_endpoint"` + Issuer string `json:"issuer"` + + AdditionalFields map[string]interface{} +} + +// Validate validates that the response had the correct values required. +func (r *TenantDiscoveryResponse) Validate() error { + switch "" { + case r.AuthorizationEndpoint: + return errors.New("TenantDiscoveryResponse: authorize endpoint was not found in the openid configuration") + case r.TokenEndpoint: + return errors.New("TenantDiscoveryResponse: token endpoint was not found in the openid configuration") + case r.Issuer: + return errors.New("TenantDiscoveryResponse: issuer was not found in the openid configuration") + } + return nil +} + +type InstanceDiscoveryMetadata struct { + PreferredNetwork string `json:"preferred_network"` + PreferredCache string `json:"preferred_cache"` + Aliases []string `json:"aliases"` + + AdditionalFields map[string]interface{} +} + +type InstanceDiscoveryResponse struct { + TenantDiscoveryEndpoint string `json:"tenant_discovery_endpoint"` + Metadata []InstanceDiscoveryMetadata `json:"metadata"` + + AdditionalFields map[string]interface{} +} + +//go:generate stringer -type=AuthorizeType + +// AuthorizeType represents the type of token flow. +type AuthorizeType int + +// These are all the types of token flows. +const ( + ATUnknown AuthorizeType = iota + ATUsernamePassword + ATWindowsIntegrated + ATAuthCode + ATInteractive + ATClientCredentials + ATDeviceCode + ATRefreshToken + AccountByID + ATOnBehalfOf +) + +// These are all authority types +const ( + AAD = "MSSTS" + ADFS = "ADFS" +) + +// AuthParams represents the parameters used for authorization for token acquisition. +type AuthParams struct { + AuthorityInfo Info + CorrelationID string + Endpoints Endpoints + ClientID string + // Redirecturi is used for auth flows that specify a redirect URI (e.g. local server for interactive auth flow). + Redirecturi string + HomeAccountID string + // Username is the user-name portion for username/password auth flow. + Username string + // Password is the password portion for username/password auth flow. + Password string + // Scopes is the list of scopes the user consents to. + Scopes []string + // AuthorizationType specifies the auth flow being used. + AuthorizationType AuthorizeType + // State is a random value used to prevent cross-site request forgery attacks. + State string + // CodeChallenge is derived from a code verifier and is sent in the auth request. + CodeChallenge string + // CodeChallengeMethod describes the method used to create the CodeChallenge. + CodeChallengeMethod string + // Prompt specifies the user prompt type during interactive auth. + Prompt string + // IsConfidentialClient specifies if it is a confidential client. + IsConfidentialClient bool + // SendX5C specifies if x5c claim(public key of the certificate) should be sent to STS. + SendX5C bool + // UserAssertion is the access token used to acquire token on behalf of user + UserAssertion string + + // KnownAuthorityHosts don't require metadata discovery because they're known to the user + KnownAuthorityHosts []string +} + +// NewAuthParams creates an authorization parameters object. +func NewAuthParams(clientID string, authorityInfo Info) AuthParams { + return AuthParams{ + ClientID: clientID, + AuthorityInfo: authorityInfo, + CorrelationID: uuid.New().String(), + } +} + +// Info consists of information about the authority. +type Info struct { + Host string + CanonicalAuthorityURI string + AuthorityType string + UserRealmURIPrefix string + ValidateAuthority bool + Tenant string + Region string +} + +func firstPathSegment(u *url.URL) (string, error) { + pathParts := strings.Split(u.EscapedPath(), "/") + if len(pathParts) >= 2 { + return pathParts[1], nil + } + + return "", errors.New("authority does not have two segments") +} + +// NewInfoFromAuthorityURI creates an AuthorityInfo instance from the authority URL provided. +func NewInfoFromAuthorityURI(authorityURI string, validateAuthority bool) (Info, error) { + authorityURI = strings.ToLower(authorityURI) + var authorityType string + u, err := url.Parse(authorityURI) + if err != nil { + return Info{}, fmt.Errorf("authorityURI passed could not be parsed: %w", err) + } + if u.Scheme != "https" { + return Info{}, fmt.Errorf("authorityURI(%s) must have scheme https", authorityURI) + } + + tenant, err := firstPathSegment(u) + if tenant == "adfs" { + authorityType = ADFS + } else { + authorityType = AAD + } + + if err != nil { + return Info{}, err + } + + return Info{ + Host: u.Hostname(), + CanonicalAuthorityURI: fmt.Sprintf("https://%v/%v/", u.Hostname(), tenant), + AuthorityType: authorityType, + UserRealmURIPrefix: fmt.Sprintf("https://%v/common/userrealm/", u.Hostname()), + ValidateAuthority: validateAuthority, + Tenant: tenant, + }, nil +} + +// Endpoints consists of the endpoints from the tenant discovery response. +type Endpoints struct { + AuthorizationEndpoint string + TokenEndpoint string + selfSignedJwtAudience string + authorityHost string +} + +// NewEndpoints creates an Endpoints object. +func NewEndpoints(authorizationEndpoint string, tokenEndpoint string, selfSignedJwtAudience string, authorityHost string) Endpoints { + return Endpoints{authorizationEndpoint, tokenEndpoint, selfSignedJwtAudience, authorityHost} +} + +// UserRealmAccountType refers to the type of user realm. +type UserRealmAccountType string + +// These are the different types of user realms. +const ( + Unknown UserRealmAccountType = "" + Federated UserRealmAccountType = "Federated" + Managed UserRealmAccountType = "Managed" +) + +// UserRealm is used for the username password request to determine user type +type UserRealm struct { + AccountType UserRealmAccountType `json:"account_type"` + DomainName string `json:"domain_name"` + CloudInstanceName string `json:"cloud_instance_name"` + CloudAudienceURN string `json:"cloud_audience_urn"` + + // required if accountType is Federated + FederationProtocol string `json:"federation_protocol"` + FederationMetadataURL string `json:"federation_metadata_url"` + + AdditionalFields map[string]interface{} +} + +func (u UserRealm) validate() error { + switch "" { + case string(u.AccountType): + return errors.New("the account type (Federated or Managed) is missing") + case u.DomainName: + return errors.New("domain name of user realm is missing") + case u.CloudInstanceName: + return errors.New("cloud instance name of user realm is missing") + case u.CloudAudienceURN: + return errors.New("cloud Instance URN is missing") + } + + if u.AccountType == Federated { + switch "" { + case u.FederationProtocol: + return errors.New("federation protocol of user realm is missing") + case u.FederationMetadataURL: + return errors.New("federation metadata URL of user realm is missing") + } + } + return nil +} + +// Client represents the REST calls to authority backends. +type Client struct { + // Comm provides the HTTP transport client. + Comm jsonCaller // *comm.Client +} + +func (c Client) UserRealm(ctx context.Context, authParams AuthParams) (UserRealm, error) { + endpoint := fmt.Sprintf("https://%s/common/UserRealm/%s", authParams.Endpoints.authorityHost, url.PathEscape(authParams.Username)) + qv := url.Values{ + "api-version": []string{"1.0"}, + } + + resp := UserRealm{} + err := c.Comm.JSONCall( + ctx, + endpoint, + http.Header{"client-request-id": []string{authParams.CorrelationID}}, + qv, + nil, + &resp, + ) + if err != nil { + return resp, err + } + + return resp, resp.validate() +} + +func (c Client) GetTenantDiscoveryResponse(ctx context.Context, openIDConfigurationEndpoint string) (TenantDiscoveryResponse, error) { + resp := TenantDiscoveryResponse{} + err := c.Comm.JSONCall( + ctx, + openIDConfigurationEndpoint, + http.Header{}, + nil, + nil, + &resp, + ) + + return resp, err +} + +func (c Client) AADInstanceDiscovery(ctx context.Context, authorityInfo Info) (InstanceDiscoveryResponse, error) { + region := "" + var err error + resp := InstanceDiscoveryResponse{} + if authorityInfo.Region != "" && authorityInfo.Region != autoDetectRegion { + region = authorityInfo.Region + } else if authorityInfo.Region == autoDetectRegion { + region = detectRegion(ctx) + } + if region != "" { + environment := authorityInfo.Host + switch environment { + case "login.microsoft.com", "login.windows.net", "sts.windows.net", defaultHost: + environment = "r." + defaultHost + } + resp.TenantDiscoveryEndpoint = fmt.Sprintf(tenantDiscoveryEndpointWithRegion, region, environment, authorityInfo.Tenant) + metadata := InstanceDiscoveryMetadata{ + PreferredNetwork: fmt.Sprintf("%v.%v", region, authorityInfo.Host), + PreferredCache: authorityInfo.Host, + Aliases: []string{fmt.Sprintf("%v.%v", region, authorityInfo.Host), authorityInfo.Host}, + } + resp.Metadata = []InstanceDiscoveryMetadata{metadata} + } else { + qv := url.Values{} + qv.Set("api-version", "1.1") + qv.Set("authorization_endpoint", fmt.Sprintf(authorizationEndpoint, authorityInfo.Host, authorityInfo.Tenant)) + + discoveryHost := defaultHost + if TrustedHost(authorityInfo.Host) { + discoveryHost = authorityInfo.Host + } + + endpoint := fmt.Sprintf(instanceDiscoveryEndpoint, discoveryHost) + err = c.Comm.JSONCall(ctx, endpoint, http.Header{}, qv, nil, &resp) + } + return resp, err +} + +func detectRegion(ctx context.Context) string { + region := os.Getenv(regionName) + if region != "" { + region = strings.ReplaceAll(region, " ", "") + return strings.ToLower(region) + } + // HTTP call to IMDS endpoint to get region + // Refer : https://identitydivision.visualstudio.com/DevEx/_git/AuthLibrariesApiReview?path=%2FPinAuthToRegion%2FAAD%20SDK%20Proposal%20to%20Pin%20Auth%20to%20region.md&_a=preview&version=GBdev + // Set a 2 second timeout for this http client which only does calls to IMDS endpoint + client := http.Client{ + Timeout: time.Duration(2 * time.Second), + } + req, _ := http.NewRequest("GET", imdsEndpoint, nil) + req.Header.Set("Metadata", "true") + resp, err := client.Do(req) + // If the request times out or there is an error, it is retried once + if err != nil || resp.StatusCode != 200 { + resp, err = client.Do(req) + if err != nil || resp.StatusCode != 200 { + return "" + } + } + defer resp.Body.Close() + response, err := io.ReadAll(resp.Body) + if err != nil { + return "" + } + return string(response) +} + +func (a *AuthParams) CacheKey(isAppCache bool) string { + if a.AuthorizationType == ATOnBehalfOf { + return a.AssertionHash() + } + if a.AuthorizationType == ATClientCredentials || isAppCache { + return a.AppKey() + } + if a.AuthorizationType == ATRefreshToken || a.AuthorizationType == AccountByID { + return a.HomeAccountID + } + return "" +} +func (a *AuthParams) AssertionHash() string { + hasher := sha256.New() + // Per documentation this never returns an error : https://pkg.go.dev/hash#pkg-types + _, _ = hasher.Write([]byte(a.UserAssertion)) + sha := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) + return sha +} + +func (a *AuthParams) AppKey() string { + if a.AuthorityInfo.Tenant != "" { + return fmt.Sprintf("%s_%s_AppTokenCache", a.ClientID, a.AuthorityInfo.Tenant) + } + return fmt.Sprintf("%s__AppTokenCache", a.ClientID) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authorizetype_string.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authorizetype_string.go new file mode 100644 index 000000000..10039773b --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority/authorizetype_string.go @@ -0,0 +1,30 @@ +// Code generated by "stringer -type=AuthorizeType"; DO NOT EDIT. + +package authority + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ATUnknown-0] + _ = x[ATUsernamePassword-1] + _ = x[ATWindowsIntegrated-2] + _ = x[ATAuthCode-3] + _ = x[ATInteractive-4] + _ = x[ATClientCredentials-5] + _ = x[ATDeviceCode-6] + _ = x[ATRefreshToken-7] +} + +const _AuthorizeType_name = "ATUnknownATUsernamePasswordATWindowsIntegratedATAuthCodeATInteractiveATClientCredentialsATDeviceCodeATRefreshToken" + +var _AuthorizeType_index = [...]uint8{0, 9, 27, 46, 56, 69, 88, 100, 114} + +func (i AuthorizeType) String() string { + if i < 0 || i >= AuthorizeType(len(_AuthorizeType_index)-1) { + return "AuthorizeType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _AuthorizeType_name[_AuthorizeType_index[i]:_AuthorizeType_index[i+1]] +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/comm.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/comm.go new file mode 100644 index 000000000..7d9ec7cd3 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/comm.go @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package comm provides helpers for communicating with HTTP backends. +package comm + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "net/http" + "net/url" + "reflect" + "runtime" + "strings" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors" + customJSON "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/version" + "github.com/google/uuid" +) + +// HTTPClient represents an HTTP client. +// It's usually an *http.Client from the standard library. +type HTTPClient interface { + // Do sends an HTTP request and returns an HTTP response. + Do(req *http.Request) (*http.Response, error) + + // CloseIdleConnections closes any idle connections in a "keep-alive" state. + CloseIdleConnections() +} + +// Client provides a wrapper to our *http.Client that handles compression and serialization needs. +type Client struct { + client HTTPClient +} + +// New returns a new Client object. +func New(httpClient HTTPClient) *Client { + if httpClient == nil { + panic("http.Client cannot == nil") + } + + return &Client{client: httpClient} +} + +// JSONCall connects to the REST endpoint passing the HTTP query values, headers and JSON conversion +// of body in the HTTP body. It automatically handles compression and decompression with gzip. The response is JSON +// unmarshalled into resp. resp must be a pointer to a struct. If the body struct contains a field called +// "AdditionalFields" we use a custom marshal/unmarshal engine. +func (c *Client) JSONCall(ctx context.Context, endpoint string, headers http.Header, qv url.Values, body, resp interface{}) error { + if qv == nil { + qv = url.Values{} + } + + v := reflect.ValueOf(resp) + if err := c.checkResp(v); err != nil { + return err + } + + // Choose a JSON marshal/unmarshal depending on if we have AdditionalFields attribute. + var marshal = json.Marshal + var unmarshal = json.Unmarshal + if _, ok := v.Elem().Type().FieldByName("AdditionalFields"); ok { + marshal = customJSON.Marshal + unmarshal = customJSON.Unmarshal + } + + u, err := url.Parse(endpoint) + if err != nil { + return fmt.Errorf("could not parse path URL(%s): %w", endpoint, err) + } + u.RawQuery = qv.Encode() + + addStdHeaders(headers) + + req := &http.Request{Method: http.MethodGet, URL: u, Header: headers} + + if body != nil { + // Note: In case your wondering why we are not gzip encoding.... + // I'm not sure if these various services support gzip on send. + headers.Add("Content-Type", "application/json; charset=utf-8") + data, err := marshal(body) + if err != nil { + return fmt.Errorf("bug: conn.Call(): could not marshal the body object: %w", err) + } + req.Body = io.NopCloser(bytes.NewBuffer(data)) + req.Method = http.MethodPost + } + + data, err := c.do(ctx, req) + if err != nil { + return err + } + + if resp != nil { + if err := unmarshal(data, resp); err != nil { + return fmt.Errorf("json decode error: %w\njson message bytes were: %s", err, string(data)) + } + } + return nil +} + +// XMLCall connects to an endpoint and decodes the XML response into resp. This is used when +// sending application/xml . If sending XML via SOAP, use SOAPCall(). +func (c *Client) XMLCall(ctx context.Context, endpoint string, headers http.Header, qv url.Values, resp interface{}) error { + if err := c.checkResp(reflect.ValueOf(resp)); err != nil { + return err + } + + if qv == nil { + qv = url.Values{} + } + + u, err := url.Parse(endpoint) + if err != nil { + return fmt.Errorf("could not parse path URL(%s): %w", endpoint, err) + } + u.RawQuery = qv.Encode() + + headers.Set("Content-Type", "application/xml; charset=utf-8") // This was not set in he original Mex(), but... + addStdHeaders(headers) + + return c.xmlCall(ctx, u, headers, "", resp) +} + +// SOAPCall returns the SOAP message given an endpoint, action, body of the request and the response object to marshal into. +func (c *Client) SOAPCall(ctx context.Context, endpoint, action string, headers http.Header, qv url.Values, body string, resp interface{}) error { + if body == "" { + return fmt.Errorf("cannot make a SOAP call with body set to empty string") + } + + if err := c.checkResp(reflect.ValueOf(resp)); err != nil { + return err + } + + if qv == nil { + qv = url.Values{} + } + + u, err := url.Parse(endpoint) + if err != nil { + return fmt.Errorf("could not parse path URL(%s): %w", endpoint, err) + } + u.RawQuery = qv.Encode() + + headers.Set("Content-Type", "application/soap+xml; charset=utf-8") + headers.Set("SOAPAction", action) + addStdHeaders(headers) + + return c.xmlCall(ctx, u, headers, body, resp) +} + +// xmlCall sends an XML in body and decodes into resp. This simply does the transport and relies on +// an upper level call to set things such as SOAP parameters and Content-Type, if required. +func (c *Client) xmlCall(ctx context.Context, u *url.URL, headers http.Header, body string, resp interface{}) error { + req := &http.Request{Method: http.MethodGet, URL: u, Header: headers} + + if len(body) > 0 { + req.Method = http.MethodPost + req.Body = io.NopCloser(strings.NewReader(body)) + } + + data, err := c.do(ctx, req) + if err != nil { + return err + } + + return xml.Unmarshal(data, resp) +} + +// URLFormCall is used to make a call where we need to send application/x-www-form-urlencoded data +// to the backend and receive JSON back. qv will be encoded into the request body. +func (c *Client) URLFormCall(ctx context.Context, endpoint string, qv url.Values, resp interface{}) error { + if len(qv) == 0 { + return fmt.Errorf("URLFormCall() requires qv to have non-zero length") + } + + if err := c.checkResp(reflect.ValueOf(resp)); err != nil { + return err + } + + u, err := url.Parse(endpoint) + if err != nil { + return fmt.Errorf("could not parse path URL(%s): %w", endpoint, err) + } + + headers := http.Header{} + headers.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + addStdHeaders(headers) + + enc := qv.Encode() + + req := &http.Request{ + Method: http.MethodPost, + URL: u, + Header: headers, + ContentLength: int64(len(enc)), + Body: io.NopCloser(strings.NewReader(enc)), + GetBody: func() (io.ReadCloser, error) { + return io.NopCloser(strings.NewReader(enc)), nil + }, + } + + data, err := c.do(ctx, req) + if err != nil { + return err + } + + v := reflect.ValueOf(resp) + if err := c.checkResp(v); err != nil { + return err + } + + var unmarshal = json.Unmarshal + if _, ok := v.Elem().Type().FieldByName("AdditionalFields"); ok { + unmarshal = customJSON.Unmarshal + } + if resp != nil { + if err := unmarshal(data, resp); err != nil { + return fmt.Errorf("json decode error: %w\nraw message was: %s", err, string(data)) + } + } + return nil +} + +// do makes the HTTP call to the server and returns the contents of the body. +func (c *Client) do(ctx context.Context, req *http.Request) ([]byte, error) { + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, 30*time.Second) + defer cancel() + } + req = req.WithContext(ctx) + + reply, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("server response error:\n %w", err) + } + defer reply.Body.Close() + + data, err := c.readBody(reply) + if err != nil { + return nil, fmt.Errorf("could not read the body of an HTTP Response: %w", err) + } + reply.Body = io.NopCloser(bytes.NewBuffer(data)) + + // NOTE: This doesn't happen immediately after the call so that we can get an error message + // from the server and include it in our error. + switch reply.StatusCode { + case 200, 201: + default: + sd := strings.TrimSpace(string(data)) + if sd != "" { + // We probably have the error in the body. + return nil, errors.CallErr{ + Req: req, + Resp: reply, + Err: fmt.Errorf("http call(%s)(%s) error: reply status code was %d:\n%s", req.URL.String(), req.Method, reply.StatusCode, sd), + } + } + return nil, errors.CallErr{ + Req: req, + Resp: reply, + Err: fmt.Errorf("http call(%s)(%s) error: reply status code was %d", req.URL.String(), req.Method, reply.StatusCode), + } + } + + return data, nil +} + +// checkResp checks a response object o make sure it is a pointer to a struct. +func (c *Client) checkResp(v reflect.Value) error { + if v.Kind() != reflect.Ptr { + return fmt.Errorf("bug: resp argument must a *struct, was %T", v.Interface()) + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return fmt.Errorf("bug: resp argument must be a *struct, was %T", v.Interface()) + } + return nil +} + +// readBody reads the body out of an *http.Response. It supports gzip encoded responses. +func (c *Client) readBody(resp *http.Response) ([]byte, error) { + var reader io.Reader = resp.Body + switch resp.Header.Get("Content-Encoding") { + case "": + // Do nothing + case "gzip": + reader = gzipDecompress(resp.Body) + default: + return nil, fmt.Errorf("bug: comm.Client.JSONCall(): content was send with unsupported content-encoding %s", resp.Header.Get("Content-Encoding")) + } + return io.ReadAll(reader) +} + +var testID string + +// addStdHeaders adds the standard headers we use on all calls. +func addStdHeaders(headers http.Header) http.Header { + headers.Set("Accept-Encoding", "gzip") + // So that I can have a static id for tests. + if testID != "" { + headers.Set("client-request-id", testID) + headers.Set("Return-Client-Request-Id", "false") + } else { + headers.Set("client-request-id", uuid.New().String()) + headers.Set("Return-Client-Request-Id", "false") + } + headers.Set("x-client-sku", "MSAL.Go") + headers.Set("x-client-os", runtime.GOOS) + headers.Set("x-client-cpu", runtime.GOARCH) + headers.Set("x-client-ver", version.Version) + return headers +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/compress.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/compress.go new file mode 100644 index 000000000..4d3dbfcf0 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm/compress.go @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package comm + +import ( + "compress/gzip" + "io" +) + +func gzipDecompress(r io.Reader) io.Reader { + gzipReader, _ := gzip.NewReader(r) + + pipeOut, pipeIn := io.Pipe() + go func() { + // decompression bomb would have to come from Azure services. + // If we want to limit, we should do that in comm.do(). + _, err := io.Copy(pipeIn, gzipReader) //nolint + if err != nil { + // don't need the error. + pipeIn.CloseWithError(err) //nolint + gzipReader.Close() + return + } + if err := gzipReader.Close(); err != nil { + // don't need the error. + pipeIn.CloseWithError(err) //nolint + return + } + pipeIn.Close() + }() + return pipeOut +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant/grant.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant/grant.go new file mode 100644 index 000000000..b628f61ac --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant/grant.go @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package grant holds types of grants issued by authorization services. +package grant + +const ( + Password = "password" + JWT = "urn:ietf:params:oauth:grant-type:jwt-bearer" + SAMLV1 = "urn:ietf:params:oauth:grant-type:saml1_1-bearer" + SAMLV2 = "urn:ietf:params:oauth:grant-type:saml2-bearer" + DeviceCode = "device_code" + AuthCode = "authorization_code" + RefreshToken = "refresh_token" + ClientCredential = "client_credentials" + ClientAssertion = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" +) diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/ops.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/ops.go new file mode 100644 index 000000000..1f9c543fa --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/ops.go @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package ops provides operations to various backend services using REST clients. + +The REST type provides several clients that can be used to communicate to backends. +Usage is simple: + + rest := ops.New() + + // Creates an authority client and calls the UserRealm() method. + userRealm, err := rest.Authority().UserRealm(ctx, authParameters) + if err != nil { + // Do something + } +*/ +package ops + +import ( + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust" +) + +// HTTPClient represents an HTTP client. +// It's usually an *http.Client from the standard library. +type HTTPClient = comm.HTTPClient + +// REST provides REST clients for communicating with various backends used by MSAL. +type REST struct { + client *comm.Client +} + +// New is the constructor for REST. +func New(httpClient HTTPClient) *REST { + return &REST{client: comm.New(httpClient)} +} + +// Authority returns a client for querying information about various authorities. +func (r *REST) Authority() authority.Client { + return authority.Client{Comm: r.client} +} + +// AccessTokens returns a client that can be used to get various access tokens for +// authorization purposes. +func (r *REST) AccessTokens() accesstokens.Client { + return accesstokens.Client{Comm: r.client} +} + +// WSTrust provides access to various metadata in a WSTrust service. This data can +// be used to gain tokens based on SAML data using the client provided by AccessTokens(). +func (r *REST) WSTrust() wstrust.Client { + return wstrust.Client{Comm: r.client} +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/endpointtype_string.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/endpointtype_string.go new file mode 100644 index 000000000..a2bb6278a --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/endpointtype_string.go @@ -0,0 +1,25 @@ +// Code generated by "stringer -type=endpointType"; DO NOT EDIT. + +package defs + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[etUnknown-0] + _ = x[etUsernamePassword-1] + _ = x[etWindowsTransport-2] +} + +const _endpointType_name = "etUnknownetUsernamePasswordetWindowsTransport" + +var _endpointType_index = [...]uint8{0, 9, 27, 45} + +func (i endpointType) String() string { + if i < 0 || i >= endpointType(len(_endpointType_index)-1) { + return "endpointType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _endpointType_name[_endpointType_index[i]:_endpointType_index[i+1]] +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/mex_document_definitions.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/mex_document_definitions.go new file mode 100644 index 000000000..649727002 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/mex_document_definitions.go @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package defs + +import "encoding/xml" + +type Definitions struct { + XMLName xml.Name `xml:"definitions"` + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + TargetNamespace string `xml:"targetNamespace,attr"` + WSDL string `xml:"wsdl,attr"` + XSD string `xml:"xsd,attr"` + T string `xml:"t,attr"` + SOAPENC string `xml:"soapenc,attr"` + SOAP string `xml:"soap,attr"` + TNS string `xml:"tns,attr"` + MSC string `xml:"msc,attr"` + WSAM string `xml:"wsam,attr"` + SOAP12 string `xml:"soap12,attr"` + WSA10 string `xml:"wsa10,attr"` + WSA string `xml:"wsa,attr"` + WSAW string `xml:"wsaw,attr"` + WSX string `xml:"wsx,attr"` + WSAP string `xml:"wsap,attr"` + WSU string `xml:"wsu,attr"` + Trust string `xml:"trust,attr"` + WSP string `xml:"wsp,attr"` + Policy []Policy `xml:"Policy"` + Types Types `xml:"types"` + Message []Message `xml:"message"` + PortType []PortType `xml:"portType"` + Binding []Binding `xml:"binding"` + Service Service `xml:"service"` +} + +type Policy struct { + Text string `xml:",chardata"` + ID string `xml:"Id,attr"` + ExactlyOne ExactlyOne `xml:"ExactlyOne"` +} + +type ExactlyOne struct { + Text string `xml:",chardata"` + All All `xml:"All"` +} + +type All struct { + Text string `xml:",chardata"` + NegotiateAuthentication NegotiateAuthentication `xml:"NegotiateAuthentication"` + TransportBinding TransportBinding `xml:"TransportBinding"` + UsingAddressing Text `xml:"UsingAddressing"` + EndorsingSupportingTokens EndorsingSupportingTokens `xml:"EndorsingSupportingTokens"` + WSS11 WSS11 `xml:"Wss11"` + Trust10 Trust10 `xml:"Trust10"` + SignedSupportingTokens SignedSupportingTokens `xml:"SignedSupportingTokens"` + Trust13 WSTrust13 `xml:"Trust13"` + SignedEncryptedSupportingTokens SignedEncryptedSupportingTokens `xml:"SignedEncryptedSupportingTokens"` +} + +type NegotiateAuthentication struct { + Text string `xml:",chardata"` + HTTP string `xml:"http,attr"` + XMLName xml.Name +} + +type TransportBinding struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy TransportBindingPolicy `xml:"Policy"` +} + +type TransportBindingPolicy struct { + Text string `xml:",chardata"` + TransportToken TransportToken `xml:"TransportToken"` + AlgorithmSuite AlgorithmSuite `xml:"AlgorithmSuite"` + Layout Layout `xml:"Layout"` + IncludeTimestamp Text `xml:"IncludeTimestamp"` +} + +type TransportToken struct { + Text string `xml:",chardata"` + Policy TransportTokenPolicy `xml:"Policy"` +} + +type TransportTokenPolicy struct { + Text string `xml:",chardata"` + HTTPSToken HTTPSToken `xml:"HttpsToken"` +} + +type HTTPSToken struct { + Text string `xml:",chardata"` + RequireClientCertificate string `xml:"RequireClientCertificate,attr"` +} + +type AlgorithmSuite struct { + Text string `xml:",chardata"` + Policy AlgorithmSuitePolicy `xml:"Policy"` +} + +type AlgorithmSuitePolicy struct { + Text string `xml:",chardata"` + Basic256 Text `xml:"Basic256"` + Basic128 Text `xml:"Basic128"` +} + +type Layout struct { + Text string `xml:",chardata"` + Policy LayoutPolicy `xml:"Policy"` +} + +type LayoutPolicy struct { + Text string `xml:",chardata"` + Strict Text `xml:"Strict"` +} + +type EndorsingSupportingTokens struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy EndorsingSupportingTokensPolicy `xml:"Policy"` +} + +type EndorsingSupportingTokensPolicy struct { + Text string `xml:",chardata"` + X509Token X509Token `xml:"X509Token"` + RSAToken RSAToken `xml:"RsaToken"` + SignedParts SignedParts `xml:"SignedParts"` + KerberosToken KerberosToken `xml:"KerberosToken"` + IssuedToken IssuedToken `xml:"IssuedToken"` + KeyValueToken KeyValueToken `xml:"KeyValueToken"` +} + +type X509Token struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + Policy X509TokenPolicy `xml:"Policy"` +} + +type X509TokenPolicy struct { + Text string `xml:",chardata"` + RequireThumbprintReference Text `xml:"RequireThumbprintReference"` + WSSX509V3Token10 Text `xml:"WssX509V3Token10"` +} + +type RSAToken struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + Optional string `xml:"Optional,attr"` + MSSP string `xml:"mssp,attr"` +} + +type SignedParts struct { + Text string `xml:",chardata"` + Header SignedPartsHeader `xml:"Header"` +} + +type SignedPartsHeader struct { + Text string `xml:",chardata"` + Name string `xml:"Name,attr"` + Namespace string `xml:"Namespace,attr"` +} + +type KerberosToken struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + Policy KerberosTokenPolicy `xml:"Policy"` +} + +type KerberosTokenPolicy struct { + Text string `xml:",chardata"` + WSSGSSKerberosV5ApReqToken11 Text `xml:"WssGssKerberosV5ApReqToken11"` +} + +type IssuedToken struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + RequestSecurityTokenTemplate RequestSecurityTokenTemplate `xml:"RequestSecurityTokenTemplate"` + Policy IssuedTokenPolicy `xml:"Policy"` +} + +type RequestSecurityTokenTemplate struct { + Text string `xml:",chardata"` + KeyType Text `xml:"KeyType"` + EncryptWith Text `xml:"EncryptWith"` + SignatureAlgorithm Text `xml:"SignatureAlgorithm"` + CanonicalizationAlgorithm Text `xml:"CanonicalizationAlgorithm"` + EncryptionAlgorithm Text `xml:"EncryptionAlgorithm"` + KeySize Text `xml:"KeySize"` + KeyWrapAlgorithm Text `xml:"KeyWrapAlgorithm"` +} + +type IssuedTokenPolicy struct { + Text string `xml:",chardata"` + RequireInternalReference Text `xml:"RequireInternalReference"` +} + +type KeyValueToken struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + Optional string `xml:"Optional,attr"` +} + +type WSS11 struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy Wss11Policy `xml:"Policy"` +} + +type Wss11Policy struct { + Text string `xml:",chardata"` + MustSupportRefThumbprint Text `xml:"MustSupportRefThumbprint"` +} + +type Trust10 struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy Trust10Policy `xml:"Policy"` +} + +type Trust10Policy struct { + Text string `xml:",chardata"` + MustSupportIssuedTokens Text `xml:"MustSupportIssuedTokens"` + RequireClientEntropy Text `xml:"RequireClientEntropy"` + RequireServerEntropy Text `xml:"RequireServerEntropy"` +} + +type SignedSupportingTokens struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy SupportingTokensPolicy `xml:"Policy"` +} + +type SupportingTokensPolicy struct { + Text string `xml:",chardata"` + UsernameToken UsernameToken `xml:"UsernameToken"` +} +type UsernameToken struct { + Text string `xml:",chardata"` + IncludeToken string `xml:"IncludeToken,attr"` + Policy UsernameTokenPolicy `xml:"Policy"` +} + +type UsernameTokenPolicy struct { + Text string `xml:",chardata"` + WSSUsernameToken10 WSSUsernameToken10 `xml:"WssUsernameToken10"` +} + +type WSSUsernameToken10 struct { + Text string `xml:",chardata"` + XMLName xml.Name +} + +type WSTrust13 struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy WSTrust13Policy `xml:"Policy"` +} + +type WSTrust13Policy struct { + Text string `xml:",chardata"` + MustSupportIssuedTokens Text `xml:"MustSupportIssuedTokens"` + RequireClientEntropy Text `xml:"RequireClientEntropy"` + RequireServerEntropy Text `xml:"RequireServerEntropy"` +} + +type SignedEncryptedSupportingTokens struct { + Text string `xml:",chardata"` + SP string `xml:"sp,attr"` + Policy SupportingTokensPolicy `xml:"Policy"` +} + +type Types struct { + Text string `xml:",chardata"` + Schema Schema `xml:"schema"` +} + +type Schema struct { + Text string `xml:",chardata"` + TargetNamespace string `xml:"targetNamespace,attr"` + Import []Import `xml:"import"` +} + +type Import struct { + Text string `xml:",chardata"` + SchemaLocation string `xml:"schemaLocation,attr"` + Namespace string `xml:"namespace,attr"` +} + +type Message struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Part Part `xml:"part"` +} + +type Part struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Element string `xml:"element,attr"` +} + +type PortType struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Operation Operation `xml:"operation"` +} + +type Operation struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Input OperationIO `xml:"input"` + Output OperationIO `xml:"output"` +} + +type OperationIO struct { + Text string `xml:",chardata"` + Action string `xml:"Action,attr"` + Message string `xml:"message,attr"` + Body OperationIOBody `xml:"body"` +} + +type OperationIOBody struct { + Text string `xml:",chardata"` + Use string `xml:"use,attr"` +} + +type Binding struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Type string `xml:"type,attr"` + PolicyReference PolicyReference `xml:"PolicyReference"` + Binding DefinitionsBinding `xml:"binding"` + Operation BindingOperation `xml:"operation"` +} + +type PolicyReference struct { + Text string `xml:",chardata"` + URI string `xml:"URI,attr"` +} + +type DefinitionsBinding struct { + Text string `xml:",chardata"` + Transport string `xml:"transport,attr"` +} + +type BindingOperation struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Operation BindingOperationOperation `xml:"operation"` + Input BindingOperationIO `xml:"input"` + Output BindingOperationIO `xml:"output"` +} + +type BindingOperationOperation struct { + Text string `xml:",chardata"` + SoapAction string `xml:"soapAction,attr"` + Style string `xml:"style,attr"` +} + +type BindingOperationIO struct { + Text string `xml:",chardata"` + Body OperationIOBody `xml:"body"` +} + +type Service struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Port []Port `xml:"port"` +} + +type Port struct { + Text string `xml:",chardata"` + Name string `xml:"name,attr"` + Binding string `xml:"binding,attr"` + Address Address `xml:"address"` + EndpointReference PortEndpointReference `xml:"EndpointReference"` +} + +type Address struct { + Text string `xml:",chardata"` + Location string `xml:"location,attr"` +} + +type PortEndpointReference struct { + Text string `xml:",chardata"` + Address Text `xml:"Address"` + Identity Identity `xml:"Identity"` +} + +type Identity struct { + Text string `xml:",chardata"` + XMLNS string `xml:"xmlns,attr"` + SPN Text `xml:"Spn"` +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/saml_assertion_definitions.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/saml_assertion_definitions.go new file mode 100644 index 000000000..7d0725565 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/saml_assertion_definitions.go @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package defs + +import "encoding/xml" + +// TODO(msal): Someone (and it ain't gonna be me) needs to document these attributes or +// at the least put a link to RFC. + +type SAMLDefinitions struct { + XMLName xml.Name `xml:"Envelope"` + Text string `xml:",chardata"` + S string `xml:"s,attr"` + A string `xml:"a,attr"` + U string `xml:"u,attr"` + Header Header `xml:"Header"` + Body Body `xml:"Body"` +} + +type Header struct { + Text string `xml:",chardata"` + Action Action `xml:"Action"` + Security Security `xml:"Security"` +} + +type Action struct { + Text string `xml:",chardata"` + MustUnderstand string `xml:"mustUnderstand,attr"` +} + +type Security struct { + Text string `xml:",chardata"` + MustUnderstand string `xml:"mustUnderstand,attr"` + O string `xml:"o,attr"` + Timestamp Timestamp `xml:"Timestamp"` +} + +type Timestamp struct { + Text string `xml:",chardata"` + ID string `xml:"Id,attr"` + Created Text `xml:"Created"` + Expires Text `xml:"Expires"` +} + +type Text struct { + Text string `xml:",chardata"` +} + +type Body struct { + Text string `xml:",chardata"` + RequestSecurityTokenResponseCollection RequestSecurityTokenResponseCollection `xml:"RequestSecurityTokenResponseCollection"` +} + +type RequestSecurityTokenResponseCollection struct { + Text string `xml:",chardata"` + Trust string `xml:"trust,attr"` + RequestSecurityTokenResponse []RequestSecurityTokenResponse `xml:"RequestSecurityTokenResponse"` +} + +type RequestSecurityTokenResponse struct { + Text string `xml:",chardata"` + Lifetime Lifetime `xml:"Lifetime"` + AppliesTo AppliesTo `xml:"AppliesTo"` + RequestedSecurityToken RequestedSecurityToken `xml:"RequestedSecurityToken"` + RequestedAttachedReference RequestedAttachedReference `xml:"RequestedAttachedReference"` + RequestedUnattachedReference RequestedUnattachedReference `xml:"RequestedUnattachedReference"` + TokenType Text `xml:"TokenType"` + RequestType Text `xml:"RequestType"` + KeyType Text `xml:"KeyType"` +} + +type Lifetime struct { + Text string `xml:",chardata"` + Created WSUTimestamp `xml:"Created"` + Expires WSUTimestamp `xml:"Expires"` +} + +type WSUTimestamp struct { + Text string `xml:",chardata"` + Wsu string `xml:"wsu,attr"` +} + +type AppliesTo struct { + Text string `xml:",chardata"` + Wsp string `xml:"wsp,attr"` + EndpointReference EndpointReference `xml:"EndpointReference"` +} + +type EndpointReference struct { + Text string `xml:",chardata"` + Wsa string `xml:"wsa,attr"` + Address Text `xml:"Address"` +} + +type RequestedSecurityToken struct { + Text string `xml:",chardata"` + AssertionRawXML string `xml:",innerxml"` + Assertion Assertion `xml:"Assertion"` +} + +type Assertion struct { + XMLName xml.Name // Normally its `xml:"Assertion"`, but I think they want to capture the xmlns + Text string `xml:",chardata"` + MajorVersion string `xml:"MajorVersion,attr"` + MinorVersion string `xml:"MinorVersion,attr"` + AssertionID string `xml:"AssertionID,attr"` + Issuer string `xml:"Issuer,attr"` + IssueInstant string `xml:"IssueInstant,attr"` + Saml string `xml:"saml,attr"` + Conditions Conditions `xml:"Conditions"` + AttributeStatement AttributeStatement `xml:"AttributeStatement"` + AuthenticationStatement AuthenticationStatement `xml:"AuthenticationStatement"` + Signature Signature `xml:"Signature"` +} + +type Conditions struct { + Text string `xml:",chardata"` + NotBefore string `xml:"NotBefore,attr"` + NotOnOrAfter string `xml:"NotOnOrAfter,attr"` + AudienceRestrictionCondition AudienceRestrictionCondition `xml:"AudienceRestrictionCondition"` +} + +type AudienceRestrictionCondition struct { + Text string `xml:",chardata"` + Audience Text `xml:"Audience"` +} + +type AttributeStatement struct { + Text string `xml:",chardata"` + Subject Subject `xml:"Subject"` + Attribute []Attribute `xml:"Attribute"` +} + +type Subject struct { + Text string `xml:",chardata"` + NameIdentifier NameIdentifier `xml:"NameIdentifier"` + SubjectConfirmation SubjectConfirmation `xml:"SubjectConfirmation"` +} + +type NameIdentifier struct { + Text string `xml:",chardata"` + Format string `xml:"Format,attr"` +} + +type SubjectConfirmation struct { + Text string `xml:",chardata"` + ConfirmationMethod Text `xml:"ConfirmationMethod"` +} + +type Attribute struct { + Text string `xml:",chardata"` + AttributeName string `xml:"AttributeName,attr"` + AttributeNamespace string `xml:"AttributeNamespace,attr"` + AttributeValue Text `xml:"AttributeValue"` +} + +type AuthenticationStatement struct { + Text string `xml:",chardata"` + AuthenticationMethod string `xml:"AuthenticationMethod,attr"` + AuthenticationInstant string `xml:"AuthenticationInstant,attr"` + Subject Subject `xml:"Subject"` +} + +type Signature struct { + Text string `xml:",chardata"` + Ds string `xml:"ds,attr"` + SignedInfo SignedInfo `xml:"SignedInfo"` + SignatureValue Text `xml:"SignatureValue"` + KeyInfo KeyInfo `xml:"KeyInfo"` +} + +type SignedInfo struct { + Text string `xml:",chardata"` + CanonicalizationMethod Method `xml:"CanonicalizationMethod"` + SignatureMethod Method `xml:"SignatureMethod"` + Reference Reference `xml:"Reference"` +} + +type Method struct { + Text string `xml:",chardata"` + Algorithm string `xml:"Algorithm,attr"` +} + +type Reference struct { + Text string `xml:",chardata"` + URI string `xml:"URI,attr"` + Transforms Transforms `xml:"Transforms"` + DigestMethod Method `xml:"DigestMethod"` + DigestValue Text `xml:"DigestValue"` +} + +type Transforms struct { + Text string `xml:",chardata"` + Transform []Method `xml:"Transform"` +} + +type KeyInfo struct { + Text string `xml:",chardata"` + Xmlns string `xml:"xmlns,attr"` + X509Data X509Data `xml:"X509Data"` +} + +type X509Data struct { + Text string `xml:",chardata"` + X509Certificate Text `xml:"X509Certificate"` +} + +type RequestedAttachedReference struct { + Text string `xml:",chardata"` + SecurityTokenReference SecurityTokenReference `xml:"SecurityTokenReference"` +} + +type SecurityTokenReference struct { + Text string `xml:",chardata"` + TokenType string `xml:"TokenType,attr"` + O string `xml:"o,attr"` + K string `xml:"k,attr"` + KeyIdentifier KeyIdentifier `xml:"KeyIdentifier"` +} + +type KeyIdentifier struct { + Text string `xml:",chardata"` + ValueType string `xml:"ValueType,attr"` +} + +type RequestedUnattachedReference struct { + Text string `xml:",chardata"` + SecurityTokenReference SecurityTokenReference `xml:"SecurityTokenReference"` +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/version_string.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/version_string.go new file mode 100644 index 000000000..6fe5efa8a --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/version_string.go @@ -0,0 +1,25 @@ +// Code generated by "stringer -type=Version"; DO NOT EDIT. + +package defs + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[TrustUnknown-0] + _ = x[Trust2005-1] + _ = x[Trust13-2] +} + +const _Version_name = "TrustUnknownTrust2005Trust13" + +var _Version_index = [...]uint8{0, 12, 21, 28} + +func (i Version) String() string { + if i < 0 || i >= Version(len(_Version_index)-1) { + return "Version(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Version_name[_Version_index[i]:_Version_index[i+1]] +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_endpoint.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_endpoint.go new file mode 100644 index 000000000..8fad5efb5 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_endpoint.go @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package defs + +import ( + "encoding/xml" + "fmt" + "time" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + uuid "github.com/google/uuid" +) + +//go:generate stringer -type=Version + +type Version int + +const ( + TrustUnknown Version = iota + Trust2005 + Trust13 +) + +// Endpoint represents a WSTrust endpoint. +type Endpoint struct { + // Version is the version of the endpoint. + Version Version + // URL is the URL of the endpoint. + URL string +} + +type wsTrustTokenRequestEnvelope struct { + XMLName xml.Name `xml:"s:Envelope"` + Text string `xml:",chardata"` + S string `xml:"xmlns:s,attr"` + Wsa string `xml:"xmlns:wsa,attr"` + Wsu string `xml:"xmlns:wsu,attr"` + Header struct { + Text string `xml:",chardata"` + Action struct { + Text string `xml:",chardata"` + MustUnderstand string `xml:"s:mustUnderstand,attr"` + } `xml:"wsa:Action"` + MessageID struct { + Text string `xml:",chardata"` + } `xml:"wsa:messageID"` + ReplyTo struct { + Text string `xml:",chardata"` + Address struct { + Text string `xml:",chardata"` + } `xml:"wsa:Address"` + } `xml:"wsa:ReplyTo"` + To struct { + Text string `xml:",chardata"` + MustUnderstand string `xml:"s:mustUnderstand,attr"` + } `xml:"wsa:To"` + Security struct { + Text string `xml:",chardata"` + MustUnderstand string `xml:"s:mustUnderstand,attr"` + Wsse string `xml:"xmlns:wsse,attr"` + Timestamp struct { + Text string `xml:",chardata"` + ID string `xml:"wsu:Id,attr"` + Created struct { + Text string `xml:",chardata"` + } `xml:"wsu:Created"` + Expires struct { + Text string `xml:",chardata"` + } `xml:"wsu:Expires"` + } `xml:"wsu:Timestamp"` + UsernameToken struct { + Text string `xml:",chardata"` + ID string `xml:"wsu:Id,attr"` + Username struct { + Text string `xml:",chardata"` + } `xml:"wsse:Username"` + Password struct { + Text string `xml:",chardata"` + } `xml:"wsse:Password"` + } `xml:"wsse:UsernameToken"` + } `xml:"wsse:Security"` + } `xml:"s:Header"` + Body struct { + Text string `xml:",chardata"` + RequestSecurityToken struct { + Text string `xml:",chardata"` + Wst string `xml:"xmlns:wst,attr"` + AppliesTo struct { + Text string `xml:",chardata"` + Wsp string `xml:"xmlns:wsp,attr"` + EndpointReference struct { + Text string `xml:",chardata"` + Address struct { + Text string `xml:",chardata"` + } `xml:"wsa:Address"` + } `xml:"wsa:EndpointReference"` + } `xml:"wsp:AppliesTo"` + KeyType struct { + Text string `xml:",chardata"` + } `xml:"wst:KeyType"` + RequestType struct { + Text string `xml:",chardata"` + } `xml:"wst:RequestType"` + } `xml:"wst:RequestSecurityToken"` + } `xml:"s:Body"` +} + +func buildTimeString(t time.Time) string { + // Golang time formats are weird: https://stackoverflow.com/questions/20234104/how-to-format-current-time-using-a-yyyymmddhhmmss-format + return t.Format("2006-01-02T15:04:05.000Z") +} + +func (wte *Endpoint) buildTokenRequestMessage(authType authority.AuthorizeType, cloudAudienceURN string, username string, password string) (string, error) { + var soapAction string + var trustNamespace string + var keyType string + var requestType string + + createdTime := time.Now().UTC() + expiresTime := createdTime.Add(10 * time.Minute) + + switch wte.Version { + case Trust2005: + soapAction = trust2005Spec + trustNamespace = "http://schemas.xmlsoap.org/ws/2005/02/trust" + keyType = "http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey" + requestType = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue" + case Trust13: + soapAction = trust13Spec + trustNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512" + keyType = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer" + requestType = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue" + default: + return "", fmt.Errorf("buildTokenRequestMessage had Version == %q, which is not recognized", wte.Version) + } + + var envelope wsTrustTokenRequestEnvelope + + messageUUID := uuid.New() + + envelope.S = "http://www.w3.org/2003/05/soap-envelope" + envelope.Wsa = "http://www.w3.org/2005/08/addressing" + envelope.Wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" + + envelope.Header.Action.MustUnderstand = "1" + envelope.Header.Action.Text = soapAction + envelope.Header.MessageID.Text = "urn:uuid:" + messageUUID.String() + envelope.Header.ReplyTo.Address.Text = "http://www.w3.org/2005/08/addressing/anonymous" + envelope.Header.To.MustUnderstand = "1" + envelope.Header.To.Text = wte.URL + + switch authType { + case authority.ATUnknown: + return "", fmt.Errorf("buildTokenRequestMessage had no authority type(%v)", authType) + case authority.ATUsernamePassword: + endpointUUID := uuid.New() + + var trustID string + if wte.Version == Trust2005 { + trustID = "UnPwSecTok2005-" + endpointUUID.String() + } else { + trustID = "UnPwSecTok13-" + endpointUUID.String() + } + + envelope.Header.Security.MustUnderstand = "1" + envelope.Header.Security.Wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" + envelope.Header.Security.Timestamp.ID = "MSATimeStamp" + envelope.Header.Security.Timestamp.Created.Text = buildTimeString(createdTime) + envelope.Header.Security.Timestamp.Expires.Text = buildTimeString(expiresTime) + envelope.Header.Security.UsernameToken.ID = trustID + envelope.Header.Security.UsernameToken.Username.Text = username + envelope.Header.Security.UsernameToken.Password.Text = password + default: + // This is just to note that we don't do anything for other cases. + // We aren't missing anything I know of. + } + + envelope.Body.RequestSecurityToken.Wst = trustNamespace + envelope.Body.RequestSecurityToken.AppliesTo.Wsp = "http://schemas.xmlsoap.org/ws/2004/09/policy" + envelope.Body.RequestSecurityToken.AppliesTo.EndpointReference.Address.Text = cloudAudienceURN + envelope.Body.RequestSecurityToken.KeyType.Text = keyType + envelope.Body.RequestSecurityToken.RequestType.Text = requestType + + output, err := xml.Marshal(envelope) + if err != nil { + return "", err + } + + return string(output), nil +} + +func (wte *Endpoint) BuildTokenRequestMessageWIA(cloudAudienceURN string) (string, error) { + return wte.buildTokenRequestMessage(authority.ATWindowsIntegrated, cloudAudienceURN, "", "") +} + +func (wte *Endpoint) BuildTokenRequestMessageUsernamePassword(cloudAudienceURN string, username string, password string) (string, error) { + return wte.buildTokenRequestMessage(authority.ATUsernamePassword, cloudAudienceURN, username, password) +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_mex_document.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_mex_document.go new file mode 100644 index 000000000..e3d19886e --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs/wstrust_mex_document.go @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package defs + +import ( + "errors" + "fmt" + "strings" +) + +//go:generate stringer -type=endpointType + +type endpointType int + +const ( + etUnknown endpointType = iota + etUsernamePassword + etWindowsTransport +) + +type wsEndpointData struct { + Version Version + EndpointType endpointType +} + +const trust13Spec string = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue" +const trust2005Spec string = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue" + +type MexDocument struct { + UsernamePasswordEndpoint Endpoint + WindowsTransportEndpoint Endpoint + policies map[string]endpointType + bindings map[string]wsEndpointData +} + +func updateEndpoint(cached *Endpoint, found Endpoint) { + if cached == nil || cached.Version == TrustUnknown { + *cached = found + return + } + if (*cached).Version == Trust2005 && found.Version == Trust13 { + *cached = found + return + } +} + +// TODO(msal): Someone needs to write tests for everything below. + +// NewFromDef creates a new MexDocument. +func NewFromDef(defs Definitions) (MexDocument, error) { + policies, err := policies(defs) + if err != nil { + return MexDocument{}, err + } + + bindings, err := bindings(defs, policies) + if err != nil { + return MexDocument{}, err + } + + userPass, windows, err := endpoints(defs, bindings) + if err != nil { + return MexDocument{}, err + } + + return MexDocument{ + UsernamePasswordEndpoint: userPass, + WindowsTransportEndpoint: windows, + policies: policies, + bindings: bindings, + }, nil +} + +func policies(defs Definitions) (map[string]endpointType, error) { + policies := make(map[string]endpointType, len(defs.Policy)) + + for _, policy := range defs.Policy { + if policy.ExactlyOne.All.NegotiateAuthentication.XMLName.Local != "" { + if policy.ExactlyOne.All.TransportBinding.SP != "" && policy.ID != "" { + policies["#"+policy.ID] = etWindowsTransport + } + } + + if policy.ExactlyOne.All.SignedEncryptedSupportingTokens.Policy.UsernameToken.Policy.WSSUsernameToken10.XMLName.Local != "" { + if policy.ExactlyOne.All.TransportBinding.SP != "" && policy.ID != "" { + policies["#"+policy.ID] = etUsernamePassword + } + } + if policy.ExactlyOne.All.SignedSupportingTokens.Policy.UsernameToken.Policy.WSSUsernameToken10.XMLName.Local != "" { + if policy.ExactlyOne.All.TransportBinding.SP != "" && policy.ID != "" { + policies["#"+policy.ID] = etUsernamePassword + } + } + } + + if len(policies) == 0 { + return policies, errors.New("no policies for mex document") + } + + return policies, nil +} + +func bindings(defs Definitions, policies map[string]endpointType) (map[string]wsEndpointData, error) { + bindings := make(map[string]wsEndpointData, len(defs.Binding)) + + for _, binding := range defs.Binding { + policyName := binding.PolicyReference.URI + transport := binding.Binding.Transport + + if transport == "http://schemas.xmlsoap.org/soap/http" { + if policy, ok := policies[policyName]; ok { + bindingName := binding.Name + specVersion := binding.Operation.Operation.SoapAction + + if specVersion == trust13Spec { + bindings[bindingName] = wsEndpointData{Trust13, policy} + } else if specVersion == trust2005Spec { + bindings[bindingName] = wsEndpointData{Trust2005, policy} + } else { + return nil, errors.New("found unknown spec version in mex document") + } + } + } + } + return bindings, nil +} + +func endpoints(defs Definitions, bindings map[string]wsEndpointData) (userPass, windows Endpoint, err error) { + for _, port := range defs.Service.Port { + bindingName := port.Binding + + index := strings.Index(bindingName, ":") + if index != -1 { + bindingName = bindingName[index+1:] + } + + if binding, ok := bindings[bindingName]; ok { + url := strings.TrimSpace(port.EndpointReference.Address.Text) + if url == "" { + return Endpoint{}, Endpoint{}, fmt.Errorf("MexDocument cannot have blank URL endpoint") + } + if binding.Version == TrustUnknown { + return Endpoint{}, Endpoint{}, fmt.Errorf("endpoint version unknown") + } + endpoint := Endpoint{Version: binding.Version, URL: url} + + switch binding.EndpointType { + case etUsernamePassword: + updateEndpoint(&userPass, endpoint) + case etWindowsTransport: + updateEndpoint(&windows, endpoint) + default: + return Endpoint{}, Endpoint{}, errors.New("found unknown port type in MEX document") + } + } + } + return userPass, windows, nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/wstrust.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/wstrust.go new file mode 100644 index 000000000..47cd4c692 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/wstrust.go @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package wstrust provides a client for communicating with a WSTrust (https://en.wikipedia.org/wiki/WS-Trust#:~:text=WS%2DTrust%20is%20a%20WS,in%20a%20secure%20message%20exchange.) +for the purposes of extracting metadata from the service. This data can be used to acquire +tokens using the accesstokens.Client.GetAccessTokenFromSamlGrant() call. +*/ +package wstrust + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs" +) + +type xmlCaller interface { + XMLCall(ctx context.Context, endpoint string, headers http.Header, qv url.Values, resp interface{}) error + SOAPCall(ctx context.Context, endpoint, action string, headers http.Header, qv url.Values, body string, resp interface{}) error +} + +type SamlTokenInfo struct { + AssertionType string // Should be either constants SAMLV1Grant or SAMLV2Grant. + Assertion string +} + +// Client represents the REST calls to get tokens from token generator backends. +type Client struct { + // Comm provides the HTTP transport client. + Comm xmlCaller +} + +// TODO(msal): This allows me to call Mex without having a real Def file on line 45. +// This would fail because policies() would not find a policy. This is easy enough to +// fix in test data, but.... Definitions is defined with built in structs. That needs +// to be pulled apart and until then I have this hack in. +var newFromDef = defs.NewFromDef + +// Mex provides metadata about a wstrust service. +func (c Client) Mex(ctx context.Context, federationMetadataURL string) (defs.MexDocument, error) { + resp := defs.Definitions{} + err := c.Comm.XMLCall( + ctx, + federationMetadataURL, + http.Header{}, + nil, + &resp, + ) + if err != nil { + return defs.MexDocument{}, err + } + + return newFromDef(resp) +} + +const ( + SoapActionDefault = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue" + + // Note: Commented out because this action is not supported. It was in the original code + // but only used in a switch where it errored. Since there was only one value, a default + // worked better. However, buildTokenRequestMessage() had 2005 support. I'm not actually + // sure what's going on here. It like we have half support. For now this is here just + // for documentation purposes in case we are going to add support. + // + // SoapActionWSTrust2005 = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue" +) + +// SAMLTokenInfo provides SAML information that is used to generate a SAML token. +func (c Client) SAMLTokenInfo(ctx context.Context, authParameters authority.AuthParams, cloudAudienceURN string, endpoint defs.Endpoint) (SamlTokenInfo, error) { + var wsTrustRequestMessage string + var err error + + switch authParameters.AuthorizationType { + case authority.ATWindowsIntegrated: + wsTrustRequestMessage, err = endpoint.BuildTokenRequestMessageWIA(cloudAudienceURN) + if err != nil { + return SamlTokenInfo{}, err + } + case authority.ATUsernamePassword: + wsTrustRequestMessage, err = endpoint.BuildTokenRequestMessageUsernamePassword( + cloudAudienceURN, authParameters.Username, authParameters.Password) + if err != nil { + return SamlTokenInfo{}, err + } + default: + return SamlTokenInfo{}, fmt.Errorf("unknown auth type %v", authParameters.AuthorizationType) + } + + var soapAction string + switch endpoint.Version { + case defs.Trust13: + soapAction = SoapActionDefault + case defs.Trust2005: + return SamlTokenInfo{}, errors.New("WS Trust 2005 support is not implemented") + default: + return SamlTokenInfo{}, fmt.Errorf("the SOAP endpoint for a wstrust call had an invalid version: %v", endpoint.Version) + } + + resp := defs.SAMLDefinitions{} + err = c.Comm.SOAPCall(ctx, endpoint.URL, soapAction, http.Header{}, nil, wsTrustRequestMessage, &resp) + if err != nil { + return SamlTokenInfo{}, err + } + + return c.samlAssertion(resp) +} + +const ( + samlv1Assertion = "urn:oasis:names:tc:SAML:1.0:assertion" + samlv2Assertion = "urn:oasis:names:tc:SAML:2.0:assertion" +) + +func (c Client) samlAssertion(def defs.SAMLDefinitions) (SamlTokenInfo, error) { + for _, tokenResponse := range def.Body.RequestSecurityTokenResponseCollection.RequestSecurityTokenResponse { + token := tokenResponse.RequestedSecurityToken + if token.Assertion.XMLName.Local != "" { + assertion := token.AssertionRawXML + + samlVersion := token.Assertion.Saml + switch samlVersion { + case samlv1Assertion: + return SamlTokenInfo{AssertionType: grant.SAMLV1, Assertion: assertion}, nil + case samlv2Assertion: + return SamlTokenInfo{AssertionType: grant.SAMLV2, Assertion: assertion}, nil + } + return SamlTokenInfo{}, fmt.Errorf("couldn't parse SAML assertion, version unknown: %q", samlVersion) + } + } + return SamlTokenInfo{}, errors.New("unknown WS-Trust version") +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/resolvers.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/resolvers.go new file mode 100644 index 000000000..893ef4814 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/resolvers.go @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// TODO(msal): Write some tests. The original code this came from didn't have tests and I'm too +// tired at this point to do it. It, like many other *Manager code I found was broken because +// they didn't have mutex protection. + +package oauth + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" +) + +// ADFS is an active directory federation service authority type. +const ADFS = "ADFS" + +type cacheEntry struct { + Endpoints authority.Endpoints + ValidForDomainsInList map[string]bool +} + +func createcacheEntry(endpoints authority.Endpoints) cacheEntry { + return cacheEntry{endpoints, map[string]bool{}} +} + +// AuthorityEndpoint retrieves endpoints from an authority for auth and token acquisition. +type authorityEndpoint struct { + rest *ops.REST + + mu sync.Mutex + cache map[string]cacheEntry +} + +// newAuthorityEndpoint is the constructor for AuthorityEndpoint. +func newAuthorityEndpoint(rest *ops.REST) *authorityEndpoint { + m := &authorityEndpoint{rest: rest, cache: map[string]cacheEntry{}} + return m +} + +// ResolveEndpoints gets the authorization and token endpoints and creates an AuthorityEndpoints instance +func (m *authorityEndpoint) ResolveEndpoints(ctx context.Context, authorityInfo authority.Info, userPrincipalName string) (authority.Endpoints, error) { + if authorityInfo.AuthorityType == ADFS && len(userPrincipalName) == 0 { + return authority.Endpoints{}, errors.New("UPN required for authority validation for ADFS") + } + + if endpoints, found := m.cachedEndpoints(authorityInfo, userPrincipalName); found { + return endpoints, nil + } + + endpoint, err := m.openIDConfigurationEndpoint(ctx, authorityInfo, userPrincipalName) + if err != nil { + return authority.Endpoints{}, err + } + + resp, err := m.rest.Authority().GetTenantDiscoveryResponse(ctx, endpoint) + if err != nil { + return authority.Endpoints{}, err + } + if err := resp.Validate(); err != nil { + return authority.Endpoints{}, fmt.Errorf("ResolveEndpoints(): %w", err) + } + + tenant := authorityInfo.Tenant + + endpoints := authority.NewEndpoints( + strings.Replace(resp.AuthorizationEndpoint, "{tenant}", tenant, -1), + strings.Replace(resp.TokenEndpoint, "{tenant}", tenant, -1), + strings.Replace(resp.Issuer, "{tenant}", tenant, -1), + authorityInfo.Host) + + m.addCachedEndpoints(authorityInfo, userPrincipalName, endpoints) + + return endpoints, nil +} + +// cachedEndpoints returns a the cached endpoints if they exists. If not, we return false. +func (m *authorityEndpoint) cachedEndpoints(authorityInfo authority.Info, userPrincipalName string) (authority.Endpoints, bool) { + m.mu.Lock() + defer m.mu.Unlock() + + if cacheEntry, ok := m.cache[authorityInfo.CanonicalAuthorityURI]; ok { + if authorityInfo.AuthorityType == ADFS { + domain, err := adfsDomainFromUpn(userPrincipalName) + if err == nil { + if _, ok := cacheEntry.ValidForDomainsInList[domain]; ok { + return cacheEntry.Endpoints, true + } + } + } + return cacheEntry.Endpoints, true + } + return authority.Endpoints{}, false +} + +func (m *authorityEndpoint) addCachedEndpoints(authorityInfo authority.Info, userPrincipalName string, endpoints authority.Endpoints) { + m.mu.Lock() + defer m.mu.Unlock() + + updatedCacheEntry := createcacheEntry(endpoints) + + if authorityInfo.AuthorityType == ADFS { + // Since we're here, we've made a call to the backend. We want to ensure we're caching + // the latest values from the server. + if cacheEntry, ok := m.cache[authorityInfo.CanonicalAuthorityURI]; ok { + for k := range cacheEntry.ValidForDomainsInList { + updatedCacheEntry.ValidForDomainsInList[k] = true + } + } + domain, err := adfsDomainFromUpn(userPrincipalName) + if err == nil { + updatedCacheEntry.ValidForDomainsInList[domain] = true + } + } + + m.cache[authorityInfo.CanonicalAuthorityURI] = updatedCacheEntry +} + +func (m *authorityEndpoint) openIDConfigurationEndpoint(ctx context.Context, authorityInfo authority.Info, userPrincipalName string) (string, error) { + if authorityInfo.Tenant == "adfs" { + return fmt.Sprintf("https://%s/adfs/.well-known/openid-configuration", authorityInfo.Host), nil + } else if authorityInfo.ValidateAuthority && !authority.TrustedHost(authorityInfo.Host) { + resp, err := m.rest.Authority().AADInstanceDiscovery(ctx, authorityInfo) + if err != nil { + return "", err + } + return resp.TenantDiscoveryEndpoint, nil + } else if authorityInfo.Region != "" { + resp, err := m.rest.Authority().AADInstanceDiscovery(ctx, authorityInfo) + if err != nil { + return "", err + } + return resp.TenantDiscoveryEndpoint, nil + + } + + return authorityInfo.CanonicalAuthorityURI + "v2.0/.well-known/openid-configuration", nil +} + +func adfsDomainFromUpn(userPrincipalName string) (string, error) { + parts := strings.Split(userPrincipalName, "@") + if len(parts) < 2 { + return "", errors.New("no @ present in user principal name") + } + return parts[1], nil +} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared/shared.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared/shared.go new file mode 100644 index 000000000..f7e12a71b --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared/shared.go @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package shared + +import ( + "net/http" + "reflect" + "strings" +) + +const ( + // CacheKeySeparator is used in creating the keys of the cache. + CacheKeySeparator = "-" +) + +type Account struct { + HomeAccountID string `json:"home_account_id,omitempty"` + Environment string `json:"environment,omitempty"` + Realm string `json:"realm,omitempty"` + LocalAccountID string `json:"local_account_id,omitempty"` + AuthorityType string `json:"authority_type,omitempty"` + PreferredUsername string `json:"username,omitempty"` + GivenName string `json:"given_name,omitempty"` + FamilyName string `json:"family_name,omitempty"` + MiddleName string `json:"middle_name,omitempty"` + Name string `json:"name,omitempty"` + AlternativeID string `json:"alternative_account_id,omitempty"` + RawClientInfo string `json:"client_info,omitempty"` + UserAssertionHash string `json:"user_assertion_hash,omitempty"` + + AdditionalFields map[string]interface{} +} + +// NewAccount creates an account. +func NewAccount(homeAccountID, env, realm, localAccountID, authorityType, username string) Account { + return Account{ + HomeAccountID: homeAccountID, + Environment: env, + Realm: realm, + LocalAccountID: localAccountID, + AuthorityType: authorityType, + PreferredUsername: username, + } +} + +// Key creates the key for storing accounts in the cache. +func (acc Account) Key() string { + return strings.Join([]string{acc.HomeAccountID, acc.Environment, acc.Realm}, CacheKeySeparator) +} + +// IsZero checks the zero value of account. +func (acc Account) IsZero() bool { + v := reflect.ValueOf(acc) + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if !field.IsZero() { + switch field.Kind() { + case reflect.Map, reflect.Slice: + if field.Len() == 0 { + continue + } + } + return false + } + } + return true +} + +// DefaultClient is our default shared HTTP client. +var DefaultClient = &http.Client{} diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/version/version.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/version/version.go new file mode 100644 index 000000000..5e1ea9129 --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/version/version.go @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Package version keeps the version number of the client package. +package version + +// Version is the version of this client package that is communicated to the server. +const Version = "0.7.0" diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/public/public.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/public/public.go new file mode 100644 index 000000000..19118c25a --- /dev/null +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/public/public.go @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/* +Package public provides a client for authentication of "public" applications. A "public" +application is defined as an app that runs on client devices (android, ios, windows, linux, ...). +These devices are "untrusted" and access resources via web APIs that must authenticate. +*/ +package public + +/* +Design note: + +public.Client uses client.Base as an embedded type. client.Base statically assigns its attributes +during creation. As it doesn't have any pointers in it, anything borrowed from it, such as +Base.AuthParams is a copy that is free to be manipulated here. +*/ + +// TODO(msal): This should have example code for each method on client using Go's example doc framework. +// base usage details should be includee in the package documentation. + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "fmt" + "net/url" + "strconv" + + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority" + "github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared" + "github.com/google/uuid" + "github.com/pkg/browser" +) + +// AuthResult contains the results of one token acquisition operation. +// For details see https://aka.ms/msal-net-authenticationresult +type AuthResult = base.AuthResult + +type Account = shared.Account + +// Options configures the Client's behavior. +type Options struct { + // Accessor controls cache persistence. By default there is no cache persistence. + // This can be set with the WithCache() option. + Accessor cache.ExportReplace + + // The host of the Azure Active Directory authority. The default is https://login.microsoftonline.com/common. + // This can be changed with the WithAuthority() option. + Authority string + + // The HTTP client used for making requests. + // It defaults to a shared http.Client. + HTTPClient ops.HTTPClient +} + +func (p *Options) validate() error { + u, err := url.Parse(p.Authority) + if err != nil { + return fmt.Errorf("Authority options cannot be URL parsed: %w", err) + } + if u.Scheme != "https" { + return fmt.Errorf("Authority(%s) did not start with https://", u.String()) + } + return nil +} + +// Option is an optional argument to the New constructor. +type Option func(o *Options) + +// WithAuthority allows for a custom authority to be set. This must be a valid https url. +func WithAuthority(authority string) Option { + return func(o *Options) { + o.Authority = authority + } +} + +// WithCache allows you to set some type of cache for storing authentication tokens. +func WithCache(accessor cache.ExportReplace) Option { + return func(o *Options) { + o.Accessor = accessor + } +} + +// WithHTTPClient allows for a custom HTTP client to be set. +func WithHTTPClient(httpClient ops.HTTPClient) Option { + return func(o *Options) { + o.HTTPClient = httpClient + } +} + +// Client is a representation of authentication client for public applications as defined in the +// package doc. For more information, visit https://docs.microsoft.com/azure/active-directory/develop/msal-client-applications. +type Client struct { + base base.Client +} + +// New is the constructor for Client. +func New(clientID string, options ...Option) (Client, error) { + opts := Options{ + Authority: base.AuthorityPublicCloud, + HTTPClient: shared.DefaultClient, + } + + for _, o := range options { + o(&opts) + } + if err := opts.validate(); err != nil { + return Client{}, err + } + + base, err := base.New(clientID, opts.Authority, oauth.New(opts.HTTPClient), base.WithCacheAccessor(opts.Accessor)) + if err != nil { + return Client{}, err + } + return Client{base}, nil +} + +// CreateAuthCodeURL creates a URL used to acquire an authorization code. +func (pca Client) CreateAuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string) (string, error) { + return pca.base.AuthCodeURL(ctx, clientID, redirectURI, scopes, pca.base.AuthParams) +} + +// AcquireTokenSilentOptions are all the optional settings to an AcquireTokenSilent() call. +// These are set by using various AcquireTokenSilentOption functions. +type AcquireTokenSilentOptions struct { + // Account represents the account to use. To set, use the WithSilentAccount() option. + Account Account +} + +// AcquireTokenSilentOption changes options inside AcquireTokenSilentOptions used in .AcquireTokenSilent(). +type AcquireTokenSilentOption func(a *AcquireTokenSilentOptions) + +// WithSilentAccount uses the passed account during an AcquireTokenSilent() call. +func WithSilentAccount(account Account) AcquireTokenSilentOption { + return func(a *AcquireTokenSilentOptions) { + a.Account = account + } +} + +// AcquireTokenSilent acquires a token from either the cache or using a refresh token. +func (pca Client) AcquireTokenSilent(ctx context.Context, scopes []string, options ...AcquireTokenSilentOption) (AuthResult, error) { + opts := AcquireTokenSilentOptions{} + for _, o := range options { + o(&opts) + } + + silentParameters := base.AcquireTokenSilentParameters{ + Scopes: scopes, + Account: opts.Account, + RequestType: accesstokens.ATPublic, + IsAppCache: false, + } + + return pca.base.AcquireTokenSilent(ctx, silentParameters) +} + +// AcquireTokenByUsernamePassword acquires a security token from the authority, via Username/Password Authentication. +// NOTE: this flow is NOT recommended. +func (pca Client) AcquireTokenByUsernamePassword(ctx context.Context, scopes []string, username string, password string) (AuthResult, error) { + authParams := pca.base.AuthParams + authParams.Scopes = scopes + authParams.AuthorizationType = authority.ATUsernamePassword + authParams.Username = username + authParams.Password = password + + token, err := pca.base.Token.UsernamePassword(ctx, authParams) + if err != nil { + return AuthResult{}, err + } + return pca.base.AuthResultFromToken(ctx, authParams, token, true) +} + +type DeviceCodeResult = accesstokens.DeviceCodeResult + +// DeviceCode provides the results of the device code flows first stage (containing the code) +// that must be entered on the second device and provides a method to retrieve the AuthenticationResult +// once that code has been entered and verified. +type DeviceCode struct { + // Result holds the information about the device code (such as the code). + Result DeviceCodeResult + + authParams authority.AuthParams + client Client + dc oauth.DeviceCode +} + +// AuthenticationResult retreives the AuthenticationResult once the user enters the code +// on the second device. Until then it blocks until the .AcquireTokenByDeviceCode() context +// is cancelled or the token expires. +func (d DeviceCode) AuthenticationResult(ctx context.Context) (AuthResult, error) { + token, err := d.dc.Token(ctx) + if err != nil { + return AuthResult{}, err + } + return d.client.base.AuthResultFromToken(ctx, d.authParams, token, true) +} + +// AcquireTokenByDeviceCode acquires a security token from the authority, by acquiring a device code and using that to acquire the token. +// Users need to create an AcquireTokenDeviceCodeParameters instance and pass it in. +func (pca Client) AcquireTokenByDeviceCode(ctx context.Context, scopes []string) (DeviceCode, error) { + authParams := pca.base.AuthParams + authParams.Scopes = scopes + authParams.AuthorizationType = authority.ATDeviceCode + + dc, err := pca.base.Token.DeviceCode(ctx, authParams) + if err != nil { + return DeviceCode{}, err + } + + return DeviceCode{Result: dc.Result, authParams: authParams, client: pca, dc: dc}, nil +} + +// AcquireTokenByAuthCodeOptions contains the optional parameters used to acquire an access token using the authorization code flow. +type AcquireTokenByAuthCodeOptions struct { + Challenge string +} + +// AcquireTokenByAuthCodeOption changes options inside AcquireTokenByAuthCodeOptions used in .AcquireTokenByAuthCode(). +type AcquireTokenByAuthCodeOption func(a *AcquireTokenByAuthCodeOptions) + +// WithChallenge allows you to provide a code for the .AcquireTokenByAuthCode() call. +func WithChallenge(challenge string) AcquireTokenByAuthCodeOption { + return func(a *AcquireTokenByAuthCodeOptions) { + a.Challenge = challenge + } +} + +// AcquireTokenByAuthCode is a request to acquire a security token from the authority, using an authorization code. +// The specified redirect URI must be the same URI that was used when the authorization code was requested. +func (pca Client) AcquireTokenByAuthCode(ctx context.Context, code string, redirectURI string, scopes []string, options ...AcquireTokenByAuthCodeOption) (AuthResult, error) { + opts := AcquireTokenByAuthCodeOptions{} + for _, o := range options { + o(&opts) + } + + params := base.AcquireTokenAuthCodeParameters{ + Scopes: scopes, + Code: code, + Challenge: opts.Challenge, + AppType: accesstokens.ATPublic, + RedirectURI: redirectURI, + } + + return pca.base.AcquireTokenByAuthCode(ctx, params) +} + +// Accounts gets all the accounts in the token cache. +// If there are no accounts in the cache the returned slice is empty. +func (pca Client) Accounts() []Account { + return pca.base.AllAccounts() +} + +// RemoveAccount signs the account out and forgets account from token cache. +func (pca Client) RemoveAccount(account Account) error { + pca.base.RemoveAccount(account) + return nil +} + +// InteractiveAuthOptions contains the optional parameters used to acquire an access token for interactive auth code flow. +type InteractiveAuthOptions struct { + // Used to specify a custom port for the local server. http://localhost:portnumber + // All other URI components are ignored. + RedirectURI string +} + +// InteractiveAuthOption changes options inside InteractiveAuthOptions used in .AcquireTokenInteractive(). +type InteractiveAuthOption func(*InteractiveAuthOptions) + +// WithRedirectURI uses the specified redirect URI for interactive auth. +func WithRedirectURI(redirectURI string) InteractiveAuthOption { + return func(o *InteractiveAuthOptions) { + o.RedirectURI = redirectURI + } +} + +// AcquireTokenInteractive acquires a security token from the authority using the default web browser to select the account. +// https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#interactive-and-non-interactive-authentication +func (pca Client) AcquireTokenInteractive(ctx context.Context, scopes []string, options ...InteractiveAuthOption) (AuthResult, error) { + opts := InteractiveAuthOptions{} + for _, opt := range options { + opt(&opts) + } + // the code verifier is a random 32-byte sequence that's been base-64 encoded without padding. + // it's used to prevent MitM attacks during auth code flow, see https://tools.ietf.org/html/rfc7636 + cv, challenge, err := codeVerifier() + if err != nil { + return AuthResult{}, err + } + var redirectURL *url.URL + if opts.RedirectURI != "" { + redirectURL, err = url.Parse(opts.RedirectURI) + if err != nil { + return AuthResult{}, err + } + } + authParams := pca.base.AuthParams // This is a copy, as we dont' have a pointer receiver and .AuthParams is not a pointer. + authParams.Scopes = scopes + authParams.AuthorizationType = authority.ATInteractive + authParams.CodeChallenge = challenge + authParams.CodeChallengeMethod = "S256" + authParams.State = uuid.New().String() + authParams.Prompt = "select_account" + res, err := pca.browserLogin(ctx, redirectURL, authParams) + if err != nil { + return AuthResult{}, err + } + authParams.Redirecturi = res.redirectURI + + req, err := accesstokens.NewCodeChallengeRequest(authParams, accesstokens.ATPublic, nil, res.authCode, cv) + if err != nil { + return AuthResult{}, err + } + + token, err := pca.base.Token.AuthCode(ctx, req) + if err != nil { + return AuthResult{}, err + } + + return pca.base.AuthResultFromToken(ctx, authParams, token, true) +} + +type interactiveAuthResult struct { + authCode string + redirectURI string +} + +// provides a test hook to simulate opening a browser +var browserOpenURL = func(authURL string) error { + return browser.OpenURL(authURL) +} + +// parses the port number from the provided URL. +// returns 0 if nil or no port is specified. +func parsePort(u *url.URL) (int, error) { + if u == nil { + return 0, nil + } + p := u.Port() + if p == "" { + return 0, nil + } + return strconv.Atoi(p) +} + +// browserLogin launches the system browser for interactive login +func (pca Client) browserLogin(ctx context.Context, redirectURI *url.URL, params authority.AuthParams) (interactiveAuthResult, error) { + // start local redirect server so login can call us back + port, err := parsePort(redirectURI) + if err != nil { + return interactiveAuthResult{}, err + } + srv, err := local.New(params.State, port) + if err != nil { + return interactiveAuthResult{}, err + } + defer srv.Shutdown() + params.Scopes = accesstokens.AppendDefaultScopes(params) + authURL, err := pca.base.AuthCodeURL(ctx, params.ClientID, srv.Addr, params.Scopes, params) + if err != nil { + return interactiveAuthResult{}, err + } + // open browser window so user can select credentials + if err := browserOpenURL(authURL); err != nil { + return interactiveAuthResult{}, err + } + // now wait until the logic calls us back + res := srv.Result(ctx) + if res.Err != nil { + return interactiveAuthResult{}, res.Err + } + return interactiveAuthResult{ + authCode: res.Code, + redirectURI: srv.Addr, + }, nil +} + +// creates a code verifier string along with its SHA256 hash which +// is used as the challenge when requesting an auth code. +// used in interactive auth flow for PKCE. +func codeVerifier() (codeVerifier string, challenge string, err error) { + cvBytes := make([]byte, 32) + if _, err = rand.Read(cvBytes); err != nil { + return + } + codeVerifier = base64.RawURLEncoding.EncodeToString(cvBytes) + // for PKCE, create a hash of the code verifier + cvh := sha256.Sum256([]byte(codeVerifier)) + challenge = base64.RawURLEncoding.EncodeToString(cvh[:]) + return +} diff --git a/vendor/github.com/dimchansky/utfbom/.travis.yml b/vendor/github.com/dimchansky/utfbom/.travis.yml index 3512c8519..19312ee35 100644 --- a/vendor/github.com/dimchansky/utfbom/.travis.yml +++ b/vendor/github.com/dimchansky/utfbom/.travis.yml @@ -1,17 +1,28 @@ language: go +sudo: false go: - - '1.10' - - '1.11' + - 1.10.x + - 1.11.x + - 1.12.x + - 1.13.x + - 1.14.x + - 1.15.x -# sudo=false makes the build run using a container -sudo: false +cache: + directories: + - $HOME/.cache/go-build + - $HOME/gopath/pkg/mod + +env: + global: + - GO111MODULE=on before_install: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - go get golang.org/x/tools/cmd/goimports - - go get github.com/golang/lint/golint + - go get golang.org/x/lint/golint script: - gofiles=$(find ./ -name '*.go') && [ -z "$gofiles" ] || unformatted=$(goimports -l $gofiles) && [ -z "$unformatted" ] || (echo >&2 "Go files must be formatted with gofmt. Following files has problem:\n $unformatted" && false) - golint ./... # This won't break the build, just show warnings diff --git a/vendor/github.com/dimchansky/utfbom/LICENSE b/vendor/github.com/dimchansky/utfbom/LICENSE index 8dada3eda..6279cb87f 100644 --- a/vendor/github.com/dimchansky/utfbom/LICENSE +++ b/vendor/github.com/dimchansky/utfbom/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright (c) 2018-2020, Dmitrij Koniajev (dimchansky@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/golang-jwt/jwt/v4/README.md b/vendor/github.com/golang-jwt/jwt/v4/README.md index 3072d24a9..f5d551ca8 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/README.md +++ b/vendor/github.com/golang-jwt/jwt/v4/README.md @@ -36,9 +36,23 @@ The part in the middle is the interesting bit. It's called the Claims and conta This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. +## Installation Guidelines + +1. To install the jwt package, you first need to have [Go](https://go.dev/doc/install) installed, then you can use the command below to add `jwt-go` as a dependency in your Go program. + +```sh +go get -u github.com/golang-jwt/jwt/v4 +``` + +2. Import it in your code: + +```go +import "github.com/golang-jwt/jwt/v4" +``` + ## Examples -See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt) for examples of usage: +See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) for examples of usage: * [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-Parse-Hmac) * [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-New-Hmac) @@ -46,9 +60,17 @@ See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt) fo ## Extensions -This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. +This library publishes all the necessary components for adding your own signing methods or key functions. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod` or provide a `jwt.Keyfunc`. + +A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs) or to implement additional standards. -Here's an example of an extension that integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS): https://github.com/someone1/gcp-jwt-go +| Extension | Purpose | Repo | +| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ | +| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | +| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | +| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc | + +*Disclaimer*: Unless otherwise specified, these integrations are maintained by third parties and should not be considered as a primary offer by any of the mentioned cloud providers ## Compliance @@ -112,3 +134,5 @@ This library uses descriptive error messages whenever possible. If you are not g Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt). The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation. + +[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version of the JWT logo, which is distributed under the terms of the [MIT License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt). diff --git a/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md new file mode 100644 index 000000000..b08402c34 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +As of February 2022 (and until this document is updated), the latest version `v4` is supported. + +## Reporting a Vulnerability + +If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s). + +You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem. + +## Public Discussions + +Please avoid publicly discussing a potential security vulnerability. + +Let's take this offline and find a solution first, this limits the potential impact as much as possible. + +We appreciate your help! diff --git a/vendor/github.com/golang-jwt/jwt/v4/claims.go b/vendor/github.com/golang-jwt/jwt/v4/claims.go index 41cc82656..9d95cad2b 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/claims.go +++ b/vendor/github.com/golang-jwt/jwt/v4/claims.go @@ -56,17 +56,17 @@ func (c RegisteredClaims) Valid() error { // default value in Go, let's not fail the verification for them. if !c.VerifyExpiresAt(now, false) { delta := now.Sub(c.ExpiresAt.Time) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) + vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta) vErr.Errors |= ValidationErrorExpired } if !c.VerifyIssuedAt(now, false) { - vErr.Inner = fmt.Errorf("token used before issued") + vErr.Inner = ErrTokenUsedBeforeIssued vErr.Errors |= ValidationErrorIssuedAt } if !c.VerifyNotBefore(now, false) { - vErr.Inner = fmt.Errorf("token is not valid yet") + vErr.Inner = ErrTokenNotValidYet vErr.Errors |= ValidationErrorNotValidYet } @@ -149,17 +149,17 @@ func (c StandardClaims) Valid() error { // default value in Go, let's not fail the verification for them. if !c.VerifyExpiresAt(now, false) { delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) + vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta) vErr.Errors |= ValidationErrorExpired } if !c.VerifyIssuedAt(now, false) { - vErr.Inner = fmt.Errorf("token used before issued") + vErr.Inner = ErrTokenUsedBeforeIssued vErr.Errors |= ValidationErrorIssuedAt } if !c.VerifyNotBefore(now, false) { - vErr.Inner = fmt.Errorf("token is not valid yet") + vErr.Inner = ErrTokenNotValidYet vErr.Errors |= ValidationErrorNotValidYet } diff --git a/vendor/github.com/golang-jwt/jwt/v4/errors.go b/vendor/github.com/golang-jwt/jwt/v4/errors.go index b9d18e498..10ac8835c 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/errors.go +++ b/vendor/github.com/golang-jwt/jwt/v4/errors.go @@ -9,6 +9,18 @@ var ( ErrInvalidKey = errors.New("key is invalid") ErrInvalidKeyType = errors.New("key is of invalid type") ErrHashUnavailable = errors.New("the requested hash function is unavailable") + + ErrTokenMalformed = errors.New("token is malformed") + ErrTokenUnverifiable = errors.New("token is unverifiable") + ErrTokenSignatureInvalid = errors.New("token signature is invalid") + + ErrTokenInvalidAudience = errors.New("token has invalid audience") + ErrTokenExpired = errors.New("token is expired") + ErrTokenUsedBeforeIssued = errors.New("token used before issued") + ErrTokenInvalidIssuer = errors.New("token has invalid issuer") + ErrTokenNotValidYet = errors.New("token is not valid yet") + ErrTokenInvalidId = errors.New("token has invalid id") + ErrTokenInvalidClaims = errors.New("token has invalid claims") ) // The errors that might occur when parsing and validating a token @@ -62,3 +74,39 @@ func (e *ValidationError) Unwrap() error { func (e *ValidationError) valid() bool { return e.Errors == 0 } + +// Is checks if this ValidationError is of the supplied error. We are first checking for the exact error message +// by comparing the inner error message. If that fails, we compare using the error flags. This way we can use +// custom error messages (mainly for backwards compatability) and still leverage errors.Is using the global error variables. +func (e *ValidationError) Is(err error) bool { + // Check, if our inner error is a direct match + if errors.Is(errors.Unwrap(e), err) { + return true + } + + // Otherwise, we need to match using our error flags + switch err { + case ErrTokenMalformed: + return e.Errors&ValidationErrorMalformed != 0 + case ErrTokenUnverifiable: + return e.Errors&ValidationErrorUnverifiable != 0 + case ErrTokenSignatureInvalid: + return e.Errors&ValidationErrorSignatureInvalid != 0 + case ErrTokenInvalidAudience: + return e.Errors&ValidationErrorAudience != 0 + case ErrTokenExpired: + return e.Errors&ValidationErrorExpired != 0 + case ErrTokenUsedBeforeIssued: + return e.Errors&ValidationErrorIssuedAt != 0 + case ErrTokenInvalidIssuer: + return e.Errors&ValidationErrorIssuer != 0 + case ErrTokenNotValidYet: + return e.Errors&ValidationErrorNotValidYet != 0 + case ErrTokenInvalidId: + return e.Errors&ValidationErrorId != 0 + case ErrTokenInvalidClaims: + return e.Errors&ValidationErrorClaimsInvalid != 0 + } + + return false +} diff --git a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go index e7da633b9..2700d64a0 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go +++ b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go @@ -126,16 +126,19 @@ func (m MapClaims) Valid() error { now := TimeFunc().Unix() if !m.VerifyExpiresAt(now, false) { + // TODO(oxisto): this should be replaced with ErrTokenExpired vErr.Inner = errors.New("Token is expired") vErr.Errors |= ValidationErrorExpired } if !m.VerifyIssuedAt(now, false) { + // TODO(oxisto): this should be replaced with ErrTokenUsedBeforeIssued vErr.Inner = errors.New("Token used before issued") vErr.Errors |= ValidationErrorIssuedAt } if !m.VerifyNotBefore(now, false) { + // TODO(oxisto): this should be replaced with ErrTokenNotValidYet vErr.Inner = errors.New("Token is not valid yet") vErr.Errors |= ValidationErrorNotValidYet } diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go index 0fede4f15..6ea6f9527 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go +++ b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go @@ -1,6 +1,6 @@ package jwt -// ParserOption is used to implement functional-style options that modify the behaviour of the parser. To add +// ParserOption is used to implement functional-style options that modify the behavior of the parser. To add // new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that // takes a *Parser type as input and manipulates its configuration accordingly. type ParserOption func(*Parser) @@ -13,7 +13,7 @@ func WithValidMethods(methods []string) ParserOption { } } -// WithJSONNumber is an option to configure the underyling JSON parser with UseNumber +// WithJSONNumber is an option to configure the underlying JSON parser with UseNumber func WithJSONNumber() ParserOption { return func(p *Parser) { p.UseJSONNumber = true diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go index 5a8502feb..4fd6f9e61 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go +++ b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go @@ -1,3 +1,4 @@ +//go:build go1.4 // +build go1.4 package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v4/token.go b/vendor/github.com/golang-jwt/jwt/v4/token.go index 12344138b..3cb0f3f0e 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/token.go +++ b/vendor/github.com/golang-jwt/jwt/v4/token.go @@ -7,7 +7,6 @@ import ( "time" ) - // DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515 // states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations // of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global @@ -74,22 +73,19 @@ func (t *Token) SignedString(key interface{}) (string, error) { // the SignedString. func (t *Token) SigningString() (string, error) { var err error - parts := make([]string, 2) - for i := range parts { - var jsonValue []byte - if i == 0 { - if jsonValue, err = json.Marshal(t.Header); err != nil { - return "", err - } - } else { - if jsonValue, err = json.Marshal(t.Claims); err != nil { - return "", err - } - } + var jsonValue []byte - parts[i] = EncodeSegment(jsonValue) + if jsonValue, err = json.Marshal(t.Header); err != nil { + return "", err } - return strings.Join(parts, "."), nil + header := EncodeSegment(jsonValue) + + if jsonValue, err = json.Marshal(t.Claims); err != nil { + return "", err + } + claim := EncodeSegment(jsonValue) + + return strings.Join([]string{header, claim}, "."), nil } // Parse parses, validates, verifies the signature and returns the parsed token. diff --git a/vendor/github.com/golang-jwt/jwt/v4/types.go b/vendor/github.com/golang-jwt/jwt/v4/types.go index 80b1b9694..ac8e140eb 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/types.go +++ b/vendor/github.com/golang-jwt/jwt/v4/types.go @@ -49,9 +49,27 @@ func newNumericDateFromSeconds(f float64) *NumericDate { // MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch // represented in NumericDate to a byte array, using the precision specified in TimePrecision. func (date NumericDate) MarshalJSON() (b []byte, err error) { - f := float64(date.Truncate(TimePrecision).UnixNano()) / float64(time.Second) - - return []byte(strconv.FormatFloat(f, 'f', -1, 64)), nil + var prec int + if TimePrecision < time.Second { + prec = int(math.Log10(float64(time.Second) / float64(TimePrecision))) + } + truncatedDate := date.Truncate(TimePrecision) + + // For very large timestamps, UnixNano would overflow an int64, but this + // function requires nanosecond level precision, so we have to use the + // following technique to get round the issue: + // 1. Take the normal unix timestamp to form the whole number part of the + // output, + // 2. Take the result of the Nanosecond function, which retuns the offset + // within the second of the particular unix time instance, to form the + // decimal part of the output + // 3. Concatenate them to produce the final result + seconds := strconv.FormatInt(truncatedDate.Unix(), 10) + nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64) + + output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...) + + return output, nil } // UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a diff --git a/vendor/github.com/kylelemons/godebug/LICENSE b/vendor/github.com/kylelemons/godebug/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/kylelemons/godebug/diff/diff.go b/vendor/github.com/kylelemons/godebug/diff/diff.go new file mode 100644 index 000000000..200e596c6 --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/diff/diff.go @@ -0,0 +1,186 @@ +// Copyright 2013 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package diff implements a linewise diff algorithm. +package diff + +import ( + "bytes" + "fmt" + "strings" +) + +// Chunk represents a piece of the diff. A chunk will not have both added and +// deleted lines. Equal lines are always after any added or deleted lines. +// A Chunk may or may not have any lines in it, especially for the first or last +// chunk in a computation. +type Chunk struct { + Added []string + Deleted []string + Equal []string +} + +func (c *Chunk) empty() bool { + return len(c.Added) == 0 && len(c.Deleted) == 0 && len(c.Equal) == 0 +} + +// Diff returns a string containing a line-by-line unified diff of the linewise +// changes required to make A into B. Each line is prefixed with '+', '-', or +// ' ' to indicate if it should be added, removed, or is correct respectively. +func Diff(A, B string) string { + aLines := strings.Split(A, "\n") + bLines := strings.Split(B, "\n") + + chunks := DiffChunks(aLines, bLines) + + buf := new(bytes.Buffer) + for _, c := range chunks { + for _, line := range c.Added { + fmt.Fprintf(buf, "+%s\n", line) + } + for _, line := range c.Deleted { + fmt.Fprintf(buf, "-%s\n", line) + } + for _, line := range c.Equal { + fmt.Fprintf(buf, " %s\n", line) + } + } + return strings.TrimRight(buf.String(), "\n") +} + +// DiffChunks uses an O(D(N+M)) shortest-edit-script algorithm +// to compute the edits required from A to B and returns the +// edit chunks. +func DiffChunks(a, b []string) []Chunk { + // algorithm: http://www.xmailserver.org/diff2.pdf + + // We'll need these quantities a lot. + alen, blen := len(a), len(b) // M, N + + // At most, it will require len(a) deletions and len(b) additions + // to transform a into b. + maxPath := alen + blen // MAX + if maxPath == 0 { + // degenerate case: two empty lists are the same + return nil + } + + // Store the endpoint of the path for diagonals. + // We store only the a index, because the b index on any diagonal + // (which we know during the loop below) is aidx-diag. + // endpoint[maxPath] represents the 0 diagonal. + // + // Stated differently: + // endpoint[d] contains the aidx of a furthest reaching path in diagonal d + endpoint := make([]int, 2*maxPath+1) // V + + saved := make([][]int, 0, 8) // Vs + save := func() { + dup := make([]int, len(endpoint)) + copy(dup, endpoint) + saved = append(saved, dup) + } + + var editDistance int // D +dLoop: + for editDistance = 0; editDistance <= maxPath; editDistance++ { + // The 0 diag(onal) represents equality of a and b. Each diagonal to + // the left is numbered one lower, to the right is one higher, from + // -alen to +blen. Negative diagonals favor differences from a, + // positive diagonals favor differences from b. The edit distance to a + // diagonal d cannot be shorter than d itself. + // + // The iterations of this loop cover either odds or evens, but not both, + // If odd indices are inputs, even indices are outputs and vice versa. + for diag := -editDistance; diag <= editDistance; diag += 2 { // k + var aidx int // x + switch { + case diag == -editDistance: + // This is a new diagonal; copy from previous iter + aidx = endpoint[maxPath-editDistance+1] + 0 + case diag == editDistance: + // This is a new diagonal; copy from previous iter + aidx = endpoint[maxPath+editDistance-1] + 1 + case endpoint[maxPath+diag+1] > endpoint[maxPath+diag-1]: + // diagonal d+1 was farther along, so use that + aidx = endpoint[maxPath+diag+1] + 0 + default: + // diagonal d-1 was farther (or the same), so use that + aidx = endpoint[maxPath+diag-1] + 1 + } + // On diagonal d, we can compute bidx from aidx. + bidx := aidx - diag // y + // See how far we can go on this diagonal before we find a difference. + for aidx < alen && bidx < blen && a[aidx] == b[bidx] { + aidx++ + bidx++ + } + // Store the end of the current edit chain. + endpoint[maxPath+diag] = aidx + // If we've found the end of both inputs, we're done! + if aidx >= alen && bidx >= blen { + save() // save the final path + break dLoop + } + } + save() // save the current path + } + if editDistance == 0 { + return nil + } + chunks := make([]Chunk, editDistance+1) + + x, y := alen, blen + for d := editDistance; d > 0; d-- { + endpoint := saved[d] + diag := x - y + insert := diag == -d || (diag != d && endpoint[maxPath+diag-1] < endpoint[maxPath+diag+1]) + + x1 := endpoint[maxPath+diag] + var x0, xM, kk int + if insert { + kk = diag + 1 + x0 = endpoint[maxPath+kk] + xM = x0 + } else { + kk = diag - 1 + x0 = endpoint[maxPath+kk] + xM = x0 + 1 + } + y0 := x0 - kk + + var c Chunk + if insert { + c.Added = b[y0:][:1] + } else { + c.Deleted = a[x0:][:1] + } + if xM < x1 { + c.Equal = a[xM:][:x1-xM] + } + + x, y = x0, y0 + chunks[d] = c + } + if x > 0 { + chunks[0].Equal = a[:x] + } + if chunks[0].empty() { + chunks = chunks[1:] + } + if len(chunks) == 0 { + return nil + } + return chunks +} diff --git a/vendor/github.com/kylelemons/godebug/pretty/.gitignore b/vendor/github.com/kylelemons/godebug/pretty/.gitignore new file mode 100644 index 000000000..fa9a735da --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/pretty/.gitignore @@ -0,0 +1,5 @@ +*.test +*.bench +*.golden +*.txt +*.prof diff --git a/vendor/github.com/kylelemons/godebug/pretty/doc.go b/vendor/github.com/kylelemons/godebug/pretty/doc.go new file mode 100644 index 000000000..03b5718a7 --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/pretty/doc.go @@ -0,0 +1,25 @@ +// Copyright 2013 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package pretty pretty-prints Go structures. +// +// This package uses reflection to examine a Go value and can +// print out in a nice, aligned fashion. It supports three +// modes (normal, compact, and extended) for advanced use. +// +// See the Reflect and Print examples for what the output looks like. +package pretty + +// TODO: +// - Catch cycles diff --git a/vendor/github.com/kylelemons/godebug/pretty/public.go b/vendor/github.com/kylelemons/godebug/pretty/public.go new file mode 100644 index 000000000..fbc5d7abb --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/pretty/public.go @@ -0,0 +1,188 @@ +// Copyright 2013 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import ( + "bytes" + "fmt" + "io" + "net" + "reflect" + "time" + + "github.com/kylelemons/godebug/diff" +) + +// A Config represents optional configuration parameters for formatting. +// +// Some options, notably ShortList, dramatically increase the overhead +// of pretty-printing a value. +type Config struct { + // Verbosity options + Compact bool // One-line output. Overrides Diffable. + Diffable bool // Adds extra newlines for more easily diffable output. + + // Field and value options + IncludeUnexported bool // Include unexported fields in output + PrintStringers bool // Call String on a fmt.Stringer + PrintTextMarshalers bool // Call MarshalText on an encoding.TextMarshaler + SkipZeroFields bool // Skip struct fields that have a zero value. + + // Output transforms + ShortList int // Maximum character length for short lists if nonzero. + + // Type-specific overrides + // + // Formatter maps a type to a function that will provide a one-line string + // representation of the input value. Conceptually: + // Formatter[reflect.TypeOf(v)](v) = "v as a string" + // + // Note that the first argument need not explicitly match the type, it must + // merely be callable with it. + // + // When processing an input value, if its type exists as a key in Formatter: + // 1) If the value is nil, no stringification is performed. + // This allows overriding of PrintStringers and PrintTextMarshalers. + // 2) The value will be called with the input as its only argument. + // The function must return a string as its first return value. + // + // In addition to func literals, two common values for this will be: + // fmt.Sprint (function) func Sprint(...interface{}) string + // Type.String (method) func (Type) String() string + // + // Note that neither of these work if the String method is a pointer + // method and the input will be provided as a value. In that case, + // use a function that calls .String on the formal value parameter. + Formatter map[reflect.Type]interface{} + + // If TrackCycles is enabled, pretty will detect and track + // self-referential structures. If a self-referential structure (aka a + // "recursive" value) is detected, numbered placeholders will be emitted. + // + // Pointer tracking is disabled by default for performance reasons. + TrackCycles bool +} + +// Default Config objects +var ( + // DefaultFormatter is the default set of overrides for stringification. + DefaultFormatter = map[reflect.Type]interface{}{ + reflect.TypeOf(time.Time{}): fmt.Sprint, + reflect.TypeOf(net.IP{}): fmt.Sprint, + reflect.TypeOf((*error)(nil)).Elem(): fmt.Sprint, + } + + // CompareConfig is the default configuration used for Compare. + CompareConfig = &Config{ + Diffable: true, + IncludeUnexported: true, + Formatter: DefaultFormatter, + } + + // DefaultConfig is the default configuration used for all other top-level functions. + DefaultConfig = &Config{ + Formatter: DefaultFormatter, + } + + // CycleTracker is a convenience config for formatting and comparing recursive structures. + CycleTracker = &Config{ + Diffable: true, + Formatter: DefaultFormatter, + TrackCycles: true, + } +) + +func (cfg *Config) fprint(buf *bytes.Buffer, vals ...interface{}) { + ref := &reflector{ + Config: cfg, + } + if cfg.TrackCycles { + ref.pointerTracker = new(pointerTracker) + } + for i, val := range vals { + if i > 0 { + buf.WriteByte('\n') + } + newFormatter(cfg, buf).write(ref.val2node(reflect.ValueOf(val))) + } +} + +// Print writes the DefaultConfig representation of the given values to standard output. +func Print(vals ...interface{}) { + DefaultConfig.Print(vals...) +} + +// Print writes the configured presentation of the given values to standard output. +func (cfg *Config) Print(vals ...interface{}) { + fmt.Println(cfg.Sprint(vals...)) +} + +// Sprint returns a string representation of the given value according to the DefaultConfig. +func Sprint(vals ...interface{}) string { + return DefaultConfig.Sprint(vals...) +} + +// Sprint returns a string representation of the given value according to cfg. +func (cfg *Config) Sprint(vals ...interface{}) string { + buf := new(bytes.Buffer) + cfg.fprint(buf, vals...) + return buf.String() +} + +// Fprint writes the representation of the given value to the writer according to the DefaultConfig. +func Fprint(w io.Writer, vals ...interface{}) (n int64, err error) { + return DefaultConfig.Fprint(w, vals...) +} + +// Fprint writes the representation of the given value to the writer according to the cfg. +func (cfg *Config) Fprint(w io.Writer, vals ...interface{}) (n int64, err error) { + buf := new(bytes.Buffer) + cfg.fprint(buf, vals...) + return buf.WriteTo(w) +} + +// Compare returns a string containing a line-by-line unified diff of the +// values in a and b, using the CompareConfig. +// +// Each line in the output is prefixed with '+', '-', or ' ' to indicate which +// side it's from. Lines from the a side are marked with '-', lines from the +// b side are marked with '+' and lines that are the same on both sides are +// marked with ' '. +// +// The comparison is based on the intentionally-untyped output of Print, and as +// such this comparison is pretty forviving. In particular, if the types of or +// types within in a and b are different but have the same representation, +// Compare will not indicate any differences between them. +func Compare(a, b interface{}) string { + return CompareConfig.Compare(a, b) +} + +// Compare returns a string containing a line-by-line unified diff of the +// values in got and want according to the cfg. +// +// Each line in the output is prefixed with '+', '-', or ' ' to indicate which +// side it's from. Lines from the a side are marked with '-', lines from the +// b side are marked with '+' and lines that are the same on both sides are +// marked with ' '. +// +// The comparison is based on the intentionally-untyped output of Print, and as +// such this comparison is pretty forviving. In particular, if the types of or +// types within in a and b are different but have the same representation, +// Compare will not indicate any differences between them. +func (cfg *Config) Compare(a, b interface{}) string { + diffCfg := *cfg + diffCfg.Diffable = true + return diff.Diff(cfg.Sprint(a), cfg.Sprint(b)) +} diff --git a/vendor/github.com/kylelemons/godebug/pretty/reflect.go b/vendor/github.com/kylelemons/godebug/pretty/reflect.go new file mode 100644 index 000000000..5cd30b7f0 --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/pretty/reflect.go @@ -0,0 +1,241 @@ +// Copyright 2013 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import ( + "encoding" + "fmt" + "reflect" + "sort" +) + +func isZeroVal(val reflect.Value) bool { + if !val.CanInterface() { + return false + } + z := reflect.Zero(val.Type()).Interface() + return reflect.DeepEqual(val.Interface(), z) +} + +// pointerTracker is a helper for tracking pointer chasing to detect cycles. +type pointerTracker struct { + addrs map[uintptr]int // addr[address] = seen count + + lastID int + ids map[uintptr]int // ids[address] = id +} + +// track tracks following a reference (pointer, slice, map, etc). Every call to +// track should be paired with a call to untrack. +func (p *pointerTracker) track(ptr uintptr) { + if p.addrs == nil { + p.addrs = make(map[uintptr]int) + } + p.addrs[ptr]++ +} + +// untrack registers that we have backtracked over the reference to the pointer. +func (p *pointerTracker) untrack(ptr uintptr) { + p.addrs[ptr]-- + if p.addrs[ptr] == 0 { + delete(p.addrs, ptr) + } +} + +// seen returns whether the pointer was previously seen along this path. +func (p *pointerTracker) seen(ptr uintptr) bool { + _, ok := p.addrs[ptr] + return ok +} + +// keep allocates an ID for the given address and returns it. +func (p *pointerTracker) keep(ptr uintptr) int { + if p.ids == nil { + p.ids = make(map[uintptr]int) + } + if _, ok := p.ids[ptr]; !ok { + p.lastID++ + p.ids[ptr] = p.lastID + } + return p.ids[ptr] +} + +// id returns the ID for the given address. +func (p *pointerTracker) id(ptr uintptr) (int, bool) { + if p.ids == nil { + p.ids = make(map[uintptr]int) + } + id, ok := p.ids[ptr] + return id, ok +} + +// reflector adds local state to the recursive reflection logic. +type reflector struct { + *Config + *pointerTracker +} + +// follow handles following a possiblly-recursive reference to the given value +// from the given ptr address. +func (r *reflector) follow(ptr uintptr, val reflect.Value) node { + if r.pointerTracker == nil { + // Tracking disabled + return r.val2node(val) + } + + // If a parent already followed this, emit a reference marker + if r.seen(ptr) { + id := r.keep(ptr) + return ref{id} + } + + // Track the pointer we're following while on this recursive branch + r.track(ptr) + defer r.untrack(ptr) + n := r.val2node(val) + + // If the recursion used this ptr, wrap it with a target marker + if id, ok := r.id(ptr); ok { + return target{id, n} + } + + // Otherwise, return the node unadulterated + return n +} + +func (r *reflector) val2node(val reflect.Value) node { + if !val.IsValid() { + return rawVal("nil") + } + + if val.CanInterface() { + v := val.Interface() + if formatter, ok := r.Formatter[val.Type()]; ok { + if formatter != nil { + res := reflect.ValueOf(formatter).Call([]reflect.Value{val}) + return rawVal(res[0].Interface().(string)) + } + } else { + if s, ok := v.(fmt.Stringer); ok && r.PrintStringers { + return stringVal(s.String()) + } + if t, ok := v.(encoding.TextMarshaler); ok && r.PrintTextMarshalers { + if raw, err := t.MarshalText(); err == nil { // if NOT an error + return stringVal(string(raw)) + } + } + } + } + + switch kind := val.Kind(); kind { + case reflect.Ptr: + if val.IsNil() { + return rawVal("nil") + } + return r.follow(val.Pointer(), val.Elem()) + case reflect.Interface: + if val.IsNil() { + return rawVal("nil") + } + return r.val2node(val.Elem()) + case reflect.String: + return stringVal(val.String()) + case reflect.Slice: + n := list{} + length := val.Len() + ptr := val.Pointer() + for i := 0; i < length; i++ { + n = append(n, r.follow(ptr, val.Index(i))) + } + return n + case reflect.Array: + n := list{} + length := val.Len() + for i := 0; i < length; i++ { + n = append(n, r.val2node(val.Index(i))) + } + return n + case reflect.Map: + // Extract the keys and sort them for stable iteration + keys := val.MapKeys() + pairs := make([]mapPair, 0, len(keys)) + for _, key := range keys { + pairs = append(pairs, mapPair{ + key: new(formatter).compactString(r.val2node(key)), // can't be cyclic + value: val.MapIndex(key), + }) + } + sort.Sort(byKey(pairs)) + + // Process the keys into the final representation + ptr, n := val.Pointer(), keyvals{} + for _, pair := range pairs { + n = append(n, keyval{ + key: pair.key, + val: r.follow(ptr, pair.value), + }) + } + return n + case reflect.Struct: + n := keyvals{} + typ := val.Type() + fields := typ.NumField() + for i := 0; i < fields; i++ { + sf := typ.Field(i) + if !r.IncludeUnexported && sf.PkgPath != "" { + continue + } + field := val.Field(i) + if r.SkipZeroFields && isZeroVal(field) { + continue + } + n = append(n, keyval{sf.Name, r.val2node(field)}) + } + return n + case reflect.Bool: + if val.Bool() { + return rawVal("true") + } + return rawVal("false") + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return rawVal(fmt.Sprintf("%d", val.Int())) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return rawVal(fmt.Sprintf("%d", val.Uint())) + case reflect.Uintptr: + return rawVal(fmt.Sprintf("0x%X", val.Uint())) + case reflect.Float32, reflect.Float64: + return rawVal(fmt.Sprintf("%v", val.Float())) + case reflect.Complex64, reflect.Complex128: + return rawVal(fmt.Sprintf("%v", val.Complex())) + } + + // Fall back to the default %#v if we can + if val.CanInterface() { + return rawVal(fmt.Sprintf("%#v", val.Interface())) + } + + return rawVal(val.String()) +} + +type mapPair struct { + key string + value reflect.Value +} + +type byKey []mapPair + +func (v byKey) Len() int { return len(v) } +func (v byKey) Swap(i, j int) { v[i], v[j] = v[j], v[i] } +func (v byKey) Less(i, j int) bool { return v[i].key < v[j].key } diff --git a/vendor/github.com/kylelemons/godebug/pretty/structure.go b/vendor/github.com/kylelemons/godebug/pretty/structure.go new file mode 100644 index 000000000..d876f60ca --- /dev/null +++ b/vendor/github.com/kylelemons/godebug/pretty/structure.go @@ -0,0 +1,223 @@ +// Copyright 2013 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import ( + "bufio" + "bytes" + "fmt" + "io" + "strconv" + "strings" +) + +// a formatter stores stateful formatting information as well as being +// an io.Writer for simplicity. +type formatter struct { + *bufio.Writer + *Config + + // Self-referential structure tracking + tagNumbers map[int]int // tagNumbers[id] = <#n> +} + +// newFormatter creates a new buffered formatter. For the output to be written +// to the given writer, this must be accompanied by a call to write (or Flush). +func newFormatter(cfg *Config, w io.Writer) *formatter { + return &formatter{ + Writer: bufio.NewWriter(w), + Config: cfg, + tagNumbers: make(map[int]int), + } +} + +func (f *formatter) write(n node) { + defer f.Flush() + n.format(f, "") +} + +func (f *formatter) tagFor(id int) int { + if tag, ok := f.tagNumbers[id]; ok { + return tag + } + if f.tagNumbers == nil { + return 0 + } + tag := len(f.tagNumbers) + 1 + f.tagNumbers[id] = tag + return tag +} + +type node interface { + format(f *formatter, indent string) +} + +func (f *formatter) compactString(n node) string { + switch k := n.(type) { + case stringVal: + return string(k) + case rawVal: + return string(k) + } + + buf := new(bytes.Buffer) + f2 := newFormatter(&Config{Compact: true}, buf) + f2.tagNumbers = f.tagNumbers // reuse tagNumbers just in case + f2.write(n) + return buf.String() +} + +type stringVal string + +func (str stringVal) format(f *formatter, indent string) { + f.WriteString(strconv.Quote(string(str))) +} + +type rawVal string + +func (r rawVal) format(f *formatter, indent string) { + f.WriteString(string(r)) +} + +type keyval struct { + key string + val node +} + +type keyvals []keyval + +func (l keyvals) format(f *formatter, indent string) { + f.WriteByte('{') + + switch { + case f.Compact: + // All on one line: + for i, kv := range l { + if i > 0 { + f.WriteByte(',') + } + f.WriteString(kv.key) + f.WriteByte(':') + kv.val.format(f, indent) + } + case f.Diffable: + f.WriteByte('\n') + inner := indent + " " + // Each value gets its own line: + for _, kv := range l { + f.WriteString(inner) + f.WriteString(kv.key) + f.WriteString(": ") + kv.val.format(f, inner) + f.WriteString(",\n") + } + f.WriteString(indent) + default: + keyWidth := 0 + for _, kv := range l { + if kw := len(kv.key); kw > keyWidth { + keyWidth = kw + } + } + alignKey := indent + " " + alignValue := strings.Repeat(" ", keyWidth) + inner := alignKey + alignValue + " " + // First and last line shared with bracket: + for i, kv := range l { + if i > 0 { + f.WriteString(",\n") + f.WriteString(alignKey) + } + f.WriteString(kv.key) + f.WriteString(": ") + f.WriteString(alignValue[len(kv.key):]) + kv.val.format(f, inner) + } + } + + f.WriteByte('}') +} + +type list []node + +func (l list) format(f *formatter, indent string) { + if max := f.ShortList; max > 0 { + short := f.compactString(l) + if len(short) <= max { + f.WriteString(short) + return + } + } + + f.WriteByte('[') + + switch { + case f.Compact: + // All on one line: + for i, v := range l { + if i > 0 { + f.WriteByte(',') + } + v.format(f, indent) + } + case f.Diffable: + f.WriteByte('\n') + inner := indent + " " + // Each value gets its own line: + for _, v := range l { + f.WriteString(inner) + v.format(f, inner) + f.WriteString(",\n") + } + f.WriteString(indent) + default: + inner := indent + " " + // First and last line shared with bracket: + for i, v := range l { + if i > 0 { + f.WriteString(",\n") + f.WriteString(inner) + } + v.format(f, inner) + } + } + + f.WriteByte(']') +} + +type ref struct { + id int +} + +func (r ref) format(f *formatter, indent string) { + fmt.Fprintf(f, "", f.tagFor(r.id)) +} + +type target struct { + id int + value node +} + +func (t target) format(f *formatter, indent string) { + tag := fmt.Sprintf("<#%d> ", f.tagFor(t.id)) + switch { + case f.Diffable, f.Compact: + // no indent changes + default: + indent += strings.Repeat(" ", len(tag)) + } + f.WriteString(tag) + t.value.format(f, indent) +} diff --git a/vendor/github.com/pkg/browser/LICENSE b/vendor/github.com/pkg/browser/LICENSE new file mode 100644 index 000000000..65f78fb62 --- /dev/null +++ b/vendor/github.com/pkg/browser/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014, Dave Cheney +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/browser/README.md b/vendor/github.com/pkg/browser/README.md new file mode 100644 index 000000000..72b1976e3 --- /dev/null +++ b/vendor/github.com/pkg/browser/README.md @@ -0,0 +1,55 @@ + +# browser + import "github.com/pkg/browser" + +Package browser provides helpers to open files, readers, and urls in a browser window. + +The choice of which browser is started is entirely client dependant. + + + + + +## Variables +``` go +var Stderr io.Writer = os.Stderr +``` +Stderr is the io.Writer to which executed commands write standard error. + +``` go +var Stdout io.Writer = os.Stdout +``` +Stdout is the io.Writer to which executed commands write standard output. + + +## func OpenFile +``` go +func OpenFile(path string) error +``` +OpenFile opens new browser window for the file path. + + +## func OpenReader +``` go +func OpenReader(r io.Reader) error +``` +OpenReader consumes the contents of r and presents the +results in a new browser window. + + +## func OpenURL +``` go +func OpenURL(url string) error +``` +OpenURL opens a new browser window pointing to url. + + + + + + + + + +- - - +Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md) diff --git a/vendor/github.com/pkg/browser/browser.go b/vendor/github.com/pkg/browser/browser.go new file mode 100644 index 000000000..d7969d74d --- /dev/null +++ b/vendor/github.com/pkg/browser/browser.go @@ -0,0 +1,57 @@ +// Package browser provides helpers to open files, readers, and urls in a browser window. +// +// The choice of which browser is started is entirely client dependant. +package browser + +import ( + "fmt" + "io" + "io/ioutil" + "os" + "os/exec" + "path/filepath" +) + +// Stdout is the io.Writer to which executed commands write standard output. +var Stdout io.Writer = os.Stdout + +// Stderr is the io.Writer to which executed commands write standard error. +var Stderr io.Writer = os.Stderr + +// OpenFile opens new browser window for the file path. +func OpenFile(path string) error { + path, err := filepath.Abs(path) + if err != nil { + return err + } + return OpenURL("file://" + path) +} + +// OpenReader consumes the contents of r and presents the +// results in a new browser window. +func OpenReader(r io.Reader) error { + f, err := ioutil.TempFile("", "browser.*.html") + if err != nil { + return fmt.Errorf("browser: could not create temporary file: %v", err) + } + if _, err := io.Copy(f, r); err != nil { + f.Close() + return fmt.Errorf("browser: caching temporary file failed: %v", err) + } + if err := f.Close(); err != nil { + return fmt.Errorf("browser: caching temporary file failed: %v", err) + } + return OpenFile(f.Name()) +} + +// OpenURL opens a new browser window pointing to url. +func OpenURL(url string) error { + return openBrowser(url) +} + +func runCmd(prog string, args ...string) error { + cmd := exec.Command(prog, args...) + cmd.Stdout = Stdout + cmd.Stderr = Stderr + return cmd.Run() +} diff --git a/vendor/github.com/pkg/browser/browser_darwin.go b/vendor/github.com/pkg/browser/browser_darwin.go new file mode 100644 index 000000000..8507cf7c2 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_darwin.go @@ -0,0 +1,5 @@ +package browser + +func openBrowser(url string) error { + return runCmd("open", url) +} diff --git a/vendor/github.com/pkg/browser/browser_freebsd.go b/vendor/github.com/pkg/browser/browser_freebsd.go new file mode 100644 index 000000000..4fc7ff076 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_freebsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_linux.go b/vendor/github.com/pkg/browser/browser_linux.go new file mode 100644 index 000000000..d26cdddf9 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_linux.go @@ -0,0 +1,21 @@ +package browser + +import ( + "os/exec" + "strings" +) + +func openBrowser(url string) error { + providers := []string{"xdg-open", "x-www-browser", "www-browser"} + + // There are multiple possible providers to open a browser on linux + // One of them is xdg-open, another is x-www-browser, then there's www-browser, etc. + // Look for one that exists and run it + for _, provider := range providers { + if _, err := exec.LookPath(provider); err == nil { + return runCmd(provider, url) + } + } + + return &exec.Error{Name: strings.Join(providers, ","), Err: exec.ErrNotFound} +} diff --git a/vendor/github.com/pkg/browser/browser_netbsd.go b/vendor/github.com/pkg/browser/browser_netbsd.go new file mode 100644 index 000000000..65a5e5a29 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_netbsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from pkgsrc(7)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_openbsd.go b/vendor/github.com/pkg/browser/browser_openbsd.go new file mode 100644 index 000000000..4fc7ff076 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_openbsd.go @@ -0,0 +1,14 @@ +package browser + +import ( + "errors" + "os/exec" +) + +func openBrowser(url string) error { + err := runCmd("xdg-open", url) + if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound { + return errors.New("xdg-open: command not found - install xdg-utils from ports(8)") + } + return err +} diff --git a/vendor/github.com/pkg/browser/browser_unsupported.go b/vendor/github.com/pkg/browser/browser_unsupported.go new file mode 100644 index 000000000..7c5c17d34 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_unsupported.go @@ -0,0 +1,12 @@ +// +build !linux,!windows,!darwin,!openbsd,!freebsd,!netbsd + +package browser + +import ( + "fmt" + "runtime" +) + +func openBrowser(url string) error { + return fmt.Errorf("openBrowser: unsupported operating system: %v", runtime.GOOS) +} diff --git a/vendor/github.com/pkg/browser/browser_windows.go b/vendor/github.com/pkg/browser/browser_windows.go new file mode 100644 index 000000000..63e192959 --- /dev/null +++ b/vendor/github.com/pkg/browser/browser_windows.go @@ -0,0 +1,7 @@ +package browser + +import "golang.org/x/sys/windows" + +func openBrowser(url string) error { + return windows.ShellExecute(0, nil, windows.StringToUTF16Ptr(url), nil, nil, windows.SW_SHOWNORMAL) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 78007ef54..72d7420ad 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,6 +10,45 @@ github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage github.com/Azure/azure-sdk-for-go/version +# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.4 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/azcore +github.com/Azure/azure-sdk-for-go/sdk/azcore/arm +github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy +github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime +github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/log +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/async +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/body +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/loc +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/pollers/op +github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared +github.com/Azure/azure-sdk-for-go/sdk/azcore/log +github.com/Azure/azure-sdk-for-go/sdk/azcore/policy +github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime +github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming +github.com/Azure/azure-sdk-for-go/sdk/azcore/to +# github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/azidentity +# github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/internal/diag +github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo +github.com/Azure/azure-sdk-for-go/sdk/internal/log +github.com/Azure/azure-sdk-for-go/sdk/internal/temporal +github.com/Azure/azure-sdk-for-go/sdk/internal/uuid +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.0.1 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources # github.com/Azure/azure-storage-blob-go v0.8.0 ## explicit github.com/Azure/azure-storage-blob-go/azblob @@ -23,11 +62,11 @@ github.com/Azure/go-autorest/autorest/azure # github.com/Azure/go-autorest/autorest/adal v0.9.20 ## explicit; go 1.15 github.com/Azure/go-autorest/autorest/adal -# github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 -## explicit; go 1.12 +# github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 +## explicit; go 1.15 github.com/Azure/go-autorest/autorest/azure/auth -# github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 -## explicit; go 1.12 +# github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 +## explicit; go 1.15 github.com/Azure/go-autorest/autorest/azure/cli # github.com/Azure/go-autorest/autorest/date v0.3.0 ## explicit; go 1.12 @@ -44,6 +83,28 @@ github.com/Azure/go-autorest/logger # github.com/Azure/go-autorest/tracing v0.6.0 ## explicit; go 1.12 github.com/Azure/go-autorest/tracing +# github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 +## explicit; go 1.17 +github.com/AzureAD/microsoft-authentication-library-for-go/apps/cache +github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential +github.com/AzureAD/microsoft-authentication-library-for-go/apps/errors +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/internal/storage +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/exported +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/json/types/time +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/accesstokens +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/comm +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/internal/grant +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/wstrust/defs +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/shared +github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/version +github.com/AzureAD/microsoft-authentication-library-for-go/apps/public # github.com/BurntSushi/toml v0.3.1 ## explicit github.com/BurntSushi/toml @@ -81,7 +142,7 @@ github.com/cyphar/filepath-securejoin # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/dimchansky/utfbom v1.1.0 +# github.com/dimchansky/utfbom v1.1.1 ## explicit github.com/dimchansky/utfbom # github.com/dsnet/compress v0.0.1 @@ -327,8 +388,8 @@ github.com/gogo/protobuf/protoc-gen-gogo/plugin github.com/gogo/protobuf/sortkeys github.com/gogo/protobuf/vanity github.com/gogo/protobuf/vanity/command -# github.com/golang-jwt/jwt/v4 v4.2.0 -## explicit; go 1.15 +# github.com/golang-jwt/jwt/v4 v4.4.2 +## explicit; go 1.16 github.com/golang-jwt/jwt/v4 # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit @@ -410,6 +471,10 @@ github.com/json-iterator/go # github.com/kubernetes-csi/external-snapshotter/v2 v2.1.4 ## explicit; go 1.12 github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1 +# github.com/kylelemons/godebug v1.1.0 +## explicit; go 1.11 +github.com/kylelemons/godebug/diff +github.com/kylelemons/godebug/pretty # github.com/magiconair/properties v1.8.6 ## explicit; go 1.13 github.com/magiconair/properties @@ -513,6 +578,9 @@ github.com/pelletier/go-toml/v2/internal/tracker ## explicit github.com/pierrec/lz4 github.com/pierrec/lz4/internal/xxh32 +# github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 +## explicit; go 1.14 +github.com/pkg/browser # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors